summaryrefslogtreecommitdiff
path: root/crt/rcrt1.c
AgeCommit message (Collapse)AuthorLines
2015-10-15fix visibility mismatch in dynamic linker stage 2 function definitionRich Felker-0/+1
since commits 2907afb8dbd4c1d34825c3c9bd2b41564baca210 and 6fc30c2493fcfedec89e45088bea87766a1e3286, __dls2 is no longer called via symbol lookup, but instead uses relative addressing that needs to be resolved at link time. on some linker versions, and/or if -Bsymbolic-functions is not used, the linker may leave behind a dynamic relocation, which is not suitable for bootstrapping the dynamic linker, if the reference to __dls2 is marked hidden but the definition is not actually hidden. correcting the definition to use hidden visibility fixes the problem. the static-PIE entry point rcrt1 was likewise affected and is also fixed by this patch.
2015-05-26add rcrt1 start file for fully static-linked PIERich Felker-0/+15
static-linked PIE files need startup code to relocate themselves, much like the dynamic linker does. rcrt1.c reuses the code in dlstart.c, stage 1 of the dynamic linker, which in turn reuses crt_arch.h, to achieve static PIE with no new code. only relative relocations are supported. existing toolchains that don't yet support static PIE directly can be repurposed by passing "-shared -Wl,-Bstatic -Wl,-Bsymbolic" instead of "-static -pie" and substituting rcrt1.o in place of crt1.o. all libraries being linked must be built as PIC/PIE; TEXTRELs are not supported at this time.