Adds --enable-fdpic and --disable-fdpic configure options. This feature is disabled by default, that's why it is not described in the "Optional features" help section (which are enabled by default if possible).
FDPIC ELF objects are identified with e_ident[EI_OSABI] == ELFOSABI_ARM_FDPIC. Co-Authored-By: Mickaël Guêné <mickael.gu...@st.com> Signed-off-by: Christophe Lyon <christophe.l...@st.com> diff --git a/configure b/configure index 4d0e92c..af4c14b 100755 --- a/configure +++ b/configure @@ -451,6 +451,7 @@ jemalloc="no" replication="yes" vxhs="" libxml2="" +fdpic="no" supported_cpu="no" supported_os="no" @@ -1374,6 +1375,10 @@ for opt do ;; --disable-git-update) git_update=no ;; + --disable-fdpic) fdpic="no" + ;; + --enable-fdpic) fdpic="yes" + ;; *) echo "ERROR: unknown option $opt" echo "Try '$0 --help' for more information" @@ -1544,6 +1549,8 @@ Advanced options (experts only): xen pv domain builder --enable-debug-stack-usage track the maximum stack usage of stacks created by qemu_alloc_stack + --disable-fdpic disable loading of FDPIC binary (default) + --enable-fdpic enable loading of FDPIC binary Optional features, enabled with --enable-FEATURE and disabled with --disable-FEATURE, default is enabled if available: @@ -7085,6 +7092,9 @@ fi echo "LDFLAGS+=$ldflags" >> $config_target_mak echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak +if [ "$fdpic" = "yes" ]; then + echo "CONFIG_USE_FDPIC=y" >> $config_target_mak +fi done # for target in $targets diff --git a/include/elf.h b/include/elf.h index c0dc9bb..934dbbd 100644 --- a/include/elf.h +++ b/include/elf.h @@ -1483,6 +1483,7 @@ typedef struct elf64_shdr { #define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ #define ELFOSABI_MODESTO 11 /* Novell Modesto. */ #define ELFOSABI_OPENBSD 12 /* OpenBSD. */ +#define ELFOSABI_ARM_FDPIC 65 /* ARM FDPIC */ #define ELFOSABI_ARM 97 /* ARM */ #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 23e3495..7ba3795 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1658,6 +1658,14 @@ static void zero_bss(abi_ulong elf_bss, abi_ulong last_bss, int prot) } #ifdef CONFIG_USE_FDPIC + +#ifdef TARGET_ARM +static int elf_is_fdpic(struct elfhdr *exec) +{ + return exec->e_ident[EI_OSABI] == ELFOSABI_ARM_FDPIC; +} +#endif + static abi_ulong loader_build_fdpic_loadmap(struct image_info *info, abi_ulong sp) { uint16_t n; -- 2.6.3