summaryrefslogtreecommitdiff
path: root/libc/elf
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-07-31 15:30:38 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-07-31 15:30:38 +0000
commitdd3105b347f432016fcdc1abd472c3717f557c9e (patch)
treecbaaecdaa1d3ad240177c9040f7f46c1387716ce /libc/elf
parent20f73aac36c2b2c240dcc379d5117488fe44960c (diff)
Merge changes between r19464 and r19920 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@19921 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/elf')
-rw-r--r--libc/elf/Makefile17
-rw-r--r--libc/elf/dl-close.c3
-rw-r--r--libc/elf/dl-load.c9
-rw-r--r--libc/elf/dl-open.c23
-rw-r--r--libc/elf/elf.h3
-rw-r--r--libc/elf/rtld-debugger-interface.txt122
-rw-r--r--libc/elf/rtld.c5
-rw-r--r--libc/elf/tls-macros.h738
-rw-r--r--libc/elf/tst-auditmod1.c71
-rw-r--r--libc/elf/tst-auditmod3b.c13
-rw-r--r--libc/elf/tst-auditmod4b.c13
-rw-r--r--libc/elf/tst-auditmod5b.c13
-rw-r--r--libc/elf/tst-auditmod6b.c13
-rw-r--r--libc/elf/tst-auditmod6c.c13
-rw-r--r--libc/elf/tst-auditmod7b.c13
-rw-r--r--libc/elf/tst-unique1mod1.c2
-rw-r--r--libc/elf/tst-unique1mod2.c2
-rw-r--r--libc/elf/tst-unique2mod1.c2
-rw-r--r--libc/elf/tst-unique2mod2.c2
19 files changed, 168 insertions, 909 deletions
diff --git a/libc/elf/Makefile b/libc/elf/Makefile
index 2880e8089..b8ff4f3c2 100644
--- a/libc/elf/Makefile
+++ b/libc/elf/Makefile
@@ -957,15 +957,6 @@ $(all-built-dso:=.jmprel): %.jmprel: % Makefile
mv -f $@T $@
common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
-check-data := $(firstword $(wildcard \
- $(foreach D,$(add-ons) scripts,\
- $(patsubst %,$(..)$D/data/localplt-%.data,\
- $(abi-name) \
- $(addsuffix -$(config-os),\
- $(config-machine) \
- $(base-machine)) \
- generic))))
-
tests: $(objpfx)check-localplt.out
localplt-built-dso := $(addprefix $(common-objpfx),\
@@ -980,12 +971,14 @@ ifeq ($(have-thread-library),yes)
localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
endif
+vpath localplt.data $(+sysdep_dirs)
+
$(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
$(..)scripts/localplt.awk \
$(localplt-built-dso:=.jmprel) \
- $(check-data)
- LC_ALL=C $(AWK) -f $(filter-out $< $(check-data),$^) | \
- LC_ALL=C $(AWK) -f $< $(check-data) - \
+ localplt.data
+ LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
+ LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
> $@
endif
diff --git a/libc/elf/dl-close.c b/libc/elf/dl-close.c
index 410fb48d4..8fb3a742b 100644
--- a/libc/elf/dl-close.c
+++ b/libc/elf/dl-close.c
@@ -31,6 +31,7 @@
#include <sys/mman.h>
#include <sysdep-cancel.h>
#include <tls.h>
+#include <stap-probe.h>
/* Type of the constructor functions. */
@@ -468,6 +469,7 @@ _dl_close_worker (struct link_map *map)
struct r_debug *r = _dl_debug_initialize (0, nsid);
r->r_state = RT_DELETE;
_dl_debug_state ();
+ LIBC_PROBE (unmap_start, 2, nsid, r);
if (unload_global)
{
@@ -737,6 +739,7 @@ _dl_close_worker (struct link_map *map)
/* Notify the debugger those objects are finalized and gone. */
r->r_state = RT_CONSISTENT;
_dl_debug_state ();
+ LIBC_PROBE (unmap_complete, 2, nsid, r);
/* Recheck if we need to retry, release the lock. */
out:
diff --git a/libc/elf/dl-load.c b/libc/elf/dl-load.c
index 5164894a6..bc969e9e3 100644
--- a/libc/elf/dl-load.c
+++ b/libc/elf/dl-load.c
@@ -35,6 +35,7 @@
#include <stackinfo.h>
#include <caller.h>
#include <sysdep.h>
+#include <stap-probe.h>
#include <dl-dst.h>
@@ -882,7 +883,7 @@ _dl_init_paths (const char *llp)
static void
__attribute__ ((noreturn, noinline))
lose (int code, int fd, const char *name, char *realname, struct link_map *l,
- const char *msg, struct r_debug *r)
+ const char *msg, struct r_debug *r, Lmid_t nsid)
{
/* The file might already be closed. */
if (fd != -1)
@@ -896,6 +897,7 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l,
{
r->r_state = RT_CONSISTENT;
_dl_debug_state ();
+ LIBC_PROBE (map_failed, 2, nsid, r);
}
_dl_signal_error (code, name, NULL, msg);
@@ -934,7 +936,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
errval = errno;
call_lose:
lose (errval, fd, name, realname, l, errstring,
- make_consistent ? r : NULL);
+ make_consistent ? r : NULL, nsid);
}
/* Look again to see if the real name matched another already loaded. */
@@ -1041,6 +1043,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
linking has not been used before. */
r->r_state = RT_ADD;
_dl_debug_state ();
+ LIBC_PROBE (map_start, 2, nsid, r);
make_consistent = true;
}
else
@@ -1740,7 +1743,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
name = strdupa (realname);
free (realname);
}
- lose (errval, fd, name, NULL, NULL, errstring, NULL);
+ lose (errval, fd, name, NULL, NULL, errstring, NULL, 0);
}
/* See whether the ELF header is what we expect. */
diff --git a/libc/elf/dl-open.c b/libc/elf/dl-open.c
index 32ae5cffe..8538f87a1 100644
--- a/libc/elf/dl-open.c
+++ b/libc/elf/dl-open.c
@@ -32,6 +32,7 @@
#include <caller.h>
#include <sysdep-cancel.h>
#include <tls.h>
+#include <stap-probe.h>
#include <dl-dst.h>
@@ -45,7 +46,7 @@ weak_extern (BP_SYM (_dl_sysdep_start))
extern int __libc_multiple_libcs; /* Defined in init-first.c. */
-/* We must be carefull not to leave us in an inconsistent state. Thus we
+/* We must be careful not to leave us in an inconsistent state. Thus we
catch any error and re-raise it after cleaning up. */
struct dl_open_args
@@ -54,7 +55,7 @@ struct dl_open_args
int mode;
/* This is the caller of the dlopen() function. */
const void *caller_dlopen;
- /* This is the caller if _dl_open(). */
+ /* This is the caller of _dl_open(). */
const void *caller_dl_open;
struct link_map *map;
/* Namespace ID. */
@@ -291,6 +292,7 @@ dl_open_worker (void *a)
struct r_debug *r = _dl_debug_initialize (0, args->nsid);
r->r_state = RT_CONSISTENT;
_dl_debug_state ();
+ LIBC_PROBE (map_complete, 3, args->nsid, r, new);
/* Print scope information. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
@@ -376,10 +378,19 @@ dl_open_worker (void *a)
}
}
+ int relocation_in_progress = 0;
+
for (size_t i = nmaps; i-- > 0; )
{
l = maps[i];
+ if (! relocation_in_progress)
+ {
+ /* Notify the debugger that relocations are about to happen. */
+ LIBC_PROBE (reloc_start, 2, args->nsid, r);
+ relocation_in_progress = 1;
+ }
+
#ifdef SHARED
if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
{
@@ -511,7 +522,7 @@ dl_open_worker (void *a)
TLS generation counter wrapped! Please report this."));
/* We need a second pass for static tls data, because _dl_update_slotinfo
- must not be run while calls to _dl_add_to_slotinfo are still pending. */
+ must not be run while calls to _dl_add_to_slotinfo are still pending. */
for (unsigned int i = first_static_tls; i < new->l_searchlist.r_nlist; ++i)
{
struct link_map *imap = new->l_searchlist.r_list[i];
@@ -522,7 +533,7 @@ TLS generation counter wrapped! Please report this."));
{
/* For static TLS we have to allocate the memory here and
now. This includes allocating memory in the DTV. But we
- cannot change any DTV other than our own. So, if we
+ cannot change any DTV other than our own. So, if we
cannot guarantee that there is room in the DTV we don't
even try it and fail the load.
@@ -544,6 +555,10 @@ cannot load any more object with static TLS"));
}
}
+ /* Notify the debugger all new objects have been relocated. */
+ if (relocation_in_progress)
+ LIBC_PROBE (reloc_complete, 3, args->nsid, r, new);
+
/* Run the initializer functions of new objects. */
_dl_init (new, args->argc, args->argv, args->env);
diff --git a/libc/elf/elf.h b/libc/elf/elf.h
index 6522ea6b6..71cfdb818 100644
--- a/libc/elf/elf.h
+++ b/libc/elf/elf.h
@@ -2627,8 +2627,9 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */
#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS
block offset. */
+#define R_390_IRELATIVE 61 /* STT_GNU_IFUNC relocation. */
/* Keep this the last entry. */
-#define R_390_NUM 61
+#define R_390_NUM 62
/* CRIS relocations. */
diff --git a/libc/elf/rtld-debugger-interface.txt b/libc/elf/rtld-debugger-interface.txt
new file mode 100644
index 000000000..61bc99e4b
--- /dev/null
+++ b/libc/elf/rtld-debugger-interface.txt
@@ -0,0 +1,122 @@
+Standard debugger interface
+===========================
+
+The run-time linker exposes a rendezvous structure to allow debuggers
+to interface with it. This structure, r_debug, is defined in link.h.
+If the executable's dynamic section has a DT_DEBUG element, the
+run-time linker sets that element's value to the address where this
+structure can be found.
+
+The r_debug structure contains (amongst others) the following fields:
+
+ struct link_map *r_map:
+ A linked list of loaded objects.
+
+ enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state:
+ The current state of the r_map list. RT_CONSISTENT means that r_map
+ is not currently being modified and may safely be inspected. RT_ADD
+ means that an object is being added to r_map, and that the list is
+ not guaranteed to be consistent. Likewise RT_DELETE means that an
+ object is being removed from the list.
+
+ ElfW(Addr) r_brk:
+ The address of a function internal to the run-time linker which is
+ called whenever r_state is changed. The debugger should set a
+ breakpoint at this address if it wants to notice mapping changes.
+
+This protocol is widely supported, but somewhat limited in that it
+has no provision to provide access to multiple namespaces, and that
+the notifications (via r_brk) only refer to changes to r_map--the
+debugger is notified that a new object has been added, for instance,
+but there is no way for the debugger to discover whether any of the
+objects in the link-map have been relocated or not.
+
+
+Probe-based debugger interface
+==============================
+
+Systemtap is a dynamic tracing/instrumenting tool available on Linux.
+Probes that are not fired at run time have close to zero overhead.
+glibc contains a number of probes that debuggers can set breakpoints
+on in order to notice certain events.
+
+All rtld probes have the following arguments:
+
+ arg1: Lmid_t lmid:
+ The link-map ID of the link-map list that the object was loaded
+ into. This will be LM_ID_BASE for the application's main link-map
+ list, or some other value for different namespaces.
+
+ arg2: struct r_debug *r_debug:
+ A pointer to the r_debug structure containing the link-map list
+ that the object was loaded into. This will be the value stored in
+ DT_DEBUG for the application's main link-map list, or some other
+ value for different namespaces.
+
+map_complete and reloc_complete may have the following additional
+argument:
+
+ arg3: struct link_map *new:
+ A pointer which, if not NULL, points to the entry in the specified
+ r_debug structure's link-map list corresponding to the first new
+ object to have been mapped or relocated, with new->l_next pointing
+ to the link-map of the next new object to have been mapped or
+ relocated, and so on. Note that because `new' is an entry in a
+ larger list, new->l_prev (if not NULL) will point to what was the
+ last link-map in the link-map list prior to the new objects being
+ mapped or relocated.
+
+The following probes are available:
+
+ init_start:
+ This is called once, when the linker is about to fill in the main
+ r_debug structure at application startup. init_start always has
+ lmid set to LM_ID_BASE and r_debug set to the value stored in
+ DT_DEBUG. r_debug is not guaranteed to be consistent until
+ init_complete is fired.
+
+ init_complete:
+ This is called once, when the linker has filled in the main
+ r_debug structure at application startup. init_complete always
+ has lmid set to LM_ID_BASE and r_debug set to the value stored
+ in DT_DEBUG. The r_debug structure is consistent and may be
+ inspected, and all objects in the link-map are guaranteed to
+ have been relocated.
+
+ map_start:
+ The linker is about to map new objects into the specified
+ namespace. The namespace's r_debug structure is not guaranteed
+ to be consistent until a corresponding map_complete is fired.
+
+ map_complete:
+ The linker has finished mapping new objects into the specified
+ namespace. The namespace's r_debug structure is consistent and
+ may be inspected, although objects in the namespace's link-map
+ are not guaranteed to have been relocated.
+
+ map_failed:
+ The linker failed while attempting to map new objects into
+ the specified namespace. The namespace's r_debug structure
+ is consistent and may be inspected.
+
+ reloc_start:
+ The linker is about to relocate all unrelocated objects in the
+ specified namespace. The namespace's r_debug structure is not
+ guaranteed to be consistent until a corresponding reloc_complete
+ is fired.
+
+ reloc_complete:
+ The linker has relocated all objects in the specified namespace.
+ The namespace's r_debug structure is consistent and may be
+ inspected, and all objects in the namespace's link-map are
+ guaranteed to have been relocated.
+
+ unmap_start:
+ The linker is about to remove objects from the specified
+ namespace. The namespace's r_debug structure is not guaranteed to
+ be consistent until a corresponding unmap_complete is fired.
+
+ unmap_complete:
+ The linker has finished removing objects into the specified
+ namespace. The namespace's r_debug structure is consistent and
+ may be inspected.
diff --git a/libc/elf/rtld.c b/libc/elf/rtld.c
index 123aa48e4..f77bc7ce1 100644
--- a/libc/elf/rtld.c
+++ b/libc/elf/rtld.c
@@ -40,6 +40,7 @@
#include <dl-osinfo.h>
#include <dl-procinfo.h>
#include <tls.h>
+#include <stap-probe.h>
#include <stackinfo.h>
#include <assert.h>
@@ -133,8 +134,10 @@ struct rtld_global _rtld_global =
._dl_nns = 1,
._dl_ns =
{
+#ifdef _LIBC_REENTRANT
[LM_ID_BASE] = { ._ns_unique_sym_table
= { .lock = _RTLD_LOCK_RECURSIVE_INITIALIZER } }
+#endif
}
};
/* If we would use strong_alias here the compiler would see a
@@ -1684,6 +1687,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
/* We start adding objects. */
r->r_state = RT_ADD;
_dl_debug_state ();
+ LIBC_PROBE (init_start, 2, LM_ID_BASE, r);
/* Auditing checkpoint: we are ready to signal that the initial map
is being constructed. */
@@ -2403,6 +2407,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
r = _dl_debug_initialize (0, LM_ID_BASE);
r->r_state = RT_CONSISTENT;
_dl_debug_state ();
+ LIBC_PROBE (init_complete, 2, LM_ID_BASE, r);
#ifndef MAP_COPY
/* We must munmap() the cache file. */
diff --git a/libc/elf/tls-macros.h b/libc/elf/tls-macros.h
index e753d5cca..e25e33b0f 100644
--- a/libc/elf/tls-macros.h
+++ b/libc/elf/tls-macros.h
@@ -19,743 +19,7 @@
#include_next <tls-macros.h>
/* XXX Each architecture must have its own asm for now. */
-#ifdef __i386__
-# define TLS_LE(x) \
- ({ int *__l; \
- asm ("movl %%gs:0,%0\n\t" \
- "subl $" #x "@tpoff,%0" \
- : "=r" (__l)); \
- __l; })
-
-# ifdef PIC
-# define TLS_IE(x) \
- ({ int *__l; \
- asm ("movl %%gs:0,%0\n\t" \
- "subl " #x "@gottpoff(%%ebx),%0" \
- : "=r" (__l)); \
- __l; })
-# else
-# define TLS_IE(x) \
- ({ int *__l, __b; \
- asm ("call 1f\n\t" \
- ".subsection 1\n" \
- "1:\tmovl (%%esp), %%ebx\n\t" \
- "ret\n\t" \
- ".previous\n\t" \
- "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \
- "movl %%gs:0,%0\n\t" \
- "subl " #x "@gottpoff(%%ebx),%0" \
- : "=r" (__l), "=&b" (__b)); \
- __l; })
-# endif
-
-# ifdef PIC
-# define TLS_LD(x) \
- ({ int *__l, __c, __d; \
- asm ("leal " #x "@tlsldm(%%ebx),%%eax\n\t" \
- "call ___tls_get_addr@plt\n\t" \
- "leal " #x "@dtpoff(%%eax), %%eax" \
- : "=a" (__l), "=&c" (__c), "=&d" (__d)); \
- __l; })
-# else
-# define TLS_LD(x) \
- ({ int *__l, __b, __c, __d; \
- asm ("call 1f\n\t" \
- ".subsection 1\n" \
- "1:\tmovl (%%esp), %%ebx\n\t" \
- "ret\n\t" \
- ".previous\n\t" \
- "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \
- "leal " #x "@tlsldm(%%ebx),%%eax\n\t" \
- "call ___tls_get_addr@plt\n\t" \
- "leal " #x "@dtpoff(%%eax), %%eax" \
- : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d)); \
- __l; })
-# endif
-
-# ifdef PIC
-# define TLS_GD(x) \
- ({ int *__l, __c, __d; \
- asm ("leal " #x "@tlsgd(%%ebx),%%eax\n\t" \
- "call ___tls_get_addr@plt\n\t" \
- "nop" \
- : "=a" (__l), "=&c" (__c), "=&d" (__d)); \
- __l; })
-# else
-# define TLS_GD(x) \
- ({ int *__l, __b, __c, __d; \
- asm ("call 1f\n\t" \
- ".subsection 1\n" \
- "1:\tmovl (%%esp), %%ebx\n\t" \
- "ret\n\t" \
- ".previous\n\t" \
- "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \
- "leal " #x "@tlsgd(%%ebx),%%eax\n\t" \
- "call ___tls_get_addr@plt\n\t" \
- "nop" \
- : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d)); \
- __l; })
-# endif
-
-#elif defined __x86_64__
-
-# define TLS_LE(x) \
- ({ int *__l; \
- asm ("mov %%fs:0,%0\n\t" \
- "lea " #x "@tpoff(%0), %0" \
- : "=r" (__l)); \
- __l; })
-
-# define TLS_IE(x) \
- ({ int *__l; \
- asm ("mov %%fs:0,%0\n\t" \
- "add " #x "@gottpoff(%%rip),%0" \
- : "=r" (__l)); \
- __l; })
-
-# define TLS_LD(x) \
- ({ int *__l, __c, __d; \
- asm ("leaq " #x "@tlsld(%%rip),%%rdi\n\t" \
- "call __tls_get_addr@plt\n\t" \
- "leaq " #x "@dtpoff(%%rax), %%rax" \
- : "=a" (__l), "=&c" (__c), "=&d" (__d) \
- : : "rdi", "rsi", "r8", "r9", "r10", "r11"); \
- __l; })
-
-# ifdef __ILP32__
-# define TLS_GD_PREFIX
-# else
-# define TLS_GD_PREFIX ".byte 0x66\n\t"
-# endif
-
-# define TLS_GD(x) \
- ({ int *__l, __c, __d; \
- asm (TLS_GD_PREFIX \
- "leaq " #x "@tlsgd(%%rip),%%rdi\n\t" \
- ".word 0x6666\n\t" \
- "rex64\n\t" \
- "call __tls_get_addr@plt" \
- : "=a" (__l), "=&c" (__c), "=&d" (__d) \
- : : "rdi", "rsi", "r8", "r9", "r10", "r11"); \
- __l; })
-
-#elif defined __sh__
-
-# define TLS_LE(x) \
- ({ int *__l; void *__tp; \
- asm ("stc gbr,%1\n\t" \
- "mov.l 1f,%0\n\t" \
- "bra 2f\n\t" \
- " add %1,%0\n\t" \
- ".align 2\n\t" \
- "1: .long " #x "@tpoff\n\t" \
- "2:" \
- : "=r" (__l), "=r" (__tp)); \
- __l; })
-
-# ifdef PIC
-# define TLS_IE(x) \
- ({ int *__l; void *__tp; \
- register void *__gp __asm__("r12"); \
- asm ("mov.l 1f,r0\n\t" \
- "stc gbr,%1\n\t" \
- "mov.l @(r0,r12),%0\n\t" \
- "bra 2f\n\t" \
- " add %1,%0\n\t" \
- ".align 2\n\t" \
- "1: .long " #x "@gottpoff\n\t" \
- "2:" \
- : "=r" (__l), "=r" (__tp) : "r" (__gp) : "r0"); \
- __l; })
-# else
-# define TLS_IE(x) \
- ({ int *__l; void *__tp; \
- asm ("mov.l r12,@-r15\n\t" \
- "mova 0f,r0\n\t" \
- "mov.l 0f,r12\n\t" \
- "add r0,r12\n\t" \
- "mov.l 1f,r0\n\t" \
- "stc gbr,%1\n\t" \
- "mov.l @(r0,r12),%0\n\t" \
- "bra 2f\n\t" \
- " add %1,%0\n\t" \
- ".align 2\n\t" \
- "1: .long " #x "@gottpoff\n\t" \
- "0: .long _GLOBAL_OFFSET_TABLE_\n\t" \
- "2: mov.l @r15+,r12" \
- : "=r" (__l), "=r" (__tp) : : "r0"); \
- __l; })
-#endif
-
-# ifdef PIC
-# define TLS_LD(x) \
- ({ int *__l; \
- register void *__gp __asm__("r12"); \
- asm ("mov.l 1f,r4\n\t" \
- "mova 2f,r0\n\t" \
- "mov.l 2f,r1\n\t" \
- "add r0,r1\n\t" \
- "jsr @r1\n\t" \
- " add r12,r4\n\t" \
- "bra 4f\n\t" \
- " nop\n\t" \
- ".align 2\n\t" \
- "1: .long " #x "@tlsldm\n\t" \
- "2: .long __tls_get_addr@plt\n\t" \
- "4: mov.l 3f,%0\n\t" \
- "bra 5f\n\t" \
- " add r0,%0\n\t" \
- ".align 2\n\t" \
- "3: .long " #x "@dtpoff\n\t" \
- "5:" \
- : "=r" (__l) : "r" (__gp) : "r0", "r1", "r2", "r3", "r4", "r5", \
- "r6", "r7", "pr", "t"); \
- __l; })
-# else
-# define TLS_LD(x) \
- ({ int *__l; \
- asm ("mov.l r12,@-r15\n\t" \
- "mova 0f,r0\n\t" \
- "mov.l 0f,r12\n\t" \
- "add r0,r12\n\t" \
- "mov.l 1f,r4\n\t" \
- "mova 2f,r0\n\t" \
- "mov.l 2f,r1\n\t" \
- "add r0,r1\n\t" \
- "jsr @r1\n\t" \
- " add r12,r4\n\t" \
- "bra 4f\n\t" \
- " nop\n\t" \
- ".align 2\n\t" \
- "1: .long " #x "@tlsldm\n\t" \
- "2: .long __tls_get_addr@plt\n\t" \
- "0: .long _GLOBAL_OFFSET_TABLE_\n\t" \
- "4: mov.l 3f,%0\n\t" \
- "bra 5f\n\t" \
- " add r0,%0\n\t" \
- ".align 2\n\t" \
- "3: .long " #x "@dtpoff\n\t" \
- "5: mov.l @r15+,r12" \
- : "=r" (__l) : : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
- "pr", "t"); \
- __l; })
-#endif
-
-# ifdef PIC
-# define TLS_GD(x) \
- ({ int *__l; \
- register void *__gp __asm__("r12"); \
- asm ("mov.l 1f,r4\n\t" \
- "mova 2f,r0\n\t" \
- "mov.l 2f,r1\n\t" \
- "add r0,r1\n\t" \
- "jsr @r1\n\t" \
- " add r12,r4\n\t" \
- "bra 3f\n\t" \
- " mov r0,%0\n\t" \
- ".align 2\n\t" \
- "1: .long " #x "@tlsgd\n\t" \
- "2: .long __tls_get_addr@plt\n\t" \
- "3:" \
- : "=r" (__l) : "r" (__gp) : "r0", "r1", "r2", "r3", "r4", "r5", \
- "r6", "r7", "pr", "t"); \
- __l; })
-# else
-# define TLS_GD(x) \
- ({ int *__l; \
- asm ("mov.l r12,@-r15\n\t" \
- "mova 0f,r0\n\t" \
- "mov.l 0f,r12\n\t" \
- "add r0,r12\n\t" \
- "mov.l 1f,r4\n\t" \
- "mova 2f,r0\n\t" \
- "mov.l 2f,r1\n\t" \
- "add r0,r1\n\t" \
- "jsr @r1\n\t" \
- " add r12,r4\n\t" \
- "bra 3f\n\t" \
- " mov r0,%0\n\t" \
- ".align 2\n\t" \
- "1: .long " #x "@tlsgd\n\t" \
- "2: .long __tls_get_addr@plt\n\t" \
- "0: .long _GLOBAL_OFFSET_TABLE_\n\t" \
- "3: mov.l @r15+,r12" \
- : "=r" (__l) : : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
- "pr", "t"); \
- __l; })
-#endif
-
-#elif defined __sparc__ && !defined __arch64__
-
-# define TLS_LE(x) \
- ({ int *__l; \
- asm ("sethi %%tle_hix22(" #x "), %0" : "=r" (__l)); \
- asm ("xor %1, %%tle_lox10(" #x "), %0" : "=r" (__l) : "r" (__l)); \
- asm ("add %%g7, %1, %0" : "=r" (__l) : "r" (__l)); \
- __l; })
-
-# ifdef __PIC__
-# define TLS_LOAD_PIC \
- ({ register long pc __asm__ ("%o7"); \
- long got; \
- asm ("sethi %%hi(_GLOBAL_OFFSET_TABLE_-4), %1\n\t" \
- "call .+8\n\t" \
- "add %1, %%lo(_GLOBAL_OFFSET_TABLE_+4), %1\n\t" \
- "add %1, %0, %1\n\t" \
- : "=r" (pc), "=r" (got)); \
- got; })
-# else
-# define TLS_LOAD_PIC \
- ({ long got; \
- asm (".hidden _GLOBAL_OFFSET_TABLE_\n\t" \
- "sethi %%hi(_GLOBAL_OFFSET_TABLE_), %0\n\t" \
- "or %0, %%lo(_GLOBAL_OFFSET_TABLE_), %0" \
- : "=r" (got)); \
- got; })
-# endif
-
-# define TLS_IE(x) \
- ({ int *__l; \
- asm ("sethi %%tie_hi22(" #x "), %0" : "=r" (__l)); \
- asm ("add %1, %%tie_lo10(" #x "), %0" : "=r" (__l) : "r" (__l)); \
- asm ("ld [%1 + %2], %0, %%tie_ld(" #x ")" \
- : "=r" (__l) : "r" (TLS_LOAD_PIC), "r" (__l)); \
- asm ("add %%g7, %1, %0, %%tie_add(" #x ")" : "=r" (__l) : "r" (__l)); \
- __l; })
-
-# define TLS_LD(x) \
- ({ int *__l; register void *__o0 asm ("%o0"); \
- long __o; \
- asm ("sethi %%tldm_hi22(" #x "), %0" : "=r" (__l)); \
- asm ("add %1, %%tldm_lo10(" #x "), %0" : "=r" (__l) : "r" (__l)); \
- asm ("add %1, %2, %0, %%tldm_add(" #x ")" \
- : "=r" (__o0) : "r" (TLS_LOAD_PIC), "r" (__l)); \
- asm ("call __tls_get_addr, %%tgd_call(" #x ")\n\t" \
- " nop" \
- : "=r" (__o0) : "0" (__o0) \
- : "g1", "g2", "g3", "g4", "g5", "g6", "o1", "o2", "o3", "o4", \
- "o5", "o7", "cc"); \
- asm ("sethi %%tldo_hix22(" #x "), %0" : "=r" (__o)); \
- asm ("xor %1, %%tldo_lox10(" #x "), %0" : "=r" (__o) : "r" (__o)); \
- asm ("add %1, %2, %0, %%tldo_add(" #x ")" : "=r" (__l) \
- : "r" (__o0), "r" (__o)); \
- __l; })
-
-# define TLS_GD(x) \
- ({ int *__l; register void *__o0 asm ("%o0"); \
- asm ("sethi %%tgd_hi22(" #x "), %0" : "=r" (__l)); \
- asm ("add %1, %%tgd_lo10(" #x "), %0" : "=r" (__l) : "r" (__l)); \
- asm ("add %1, %2, %0, %%tgd_add(" #x ")" \
- : "=r" (__o0) : "r" (TLS_LOAD_PIC), "r" (__l)); \
- asm ("call __tls_get_addr, %%tgd_call(" #x ")\n\t" \
- " nop" \
- : "=r" (__o0) : "0" (__o0) \
- : "g1", "g2", "g3", "g4", "g5", "g6", "o1", "o2", "o3", "o4", \
- "o5", "o7", "cc"); \
- __o0; })
-
-#elif defined __sparc__ && defined __arch64__
-
-# define TLS_LE(x) \
- ({ int *__l; \
- asm ("sethi %%tle_hix22(" #x "), %0" : "=r" (__l)); \
- asm ("xor %1, %%tle_lox10(" #x "), %0" : "=r" (__l) : "r" (__l)); \
- asm ("add %%g7, %1, %0" : "=r" (__l) : "r" (__l)); \
- __l; })
-
-# ifdef __PIC__
-# define TLS_LOAD_PIC \
- ({ long pc, got; \
- asm ("sethi %%hi(_GLOBAL_OFFSET_TABLE_-4), %1\n\t" \
- "rd %%pc, %0\n\t" \
- "add %1, %%lo(_GLOBAL_OFFSET_TABLE_+4), %1\n\t" \
- "add %1, %0, %1\n\t" \
- : "=r" (pc), "=r" (got)); \
- got; })
-# else
-# define TLS_LOAD_PIC \
- ({ long got; \
- asm (".hidden _GLOBAL_OFFSET_TABLE_\n\t" \
- "sethi %%hi(_GLOBAL_OFFSET_TABLE_), %0\n\t" \
- "or %0, %%lo(_GLOBAL_OFFSET_TABLE_), %0" \
- : "=r" (got)); \
- got; })
-# endif
-
-# define TLS_IE(x) \
- ({ int *__l; \
- asm ("sethi %%tie_hi22(" #x "), %0" : "=r" (__l)); \
- asm ("add %1, %%tie_lo10(" #x "), %0" : "=r" (__l) : "r" (__l)); \
- asm ("ldx [%1 + %2], %0, %%tie_ldx(" #x ")" \
- : "=r" (__l) : "r" (TLS_LOAD_PIC), "r" (__l)); \
- asm ("add %%g7, %1, %0, %%tie_add(" #x ")" : "=r" (__l) : "r" (__l)); \
- __l; })
-
-# define TLS_LD(x) \
- ({ int *__l; register void *__o0 asm ("%o0"); \
- long __o; \
- asm ("sethi %%tldm_hi22(" #x "), %0" : "=r" (__l)); \
- asm ("add %1, %%tldm_lo10(" #x "), %0" : "=r" (__l) : "r" (__l)); \
- asm ("add %1, %2, %0, %%tldm_add(" #x ")" \
- : "=r" (__o0) : "r" (TLS_LOAD_PIC), "r" (__l)); \
- asm ("call __tls_get_addr, %%tgd_call(" #x ")\n\t" \
- " nop" \
- : "=r" (__o0) : "0" (__o0) \
- : "g1", "g2", "g3", "g4", "g5", "g6", "o1", "o2", "o3", "o4", \
- "o5", "o7", "cc"); \
- asm ("sethi %%tldo_hix22(" #x "), %0" : "=r" (__o)); \
- asm ("xor %1, %%tldo_lox10(" #x "), %0" : "=r" (__o) : "r" (__o)); \
- asm ("add %1, %2, %0, %%tldo_add(" #x ")" : "=r" (__l) \
- : "r" (__o0), "r" (__o)); \
- __l; })
-
-# define TLS_GD(x) \
- ({ int *__l; register void *__o0 asm ("%o0"); \
- asm ("sethi %%tgd_hi22(" #x "), %0" : "=r" (__l)); \
- asm ("add %1, %%tgd_lo10(" #x "), %0" : "=r" (__l) : "r" (__l)); \
- asm ("add %1, %2, %0, %%tgd_add(" #x ")" \
- : "=r" (__o0) : "r" (TLS_LOAD_PIC), "r" (__l)); \
- asm ("call __tls_get_addr, %%tgd_call(" #x ")\n\t" \
- " nop" \
- : "=r" (__o0) : "0" (__o0) \
- : "g1", "g2", "g3", "g4", "g5", "g6", "o1", "o2", "o3", "o4", \
- "o5", "o7", "cc"); \
- __o0; })
-
-#elif defined __s390x__
-
-# define TLS_LE(x) \
- ({ unsigned long __offset; \
- asm ("bras %0,1f\n" \
- "0:\t.quad " #x "@ntpoff\n" \
- "1:\tlg %0,0(%0)" \
- : "=a" (__offset) : : "cc" ); \
- (int *) (__builtin_thread_pointer() + __offset); })
-
-# ifdef PIC
-# define TLS_IE(x) \
- ({ unsigned long __offset; \
- asm ("bras %0,1f\n" \
- "0:\t.quad " #x "@gotntpoff\n" \
- "1:\tlg %0,0(%0)\n\t" \
- "lg %0,0(%0,%%r12):tls_load:" #x \
- : "=&a" (__offset) : : "cc" ); \
- (int *) (__builtin_thread_pointer() + __offset); })
-# else
-# define TLS_IE(x) \
- ({ unsigned long __offset; \
- asm ("bras %0,1f\n" \
- "0:\t.quad " #x "@indntpoff\n" \
- "1:\t lg %0,0(%0)\n\t" \
- "lg %0,0(%0):tls_load:" #x \
- : "=&a" (__offset) : : "cc" ); \
- (int *) (__builtin_thread_pointer() + __offset); })
-# endif
-
-# ifdef PIC
-# define TLS_LD(x) \
- ({ unsigned long __offset, __save12; \
- asm ("bras %0,1f\n" \
- "0:\t.quad " #x "@tlsldm\n\t" \
- ".quad " #x "@dtpoff\n" \
- "1:\tlgr %1,%%r12\n\t" \
- "larl %%r12,_GLOBAL_OFFSET_TABLE_\n\t" \
- "lg %%r2,0(%0)\n\t" \
- "brasl %%r14,__tls_get_offset@plt:tls_ldcall:" #x "\n\t" \
- "lg %0,8(%0)\n\t" \
- "algr %0,%%r2\n\t" \
- "lgr %%r12,%1" \
- : "=&a" (__offset), "=&a" (__save12) \
- : : "cc", "0", "1", "2", "3", "4", "5", "14" ); \
- (int *) (__builtin_thread_pointer() + __offset); })
-# else
-# define TLS_LD(x) \
- ({ unsigned long __offset; \
- asm ("bras %0,1f\n" \
- "0:\t.quad " #x "@tlsldm\n\t" \
- ".quad " #x "@dtpoff\n" \
- "1:\tlarl %%r12,_GLOBAL_OFFSET_TABLE_\n\t" \
- "lg %%r2,0(%0)\n\t" \
- "brasl %%r14,__tls_get_offset@plt:tls_ldcall:" #x "\n\t" \
- "lg %0,8(%0)\n\t" \
- "algr %0,%%r2" \
- : "=&a" (__offset) \
- : : "cc", "0", "1", "2", "3", "4", "5", "12", "14" ); \
- (int *) (__builtin_thread_pointer() + __offset); })
-# endif
-
-# ifdef PIC
-# define TLS_GD(x) \
- ({ unsigned long __offset, __save12; \
- asm ("bras %0,1f\n" \
- "0:\t.quad " #x "@tlsgd\n" \
- "1:\tlgr %1,%%r12\n\t" \
- "larl %%r12,_GLOBAL_OFFSET_TABLE_\n\t" \
- "lg %%r2,0(%0)\n\t" \
- "brasl %%r14,__tls_get_offset@plt:tls_gdcall:" #x "\n\t" \
- "lgr %0,%%r2\n\t" \
- "lgr %%r12,%1" \
- : "=&a" (__offset), "=&a" (__save12) \
- : : "cc", "0", "1", "2", "3", "4", "5", "14" ); \
- (int *) (__builtin_thread_pointer() + __offset); })
-# else
-# define TLS_GD(x) \
- ({ unsigned long __offset; \
- asm ("bras %0,1f\n" \
- "0:\t.quad " #x "@tlsgd\n" \
- "1:\tlarl %%r12,_GLOBAL_OFFSET_TABLE_\n\t" \
- "lg %%r2,0(%0)\n\t" \
- "brasl %%r14,__tls_get_offset@plt:tls_gdcall:" #x "\n\t" \
- "lgr %0,%%r2" \
- : "=&a" (__offset) \
- : : "cc", "0", "1", "2", "3", "4", "5", "12", "14" ); \
- (int *) (__builtin_thread_pointer() + __offset); })
-# endif
-
-#elif defined __s390__
-
-# define TLS_LE(x) \
- ({ unsigned long __offset; \
- asm ("bras %0,1f\n" \
- "0:\t.long " #x "@ntpoff\n" \
- "1:\tl %0,0(%0)" \
- : "=a" (__offset) : : "cc" ); \
- (int *) (__builtin_thread_pointer() + __offset); })
-
-# ifdef PIC
-# define TLS_IE(x) \
- ({ unsigned long __offset; \
- asm ("bras %0,1f\n" \
- "0:\t.long " #x "@gotntpoff\n" \
- "1:\tl %0,0(%0)\n\t" \
- "l %0,0(%0,%%r12):tls_load:" #x \
- : "=&a" (__offset) : : "cc" ); \
- (int *) (__builtin_thread_pointer() + __offset); })
-# else
-# define TLS_IE(x) \
- ({ unsigned long __offset; \
- asm ("bras %0,1f\n" \
- "0:\t.long " #x "@indntpoff\n" \
- "1:\t l %0,0(%0)\n\t" \
- "l %0,0(%0):tls_load:" #x \
- : "=&a" (__offset) : : "cc" ); \
- (int *) (__builtin_thread_pointer() + __offset); })
-# endif
-
-# ifdef PIC
-# define TLS_LD(x) \
- ({ unsigned long __offset, __save12; \
- asm ("bras %0,1f\n" \
- "0:\t.long _GLOBAL_OFFSET_TABLE_-0b\n\t" \
- ".long __tls_get_offset@plt-0b\n\t" \
- ".long " #x "@tlsldm\n\t" \
- ".long " #x "@dtpoff\n" \
- "1:\tlr %1,%%r12\n\t" \
- "l %%r12,0(%0)\n\t" \
- "la %%r12,0(%%r12,%0)\n\t" \
- "l %%r1,4(%0)\n\t" \
- "l %%r2,8(%0)\n\t" \
- "bas %%r14,0(%%r1,%0):tls_ldcall:" #x "\n\t" \
- "l %0,12(%0)\n\t" \
- "alr %0,%%r2\n\t" \
- "lr %%r12,%1" \
- : "=&a" (__offset), "=&a" (__save12) \
- : : "cc", "0", "1", "2", "3", "4", "5" ); \
- (int *) (__builtin_thread_pointer() + __offset); })
-# else
-# define TLS_LD(x) \
- ({ unsigned long __offset; \
- asm ("bras %0,1f\n" \
- "0:\t.long _GLOBAL_OFFSET_TABLE_\n\t" \
- ".long __tls_get_offset@plt\n\t" \
- ".long " #x "@tlsldm\n\t" \
- ".long " #x "@dtpoff\n" \
- "1:\tl %%r12,0(%0)\n\t" \
- "l %%r1,4(%0)\n\t" \
- "l %%r2,8(%0)\n\t" \
- "bas %%r14,0(%%r1):tls_ldcall:" #x "\n\t" \
- "l %0,12(%0)\n\t" \
- "alr %0,%%r2" \
- : "=&a" (__offset) : : "cc", "0", "1", "2", "3", "4", "5", "12" ); \
- (int *) (__builtin_thread_pointer() + __offset); })
-# endif
-
-# ifdef PIC
-# define TLS_GD(x) \
- ({ unsigned long __offset, __save12; \
- asm ("bras %0,1f\n" \
- "0:\t.long _GLOBAL_OFFSET_TABLE_-0b\n\t" \
- ".long __tls_get_offset@plt-0b\n\t" \
- ".long " #x "@tlsgd\n" \
- "1:\tlr %1,%%r12\n\t" \
- "l %%r12,0(%0)\n\t" \
- "la %%r12,0(%%r12,%0)\n\t" \
- "l %%r1,4(%0)\n\t" \
- "l %%r2,8(%0)\n\t" \
- "bas %%r14,0(%%r1,%0):tls_gdcall:" #x "\n\t" \
- "lr %0,%%r2\n\t" \
- "lr %%r12,%1" \
- : "=&a" (__offset), "=&a" (__save12) \
- : : "cc", "0", "1", "2", "3", "4", "5" ); \
- (int *) (__builtin_thread_pointer() + __offset); })
-# else
-# define TLS_GD(x) \
- ({ unsigned long __offset; \
- asm ("bras %0,1f\n" \
- "0:\t.long _GLOBAL_OFFSET_TABLE_\n\t" \
- ".long __tls_get_offset@plt\n\t" \
- ".long " #x "@tlsgd\n" \
- "1:\tl %%r12,0(%0)\n\t" \
- "l %%r1,4(%0)\n\t" \
- "l %%r2,8(%0)\n\t" \
- "bas %%r14,0(%%r1):tls_gdcall:" #x "\n\t" \
- "lr %0,%%r2" \
- : "=&a" (__offset) : : "cc", "0", "1", "2", "3", "4", "5", "12" ); \
- (int *) (__builtin_thread_pointer() + __offset); })
-# endif
-
-#elif defined __powerpc__
-
-# define __TLS_CALL_CLOBBERS \
- "0", "4", "5", "6", "7", "8", "9", "10", "11", "12", \
- "lr", "ctr", "cr0", "cr1", "cr5", "cr6", "cr7"
-
-# ifndef __powerpc64__
-
-# include "config.h"
-
-/* PowerPC32 Local Exec TLS access. */
-# define TLS_LE(x) \
- ({ int *__result; \
- asm ("addi %0,2," #x "@tprel" \
- : "=r" (__result)); \
- __result; })
-
-/* PowerPC32 Initial Exec TLS access. */
-# ifdef HAVE_ASM_PPC_REL16
-# define TLS_IE(x) \
- ({ int *__result; \
- asm ("bcl 20,31,1f\n1:\t" \
- "mflr %0\n\t" \
- "addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t" \
- "addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n\t" \
- "lwz %0," #x "@got@tprel(%0)\n\t" \
- "add %0,%0," #x "@tls" \
- : "=b" (__result) : \
- : "lr"); \
- __result; })
-# else
-# define TLS_IE(x) \
- ({ int *__result; \
- asm ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t" \
- "mflr %0\n\t" \
- "lwz %0," #x "@got@tprel(%0)\n\t" \
- "add %0,%0," #x "@tls" \
- : "=b" (__result) : \
- : "lr"); \
- __result; })
-# endif
-
-/* PowerPC32 Local Dynamic TLS access. */
-# ifdef HAVE_ASM_PPC_REL16
-# define TLS_LD(x) \
- ({ int *__result; \
- asm ("bcl 20,31,1f\n1:\t" \
- "mflr 3\n\t" \
- "addis 3,3,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t" \
- "addi 3,3,_GLOBAL_OFFSET_TABLE_-1b@l\n\t" \
- "addi 3,3," #x "@got@tlsld\n\t" \
- "bl __tls_get_addr@plt\n\t" \
- "addi %0,3," #x "@dtprel" \
- : "=r" (__result) : \
- : "3", __TLS_CALL_CLOBBERS); \
- __result; })
-# else
-# define TLS_LD(x) \
- ({ int *__result; \
- asm ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t" \
- "mflr 3\n\t" \
- "addi 3,3," #x "@got@tlsld\n\t" \
- "bl __tls_get_addr@plt\n\t" \
- "addi %0,3," #x "@dtprel" \
- : "=r" (__result) : \
- : "3", __TLS_CALL_CLOBBERS); \
- __result; })
-# endif
-
-/* PowerPC32 General Dynamic TLS access. */
-# ifdef HAVE_ASM_PPC_REL16
-# define TLS_GD(x) \
- ({ register int *__result __asm__ ("r3"); \
- asm ("bcl 20,31,1f\n1:\t" \
- "mflr 3\n\t" \
- "addis 3,3,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t" \
- "addi 3,3,_GLOBAL_OFFSET_TABLE_-1b@l\n\t" \
- "addi 3,3," #x "@got@tlsgd\n\t" \
- "bl __tls_get_addr@plt" \
- : "=r" (__result) : \
- : __TLS_CALL_CLOBBERS); \
- __result; })
-# else
-# define TLS_GD(x) \
- ({ register int *__result __asm__ ("r3"); \
- asm ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t" \
- "mflr 3\n\t" \
- "addi 3,3," #x "@got@tlsgd\n\t" \
- "bl __tls_get_addr@plt" \
- : "=r" (__result) : \
- : __TLS_CALL_CLOBBERS); \
- __result; })
-# endif
-
-# else
-
-/* PowerPC64 Local Exec TLS access. */
-# define TLS_LE(x) \
- ({ int * __result; \
- asm ("addis %0,13," #x "@tprel@ha\n\t" \
- "addi %0,%0," #x "@tprel@l" \
- : "=b" (__result) ); \
- __result; \
- })
-/* PowerPC64 Initial Exec TLS access. */
-# define TLS_IE(x) \
- ({ int * __result; \
- asm ("ld %0," #x "@got@tprel(2)\n\t" \
- "add %0,%0," #x "@tls" \
- : "=r" (__result) ); \
- __result; \
- })
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define __TLS_GET_ADDR ".__tls_get_addr"
-# else
-# define __TLS_GET_ADDR "__tls_get_addr"
-# endif
-/* PowerPC64 Local Dynamic TLS access. */
-# define TLS_LD(x) \
- ({ int * __result; \
- asm ("addi 3,2," #x "@got@tlsld\n\t" \
- "bl " __TLS_GET_ADDR "\n\t" \
- "nop \n\t" \
- "addis %0,3," #x "@dtprel@ha\n\t" \
- "addi %0,%0," #x "@dtprel@l" \
- : "=b" (__result) : \
- : "3", __TLS_CALL_CLOBBERS); \
- __result; \
- })
-/* PowerPC64 General Dynamic TLS access. */
-# define TLS_GD(x) \
- ({ register int *__result __asm__ ("r3"); \
- asm ("addi 3,2," #x "@got@tlsgd\n\t" \
- "bl " __TLS_GET_ADDR "\n\t" \
- "nop " \
- : "=r" (__result) : \
- : __TLS_CALL_CLOBBERS); \
- __result; \
- })
-# endif
-
-#elif !defined TLS_LE || !defined TLS_IE \
+#if !defined TLS_LE || !defined TLS_IE \
|| !defined TLS_LD || !defined TLS_GD
# error "No support for this architecture so far."
#endif
diff --git a/libc/elf/tst-auditmod1.c b/libc/elf/tst-auditmod1.c
index 108d6ded5..227a3b623 100644
--- a/libc/elf/tst-auditmod1.c
+++ b/libc/elf/tst-auditmod1.c
@@ -102,79 +102,10 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
return sym->st_value;
}
-#ifdef __i386__
-# define pltenter la_i86_gnu_pltenter
-# define pltexit la_i86_gnu_pltexit
-# define La_regs La_i86_regs
-# define La_retval La_i86_retval
-# define int_retval lrv_eax
-#elif defined __x86_64__
-# ifndef __ILP32__
-# define pltenter la_x86_64_gnu_pltenter
-# define pltexit la_x86_64_gnu_pltexit
-# define La_regs La_x86_64_regs
-# define La_retval La_x86_64_retval
-# else
-# define pltenter la_x32_gnu_pltenter
-# define pltexit la_x32_gnu_pltexit
-# define La_regs La_x32_regs
-# define La_retval La_x32_retval
-# endif
-# define int_retval lrv_rax
-#elif defined __powerpc__ && __WORDSIZE == 32
-# define pltenter la_ppc32_gnu_pltenter
-# define pltexit la_ppc32_gnu_pltexit
-# define La_regs La_ppc32_regs
-# define La_retval La_ppc32_retval
-# define int_retval lrv_r3
-#elif defined __powerpc__ && __WORDSIZE == 64
-# define pltenter la_ppc64_gnu_pltenter
-# define pltexit la_ppc64_gnu_pltexit
-# define La_regs La_ppc64_regs
-# define La_retval La_ppc64_retval
-# define int_retval lrv_r3
-#elif defined __sh__
-# define pltenter la_sh_gnu_pltenter
-# define pltexit la_sh_gnu_pltexit
-# define La_regs La_sh_regs
-# define La_retval La_sh_retval
-# define int_retval lrv_r0
-#elif defined __alpha__
-# define pltenter la_alpha_gnu_pltenter
-# define pltexit la_alpha_gnu_pltexit
-# define La_regs La_alpha_regs
-# define La_retval La_alpha_retval
-# define int_retval lrv_r0
-#elif defined __s390__ && __WORDSIZE == 32
-# define pltenter la_s390_32_gnu_pltenter
-# define pltexit la_s390_32_gnu_pltexit
-# define La_regs La_s390_32_regs
-# define La_retval La_s390_32_retval
-# define int_retval lrv_r2
-#elif defined __s390__ && __WORDSIZE == 64
-# define pltenter la_s390_64_gnu_pltenter
-# define pltexit la_s390_64_gnu_pltexit
-# define La_regs La_s390_64_regs
-# define La_retval La_s390_64_retval
-# define int_retval lrv_r2
-#elif defined __sparc__ && __WORDSIZE == 32
-# define pltenter la_sparc32_gnu_pltenter
-# define pltexit la_sparc32_gnu_pltexit
-# define La_regs La_sparc32_regs
-# define La_retval La_sparc32_retval
-# define int_retval lrv_reg[0]
-#elif defined __sparc__ && __WORDSIZE == 64
-# define pltenter la_sparc64_gnu_pltenter
-# define pltexit la_sparc64_gnu_pltexit
-# define La_regs La_sparc64_regs
-# define La_retval La_sparc64_retval
-# define int_retval lrv_reg[0]
-#endif
-
#include <tst-audit.h>
#if (!defined (pltenter) || !defined (pltexit) || !defined (La_regs) \
|| !defined (La_retval) || !defined (int_retval))
-# error "architecture specific code needed in sysdeps/CPU/tst-audit.h or here"
+# error "architecture specific code needed in sysdeps/CPU/tst-audit.h"
#endif
diff --git a/libc/elf/tst-auditmod3b.c b/libc/elf/tst-auditmod3b.c
index a9bb0e22c..1a41ca80c 100644
--- a/libc/elf/tst-auditmod3b.c
+++ b/libc/elf/tst-auditmod3b.c
@@ -105,19 +105,6 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
return sym->st_value;
}
-# ifndef __ILP32__
-# define pltenter la_x86_64_gnu_pltenter
-# define pltexit la_x86_64_gnu_pltexit
-# define La_regs La_x86_64_regs
-# define La_retval La_x86_64_retval
-#else
-# define pltenter la_x32_gnu_pltenter
-# define pltexit la_x32_gnu_pltexit
-# define La_regs La_x32_regs
-# define La_retval La_x32_retval
-#endif
-#define int_retval lrv_rax
-
#include <tst-audit.h>
ElfW(Addr)
diff --git a/libc/elf/tst-auditmod4b.c b/libc/elf/tst-auditmod4b.c
index 7778d6a17..80aaedcd3 100644
--- a/libc/elf/tst-auditmod4b.c
+++ b/libc/elf/tst-auditmod4b.c
@@ -94,19 +94,6 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
return sym->st_value;
}
-# ifndef __ILP32__
-# define pltenter la_x86_64_gnu_pltenter
-# define pltexit la_x86_64_gnu_pltexit
-# define La_regs La_x86_64_regs
-# define La_retval La_x86_64_retval
-#else
-# define pltenter la_x32_gnu_pltenter
-# define pltexit la_x32_gnu_pltexit
-# define La_regs La_x32_regs
-# define La_retval La_x32_retval
-#endif
-#define int_retval lrv_rax
-
#include <tst-audit.h>
#ifdef __AVX__
diff --git a/libc/elf/tst-auditmod5b.c b/libc/elf/tst-auditmod5b.c
index 3a4221536..576183d72 100644
--- a/libc/elf/tst-auditmod5b.c
+++ b/libc/elf/tst-auditmod5b.c
@@ -95,19 +95,6 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
return sym->st_value;
}
-# ifndef __ILP32__
-# define pltenter la_x86_64_gnu_pltenter
-# define pltexit la_x86_64_gnu_pltexit
-# define La_regs La_x86_64_regs
-# define La_retval La_x86_64_retval
-#else
-# define pltenter la_x32_gnu_pltenter
-# define pltexit la_x32_gnu_pltexit
-# define La_regs La_x32_regs
-# define La_retval La_x32_retval
-#endif
-#define int_retval lrv_rax
-
#include <tst-audit.h>
ElfW(Addr)
diff --git a/libc/elf/tst-auditmod6b.c b/libc/elf/tst-auditmod6b.c
index a9fe5dcad..b1c155a26 100644
--- a/libc/elf/tst-auditmod6b.c
+++ b/libc/elf/tst-auditmod6b.c
@@ -94,19 +94,6 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
return sym->st_value;
}
-# ifndef __ILP32__
-# define pltenter la_x86_64_gnu_pltenter
-# define pltexit la_x86_64_gnu_pltexit
-# define La_regs La_x86_64_regs
-# define La_retval La_x86_64_retval
-#else
-# define pltenter la_x32_gnu_pltenter
-# define pltexit la_x32_gnu_pltexit
-# define La_regs La_x32_regs
-# define La_retval La_x32_retval
-#endif
-#define int_retval lrv_rax
-
#include <tst-audit.h>
#ifdef __AVX__
diff --git a/libc/elf/tst-auditmod6c.c b/libc/elf/tst-auditmod6c.c
index 9b1063b23..88adb21aa 100644
--- a/libc/elf/tst-auditmod6c.c
+++ b/libc/elf/tst-auditmod6c.c
@@ -94,19 +94,6 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
return sym->st_value;
}
-# ifndef __ILP32__
-# define pltenter la_x86_64_gnu_pltenter
-# define pltexit la_x86_64_gnu_pltexit
-# define La_regs La_x86_64_regs
-# define La_retval La_x86_64_retval
-#else
-# define pltenter la_x32_gnu_pltenter
-# define pltexit la_x32_gnu_pltexit
-# define La_regs La_x32_regs
-# define La_retval La_x32_retval
-#endif
-#define int_retval lrv_rax
-
#include <tst-audit.h>
#ifdef __AVX__
diff --git a/libc/elf/tst-auditmod7b.c b/libc/elf/tst-auditmod7b.c
index 1ae9e7276..68052efe9 100644
--- a/libc/elf/tst-auditmod7b.c
+++ b/libc/elf/tst-auditmod7b.c
@@ -94,19 +94,6 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
return sym->st_value;
}
-#ifndef __ILP32__
-# define pltenter la_x86_64_gnu_pltenter
-# define pltexit la_x86_64_gnu_pltexit
-# define La_regs La_x86_64_regs
-# define La_retval La_x86_64_retval
-#else
-# define pltenter la_x32_gnu_pltenter
-# define pltexit la_x32_gnu_pltexit
-# define La_regs La_x32_regs
-# define La_retval La_x32_retval
-#endif
-#define int_retval lrv_rax
-
#include <tst-audit.h>
#ifdef __AVX__
diff --git a/libc/elf/tst-unique1mod1.c b/libc/elf/tst-unique1mod1.c
index 16de28d25..ccc74fae3 100644
--- a/libc/elf/tst-unique1mod1.c
+++ b/libc/elf/tst-unique1mod1.c
@@ -5,7 +5,7 @@
# define _S(s) #s
asm (".data;"
- S (ASM_GLOBAL_DIRECTIVE) " var\n"
+ ".globl var\n"
".type var, " S (ASM_TYPE_DIRECTIVE_PREFIX) "gnu_unique_object\n"
".size var, 4\n"
"var:.zero 4\n"
diff --git a/libc/elf/tst-unique1mod2.c b/libc/elf/tst-unique1mod2.c
index c07551582..4f1fec008 100644
--- a/libc/elf/tst-unique1mod2.c
+++ b/libc/elf/tst-unique1mod2.c
@@ -5,7 +5,7 @@
# define _S(s) #s
asm (".data;"
- S (ASM_GLOBAL_DIRECTIVE) " var\n"
+ ".globl var\n"
".type var, " S (ASM_TYPE_DIRECTIVE_PREFIX) "gnu_unique_object\n"
".size var, 4\n"
"var:.zero 4\n"
diff --git a/libc/elf/tst-unique2mod1.c b/libc/elf/tst-unique2mod1.c
index 5e4ac4d68..18b14db43 100644
--- a/libc/elf/tst-unique2mod1.c
+++ b/libc/elf/tst-unique2mod1.c
@@ -5,7 +5,7 @@
# define _S(s) #s
asm (".data;"
- S (ASM_GLOBAL_DIRECTIVE) " var\n"
+ ".globl var\n"
".type var, " S (ASM_TYPE_DIRECTIVE_PREFIX) "gnu_unique_object\n"
".size var, 4\n"
"var:.zero 4\n"
diff --git a/libc/elf/tst-unique2mod2.c b/libc/elf/tst-unique2mod2.c
index c07551582..4f1fec008 100644
--- a/libc/elf/tst-unique2mod2.c
+++ b/libc/elf/tst-unique2mod2.c
@@ -5,7 +5,7 @@
# define _S(s) #s
asm (".data;"
- S (ASM_GLOBAL_DIRECTIVE) " var\n"
+ ".globl var\n"
".type var, " S (ASM_TYPE_DIRECTIVE_PREFIX) "gnu_unique_object\n"
".size var, 4\n"
"var:.zero 4\n"