#define asconst_DTV_OFFSET 8
#define asconst_TLSDESC_ARG 8
#define asconst_TLSDESC_GEN_COUNT 16
#define asconst_TLSDESC_MODID 0
#define asconst_TLSDESC_MODOFF 8
#include <stddef.h>
#include <sysdep.h>
#include <tls.h>
#include <link.h>
#include <dl-tlsdesc.h>

#include <inttypes.h>

#include <stdio.h>

#include <bits/wordsize.h>

#if __WORDSIZE == 64

typedef uint64_t c_t;

#define U(n) UINT64_C (n)

#define PRI PRId64

#else

typedef uint32_t c_t;

#define U(n) UINT32_C (n)

#define PRI PRId32

#endif

static int do_test (void)
{
  int bad = 0, good = 0;

#define TEST(name, source, expr) \
  if (U (asconst_##name) != (c_t) (expr)) { ++bad; fprintf (stderr, "%s: %s is %" PRI " but %s is %"PRI "\n", source, #name, U (asconst_##name), #expr, (c_t) (expr)); } else ++good;

  TEST (DTV_OFFSET, "../sysdeps/x86_64/tlsdesc.sym:11", offsetof(struct pthread, header.dtv))
  TEST (TLSDESC_ARG, "../sysdeps/x86_64/tlsdesc.sym:13", offsetof(struct tlsdesc, arg))
  TEST (TLSDESC_GEN_COUNT, "../sysdeps/x86_64/tlsdesc.sym:15", offsetof(struct tlsdesc_dynamic_arg, gen_count))
  TEST (TLSDESC_MODID, "../sysdeps/x86_64/tlsdesc.sym:16", offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_module))
  TEST (TLSDESC_MODOFF, "../sysdeps/x86_64/tlsdesc.sym:17", offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_offset))
  printf ("%d errors in %d tests\n", bad, good + bad);
  return bad != 0 || good == 0;
}

#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
