summaryrefslogtreecommitdiff
path: root/ldso/ldso/powerpc/dl-startup.h
AgeCommit message (Collapse)Author
2021-06-04powerpc: fix PIE/PIC builds with newer gcc/binutils which use secureplt by ↵Yann Sionneau
default This patch fixes segfault of all user space processes (including init, which caused a panic) on recent buildroot powerpc32 builds. The issue has been reported by Romain Naour in this thread: https://mailman.uclibc-ng.org/pipermail/devel/2021-May/002068.html Recent buildroot toolchain enables secure PLT in powerpc gcc. The latter will then supply -msecure-plt to gas invocations by default. Recent buildroot also enables PIE by defaults. For the secure PLT to work in PIC, the r30 register needs to point to the GOT. Old "bss plt" was just a one-instruction-wide PLT slot, pointed-to by a R_PPC_JMP_SLOT relocation, which was written on-the-fly to contain a branch instruction to the correct address. It therefore had to stay writable. New secure PLT only contains read-only code which loads the branch address from the writable GOT. Note: secure PLT without PIC does not need r30 to be set. Because offset between plt stub code and got is known at link-time. In this case the PLT entry looks like: 1009b3e0 <__uClibc_main@plt>: 1009b3e0: 3d 60 10 0e lis r11,4110 1009b3e4: 81 6b 03 74 lwz r11,884(r11) 1009b3e8: 7d 69 03 a6 mtctr r11 1009b3ec: 4e 80 04 20 bctr Whereas secure PLT with PIC - offset between plt and got is unknown at link-time - looks like this: 000af800 <00000000.plt_pic32.__uClibc_main>: af800: 81 7e 03 80 lwz r11,896(r30) af804: 7d 69 03 a6 mtctr r11 af808: 4e 80 04 20 bctr af80c: 60 00 00 00 nop Signed-off-by: Yann Sionneau <yann@sionneau.net>
2012-03-29ldso: mark _start hiddenMike Frysinger
There's no need to export this symbol, so mark them all hidden. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-25ldso: use ELF_xxx()/ElfW() helpersMike Frysinger
They expand into the same code, but using the ELF_xxx()/ElfW() macros makes it much easier to spot similarities between code bases. Acked-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Acked-by: Carmelo Amoroso <carmelo.amoroso@st.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-01-04ldso/ldso/dl-startup.c: make _dl_elf_main static; remove one dead variable.Denis Vlasenko
ldso/ldso/avr32/dl-startup.h: remove superfluous definition of START() macro. ldso/ldso/*/dl-startup.h: fix a typo in comment text data bss dec hex filename - 16752 244 92 17088 42c0 lib/ld-uClibc.so + 16709 240 92 17041 4291 lib/ld-uClibc.so
2008-09-15- commentary typo fixBernhard Reutner-Fischer
2008-07-23- fix asm and volatile keywordsBernhard Reutner-Fischer
2007-01-05Support SecurePLTs for PowerPC. You need a toolchain that supportsJoakim Tjernlund
config option --enable-secureplt. The assembler must also supports R_PPC_REL16* relocations. gcc 4.1.1 and binutils 2.17 is known to do this.
2006-01-17since just about everyone uses return _dl_elf_main for START() now, make it ↵Mike Frysinger
the default
2005-12-15Fix static apps on linux 2.6. Linux clobbers r7 in 2.6, soJoakim Tjernlund
use r3 instead to pass _dl_fini.
2005-04-03Prepare PowerPC some more for standalone exection of ldso.Joakim Tjernlund
Note that every arch that wants to support standalone execution needs to align its stack pointer in crtX since ldso will adjust the stack pointer when adjusting argc and argv in standalone mode.
2005-03-21Prepare for moving ldso FINI handling to libc by passing _dl_fini. This ↵Joakim Tjernlund
should not break ABI. Minor cleanup as well.
2005-03-17General arch cleanup and prepare support for standaloneJoakim Tjernlund
execution of ldso. Added new asm for MIPS to be tested. All arches should retest.
2004-08-18Clean up the _dl_boot code and make it similar to arm and sh.Joakim Tjernlund
2004-08-06Joakim Tjernlund writes:Eric Andersen
This patch makes -fpic work for PCC and optimzes the relcation by moving the cache flushing stuff to JMP relocs only. Actually PPCs ldso can only handle small GOT tables(<=8192 entries)anyhow, so it makes little sense to compile PPC with -fPIC. libuClibc shrunk from 340724 to 330780 bytes with -fpic.
2004-04-20Cope with gcc 3.4's more aggressive persuit of attribute unusedEric Andersen
2004-03-18Joakim Tjernlund writes:Eric Andersen
Hi I just noticed that gcc has an "b"(Address base register) operand that will match all "r" registers but r0. It is a better fix then adding r0 to the clobber list. What do you think?
2004-02-17Seperate out the startup stuff from the non-startup stuff.Eric Andersen
Begin converting some big ugly macros to inline functions instead
2004-02-07Restore the library entry point so it works. It does haveEric Andersen
to be arch specific to work properly.
2004-02-07Split off the stuff that cannot use function into its own file,Eric Andersen
to make it easier to treat it specially while not bothering the rest of the code with the same constraints.
2004-01-27Patch from Joakim Tjernlund to get rid of an annoying warning.Eric Andersen
2004-01-20Paul Mundt writes:Eric Andersen
The current behavior of the powerpc boot1_arch.h seems somewhat broken. Currently room is made on the stack pointer for the link register, but the link register is never actually pushed onto it. glibc bears the following comments: /* Call _dl_start with one parameter pointing at argc */ mr r3,r1 /* (we have to frob the stack pointer a bit to allow room for _dl_start to save the link register). */ followed by the -16 add to r1. Despite the fact that r1 is modified, the link register is never actually pushed onto r1, thus the adjustment is completely superfluous. There's two possible fixes for this, either saving the link register in the way that glibc does, or getting rid of the r1 adjustment. As I'm not sure if saving the link register will actually break the _dl_boot2 callin, both options will probably want to be played with. The following bit of inline assembly in the attached patch builds cleanly for me with gcc 3.3 on darwin, but I'm not able to test it any further beyond that.
2003-02-16Fixup powerpc syscalls to eliminate warnings with gcc-3.2, and fixEric Andersen
some other minor warnings.
2002-08-08Patch from Stefan Allius and Edie C. Dost to add SuperHEric Andersen
shared library support. This also adds some cleaner error handling, which I (Erik) then ported over to x86 and arm. In addition Stefan added the following fixes: - in hash.c was the lvalue handling of global library functions wrong. To fix this I had to change the prototype of _dl_find_hash. (==> TIS and ELF spec. Vers. 1.2) - in ldso.c was the order of the .init sections calls wrong. Before we call the initialization code of a library we have to check that all dependend libraries are already initialized. This can easily made by calling it in the revers loading order. For this I added a previous pointer chain. - in ldso.c the ELF magics wasn't checked fo PPC, MIPS and SH architecture
2001-11-12powerpc/elfinterp.c: Powerpc works now. Major rework; most relocsDavid Schleef
should work now. R_PPC_JMP_SLOT correctly being lazily relocated. hash.h: Added a field in elf_resolve to store a ppc-specific address. boot1.c: Added debugging code. Disabled check that fails on powerpc because the string literal requires a reloc that isn't performed. Added check to ignore d_tag if it is out of bounds, as has been observed with powerpc binaries.
2001-07-12First cut of PowerPC port. It works for hello world, but has lotsDavid Schleef
of debugging information is still there.