summaryrefslogtreecommitdiff
path: root/ldso/ldso/arm/dl-startup.h
AgeCommit message (Collapse)Author
2023-12-12elf: support ELF binaries in noMMUGreg Ungerer
The Linux kernels ELF-FDPIC binfmt program loader can support loading and running conventional ELF format binaries on noMMU kernels when compiled appropriately. That is when they are constant displacement binaries such as generated using the -pie compile option. Add a configure option to allow selecting ELF binary support in noMMU mode configurations on architectures that support this. The main requirement is to generate the ldso run-time loader to perform relocation at load time. These configurations do not support shared libraries, so there is no need to generate a full shared library, only the static version is required. The use of ELF format binaries does mean a slightly simpler toolchain generation (does not require a -uclinux- for some architectures) and does not require an extra tool like elf2flt. This initial support targets M68K, ARM and RISC-V architectures. No kernel changes are required, the required support for this is already in mainline kernels (certainly as of linux-6.6). Note that for the M68K and ARM architectures that the initialized registers and stack layout at process startup is slightly different for the flat format loader and the ELF/ELF-FDPIC loaders. So we need some changes to the startup code (crt1.S) for them. I have not done extensive testing outside of M68K, ARM and RISC-V. I had to make changes to a couple of the dl-startup.h architecture files to get them to build for this noMMU case. I did not dig down too deep on the reasons, but they still seem ok for the MMU case as well. Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
2018-11-01Add support for Thumb-only processors.Christophe Lyon
* ldso/ldso/arm/aeabi_read_tp.S: Add Thumb version. * ldso/ldso/arm/dl-startup.h: Do not force ARM encoding, adjust for Thumb. * ldso/ldso/arm/resolve.S: Force Thumb encoding on Thumb-only processors. * libc/sysdeps/linux/arm/crt1.S: Do not force ARM encoding, adjust for Thumb. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-08-10rtld: Add startup codeChristophe Lyon
Implement _start: compute parameters for __self_reloc, and give control to the user program. * ldso/ldso/arm/dl-startup.h: Implement _start for __FDPIC__. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-08-10rtld: Add FDPIC code for armChristophe Lyon
Add FDPIC dynamic relocations support, similar to what other FDPIC targets do. Lazy binding is implemented in a folllow-up patch. Disable the SEND* macros because they involve relocations to access constant strings that are unsupported by the existing arm version. Define DL_START, START, ARCH_NEEDS_BOOTSTRAP_RELOCS, DL_CHECK_LIB_TYPE similarly to what other FDPIC targets do. Define raise() because _dl_find_hash references __aeabi_uidivmod, which uses __aeabi_idiv0 which in turn references raise. * include/elf.h (R_ARM_FUNCDESC): Define. (R_ARM_FUNCDESC_VALUE): Define. * ldso/include/dl-string.h (SEND_STDERR, SEND_ADDRESS_STDERR) (SEND_NUMBER_STDERR): Define empty for __FDPIC__. * ldso/ldso/arm/dl-inlines.h: New file. * ldso/ldso/arm/dl-startup.h (PERFORM_BOOTSTRAP_RELOC): Fix type of load_addr. Fix handling of R_ARM_RELATIVE, add support for R_ARM_FUNCDESC_VALUE. (DL_START, START): Define for __FDPIC__. (raise): Define. * ldso/ldso/arm/dl-sysdep.h (ARCH_NEEDS_BOOTSTRAP_RELOCS): Define. (DL_CHECK_LIB_TYPE): Define. (elf_machine_type_class): Take into account FDPIC related relocations. (elf_machine_load_address): Support __FDPIC__. (elf_machine_relative): Likewise. * ldso/ldso/arm/elfinterp.c (_dl_linux_resolver): Dummy support for __FDPIC__, implemented in a later patch. (_dl_do_reloc): Fix reloc_adr computation for __FDPIC__, fix handling of local symbols. Fix handling of R_ARM_RELATIVE, add support for R_ARM_FUNCDESC_VALUE, R_ARM_FUNCDESC. * ldso/ldso/arm/resolve.S: Make _dl_linux_resolve hidden. * ldso/ldso/fdpic/dl-inlines.h (htab_delete): Declare. * libc/sysdeps/linux/arm/bits/elf-fdpic.h: New file, similar to bfin's. * libc/sysdeps/linux/arm/crtreloc.c: Likewise. * libc/sysdeps/linux/arm/find_exidx.c (__dl_addr_in_loadaddr) Define. (find_exidx_callback): Support __FDPIC__. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2017-06-21remove editor hints for viWaldemar Brodkorb
2015-04-22arm: Add BX and BXC macrosBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-06-12arm: move check for BX to its own headerYann E. MORIN
As Will noticed, the header this check is currently done in is asm-only, and is not meant to be included from C code. This breaks compilation when compiled for a Thumb2-aware CPU. Move the BX check to its own header, and revert 7a246fd. Reported-by: Will Newton <will.newton@gmail.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Will Newton <will.newton@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
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>
2011-06-11ARM: #include <bits/arm_asm.h> where __USE_BX__ is usedYann E. MORIN
The check for __USE_BX__ will be available in bits/arm_asm.h, so the latter must be included wherever the former is used. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> Cc: Khem Raj <raj.khem@gmail.com> Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Cc: Carmelo AMOROSO <carmelo.amoroso@st.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
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-10-24- tidy up inline:Bernhard Reutner-Fischer
ldso and syscalls are __always_inline (the latter would need more cleanup)
2008-10-03- use c89-style commentsBernhard Reutner-Fischer
Closes issue #5194
2006-01-31s:THUMB_INTERWORK:USE_BX:, thx Khem RajPeter S. Mazinger
2006-01-31John Bowler says: use (!thumb) instead of (arm) since thumb defines armMike Frysinger
2006-01-31John Bowler writes in Bug 385:Mike Frysinger
This patch changes all cases where the ARM assembler mov pc,rx instructions are used to ensure that the thumb/arm interwork change of process more works - in essence mov pc,rx needs to become bx rc. The ldr pc or ldm rx, {pc} instructions are not changed - this is fine on ARM >=v5 but will fail to restore thumb mode on ARM v4T, i.e. this code will not provide support for thumb on ARM v4T. One mov pc is left in resolve.S, this is fixed in a different patch - thumb-resolve.patch The changes are protected by __THUMB_INTERWORK__ - the original mov instruction will work on newer architectures and is required on arch v4 (not v4t) and earlier - those which did not support thumb - so this is safe. See gcc lib1asmfuncs for a more exact test.
2006-01-17since just about everyone uses return _dl_elf_main for START() now, make it ↵Mike Frysinger
the default
2005-06-10Based in part on related code in glibc, this might even be correct.Eric Andersen
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.
2005-03-15Add _dl_boot() prototype.Joakim Tjernlund
2005-01-05fix eriks e-mail addressMike Frysinger
2004-04-20Cope with gcc 3.4's more aggressive persuit of attribute unusedEric Andersen
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-17Kill off an arm specific hack, that fostered three other arch specificEric Andersen
hacks. Just check for the elf magic string one byte at a time....
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.
2002-11-14Add missing quotesEric Andersen
-Erik
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
2002-03-18Let older arm cross compilers workEric Andersen
-Erik
2001-07-03Finish up merging the arm port into the main tree.Eric Andersen