arm, arm64: tweak hard-coded load addresses for PIE binaries

They are used when ASLR is not applied.
The need for adjusting is due to rtld direct exec mode puts ld-elf.so.1
at the PIE load address, and this address must not conflict with the
default linker' load address for non-PIE binaries.  Otherwise rtld in
direct mode cannot activate image.  Example of implicit failure is ldd(1)
refusing to run.

Reported by:	kp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37085
This commit is contained in:
Konstantin Belousov 2022-10-22 13:58:43 +03:00
parent deb1e3b719
commit ca18304ea4
2 changed files with 2 additions and 2 deletions

View File

@ -78,7 +78,7 @@ __ElfType(Auxinfo);
#define EF_ARM_EABI_VERSION_UNKNOWN 0
#define EF_ARM_EABI_FREEBSD_MIN 4
#define ET_DYN_LOAD_ADDR 0x500000
#define ET_DYN_LOAD_ADDR 0x01001000
/* Flags passed in AT_HWCAP. */
#define HWCAP_SWP 0x00000001 /* Unsupported, never set. */

View File

@ -86,7 +86,7 @@ __ElfType(Auxinfo);
#endif
#if __ELF_WORD_SIZE == 32
#define ET_DYN_LOAD_ADDR 0x12000
#define ET_DYN_LOAD_ADDR 0x01001000
#else
#define ET_DYN_LOAD_ADDR 0x100000
#endif