musl/arch
Rich Felker 2907afb8db introduce new symbol-lookup-free rcrt1/dlstart stage chaining
previously, the call into stage 2 was made by looking up the symbol
name "__dls2" (which was chosen short to be easy to look up) from the
dynamic symbol table. this was no problem for the dynamic linker,
since it always exports all its symbols. in the case of the static pie
entry point, however, the dynamic symbol table does not contain the
necessary symbol unless -rdynamic/-E was used when linking. this
linking requirement is a major obstacle both to practical use of
static-pie as a nommu binary format (since it greatly enlarges the
file) and to upstream toolchain support for static-pie (adding -E to
default linking specs is not reasonable).

this patch replaces the runtime symbolic lookup with a link-time
lookup via an inline asm fragment, which reloc.h is responsible for
providing. in this initial commit, the asm is provided only for i386,
and the old lookup code is left in place as a fallback for archs that
have not yet transitioned.

modifying crt_arch.h to pass the stage-2 function pointer as an
argument was considered as an alternative, but such an approach would
not be compatible with fdpic, where it's impossible to compute
function pointers without already having performed relocations. it was
also deemed desirable to keep crt_arch.h as simple/minimal as
possible.

in principle, archs with pc-relative or got-relative addressing of
static variables could instead load the stage-2 function pointer from
a static volatile object. that does not work for fdpic, and is not
safe against reordering on mips-like archs that use got slots even for
static functions, but it's a valid on i386 and many others, and could
provide a reasonable default implementation in the future.
2015-09-17 06:30:55 +00:00
..
aarch64 fix namespace violations in aarch64/bits/termios.h 2015-09-15 14:28:07 -04:00
arm implement arm eabi mem* functions 2015-08-31 06:35:01 +00:00
i386 introduce new symbol-lookup-free rcrt1/dlstart stage chaining 2015-09-17 06:30:55 +00:00
microblaze add .text section directive to all crt_arch.h files missing it 2015-05-22 01:50:05 -04:00
mips socket.h: cleanup/reorder mips and powerpc bits/socket.h 2015-07-21 19:14:58 -04:00
or1k add .text section directive to all crt_arch.h files missing it 2015-05-22 01:50:05 -04:00
powerpc reindent powerpc's bits/termios.h to be consistent with other archs 2015-09-15 14:30:08 -04:00
sh add sh fdpic subarch variants 2015-09-12 03:23:49 +00:00
x32 mitigate performance regression in libc-internal locks on x86_64 2015-08-16 18:15:18 +00:00
x86_64 mitigate performance regression in libc-internal locks on x86_64 2015-08-16 18:15:18 +00:00