From: Christophe Lyon Date: Tue, 20 Mar 2018 09:54:26 +0000 (+0100) Subject: [ARM] Add armelf_linux_fdpiceabi and armelfb_linux_fdpiceabi BFD backends X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=617a5ada88c7d4b6aae201ad5b295f3d2ef07c10;p=binutils-gdb.git [ARM] Add armelf_linux_fdpiceabi and armelfb_linux_fdpiceabi BFD backends Initial definition of these new backends. 2018-04-25 Christophe Lyon Mickaël Guêné bfd/ * config.bfd (arm*-*-linux-*): Add arm_elf32_fdpic_be_vec and arm_elf32_fdpic_le_vec to targ_selvecs. Accept arm*-*-uclinuxfdpiceabi. * configure.ac: Add support for arm_elf32_fdpic_be_vec and arm_elf32_fdpic_le_vec. * configure: Regenerate. * elf32-arm.c (struct elf32_arm_link_hash_table): Add fdpic_p. (elf32_arm_link_hash_table_create): Initialize fdpic_p. (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, TARGET_BIG_SYM) (TARGET_BIG_NAME, elf_match_priority): Define for FDPIC targets. (elf32_arm_fdpic_link_hash_table_create): New. * targets.c (_bfd_target_vector): Add arm_elf32_fdpic_be_vec and arm_elf32_fdpic_le_vec. ld/ * Makefile.am (ALL_EMULATION_SOURCES): Add earmelf_linux_fdpiceabi.c and earmelfb_linux_fdpiceabi.c. (earmelf_linux_fdpiceabi.c, earmelfb_linux_fdpiceabi.c): New rules. * Makefile.in: Regenerate. * configure.tgt (arm*-*-uclinuxfdpiceabi): Handle new target. * emulparams/armelf_linux_fdpiceabi.sh: New. * emulparams/armelfb_linux_fdpiceabi.sh: New. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 91a41ae6112..ed96fcdda5d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,20 @@ +2018-04-25 Christophe Lyon + Mickaël Guêné + + * config.bfd (arm*-*-linux-*): Add arm_elf32_fdpic_be_vec and + arm_elf32_fdpic_le_vec to targ_selvecs. Accept + arm*-*-uclinuxfdpiceabi. + * configure.ac: Add support for arm_elf32_fdpic_be_vec and + arm_elf32_fdpic_le_vec. + * configure: Regenerate. + * elf32-arm.c (struct elf32_arm_link_hash_table): Add fdpic_p. + (elf32_arm_link_hash_table_create): Initialize fdpic_p. + (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, TARGET_BIG_SYM) + (TARGET_BIG_NAME, elf_match_priority): Define for FDPIC targets. + (elf32_arm_fdpic_link_hash_table_create): New. + * targets.c (_bfd_target_vector): Add arm_elf32_fdpic_be_vec and + arm_elf32_fdpic_le_vec. + 2018-04-25 Alan Modra * elf-linux-core.h: Disable gcc-8 string truncation warning. diff --git a/bfd/config.bfd b/bfd/config.bfd index 24f6573af24..0b40636eb56 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -386,9 +386,9 @@ case "${targ}" in ;; arm-*-elf | arm*-*-freebsd* | arm*-*-linux-* | arm*-*-conix* | \ arm*-*-uclinux* | arm-*-kfreebsd*-gnu | \ - arm*-*-eabi* | arm-*-rtems*) + arm*-*-eabi* | arm-*-rtems* | arm*-*-uclinuxfdpiceabi) targ_defvec=arm_elf32_le_vec - targ_selvecs=arm_elf32_be_vec + targ_selvecs="arm_elf32_fdpic_le_vec arm_elf32_be_vec arm_elf32_fdpic_be_vec" ;; arm*-*-vxworks | arm*-*-windiss) targ_defvec=arm_elf32_vxworks_le_vec diff --git a/bfd/configure b/bfd/configure index c23dd195437..ab9e8eef17d 100755 --- a/bfd/configure +++ b/bfd/configure @@ -14347,6 +14347,8 @@ do arc_elf32_le_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;; arm_elf32_be_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;; arm_elf32_le_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;; + arm_elf32_fdpic_be_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;; + arm_elf32_fdpic_le_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;; arm_elf32_nacl_be_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;; arm_elf32_nacl_le_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;; arm_elf32_symbian_be_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;; diff --git a/bfd/configure.ac b/bfd/configure.ac index 7bcbb167a49..ae794618b74 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac @@ -424,6 +424,8 @@ do arc_elf32_le_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;; arm_elf32_be_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;; arm_elf32_le_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;; + arm_elf32_fdpic_be_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;; + arm_elf32_fdpic_le_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;; arm_elf32_nacl_be_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;; arm_elf32_nacl_le_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;; arm_elf32_symbian_be_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;; diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index ce9c2f29bf8..565bb404f2c 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -3228,6 +3228,9 @@ struct elf32_arm_link_hash_table unsigned int bfd_count; unsigned int top_index; asection **input_list; + + /* True if the target system uses FDPIC. */ + int fdpic_p; }; static inline int @@ -3806,6 +3809,7 @@ elf32_arm_link_hash_table_create (bfd *abfd) #endif ret->use_rel = TRUE; ret->obfd = abfd; + ret->fdpic_p = 0; if (!bfd_hash_table_init (&ret->stub_hash_table, stub_hash_newfunc, sizeof (struct elf32_arm_stub_hash_entry))) @@ -19411,6 +19415,46 @@ elf32_arm_nacl_plt_sym_val (bfd_vma i, const asection *plt, #define ELF_COMMONPAGESIZE 0x1000 +/* FDPIC Targets. */ + +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM arm_elf32_fdpic_le_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-littlearm-fdpic" +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM arm_elf32_fdpic_be_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-bigarm-fdpic" +#undef elf_match_priority +#define elf_match_priority 128 + +/* Like elf32_arm_link_hash_table_create -- but overrides + appropriately for FDPIC. */ + +static struct bfd_link_hash_table * +elf32_arm_fdpic_link_hash_table_create (bfd *abfd) +{ + struct bfd_link_hash_table *ret; + + ret = elf32_arm_link_hash_table_create (abfd); + if (ret) + { + struct elf32_arm_link_hash_table *htab = (struct elf32_arm_link_hash_table *) ret; + + htab->fdpic_p = 1; + } + return ret; +} + +#undef elf32_bed +#define elf32_bed elf32_arm_fdpic_bed + +#undef bfd_elf32_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_create elf32_arm_fdpic_link_hash_table_create + +#include "elf32-target.h" +#undef elf_match_priority + /* VxWorks Targets. */ #undef TARGET_LITTLE_SYM diff --git a/bfd/targets.c b/bfd/targets.c index 3fb60cb4af6..e490f5f81d6 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -599,6 +599,8 @@ extern const bfd_target arc_elf32_be_vec; extern const bfd_target arc_elf32_le_vec; extern const bfd_target arm_elf32_be_vec; extern const bfd_target arm_elf32_le_vec; +extern const bfd_target arm_elf32_fdpic_be_vec; +extern const bfd_target arm_elf32_fdpic_le_vec; extern const bfd_target arm_elf32_nacl_be_vec; extern const bfd_target arm_elf32_nacl_le_vec; extern const bfd_target arm_elf32_symbian_be_vec; @@ -921,6 +923,8 @@ static const bfd_target * const _bfd_target_vector[] = &arm_elf32_be_vec, &arm_elf32_le_vec, + &arm_elf32_fdpic_be_vec, + &arm_elf32_fdpic_le_vec, &arm_elf32_symbian_be_vec, &arm_elf32_symbian_le_vec, &arm_elf32_vxworks_be_vec, diff --git a/ld/ChangeLog b/ld/ChangeLog index 23843c17269..e6339418db1 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,14 @@ +2018-04-25 Christophe Lyon + Mickaël Guêné + + * Makefile.am (ALL_EMULATION_SOURCES): Add + earmelf_linux_fdpiceabi.c and earmelfb_linux_fdpiceabi.c. + (earmelf_linux_fdpiceabi.c, earmelfb_linux_fdpiceabi.c): New rules. + * Makefile.in: Regenerate. + * configure.tgt (arm*-*-uclinuxfdpiceabi): Handle new target. + * emulparams/armelf_linux_fdpiceabi.sh: New. + * emulparams/armelfb_linux_fdpiceabi.sh: New. + 2018-04-25 Alan Modra * Makefile.am: Remove arm-aout and arm-coff support. diff --git a/ld/Makefile.am b/ld/Makefile.am index a905b156020..6464e10917e 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -172,6 +172,7 @@ ALL_EMULATION_SOURCES = \ earmelf_fuchsia.c \ earmelf_linux.c \ earmelf_linux_eabi.c \ + earmelf_linux_fdpiceabi.c \ earmelf_nacl.c \ earmelf_nbsd.c \ earmelf_phoenix.c \ @@ -181,6 +182,7 @@ ALL_EMULATION_SOURCES = \ earmelfb_fuchsia.c \ earmelfb_linux.c \ earmelfb_linux_eabi.c \ + earmelfb_linux_fdpiceabi.c \ earmelfb_nacl.c \ earmelfb_nbsd.c \ earmnto.c \ @@ -703,6 +705,11 @@ earmelf_linux_eabi.c: $(srcdir)/emulparams/armelf_linux_eabi.sh \ $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} +earmelf_linux_fdpiceabi.c: $(srcdir)/emulparams/armelf_linux_fdpiceabi.sh \ + $(srcdir)/emulparams/armelf_linux.sh \ + $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \ + $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + earmelf_nacl.c: $(srcdir)/emulparams/armelf_nacl.sh \ $(srcdir)/emulparams/armelf_linux_eabi.sh \ $(srcdir)/emulparams/armelf_linux.sh \ @@ -749,6 +756,12 @@ earmelfb_linux_eabi.c: $(srcdir)/emulparams/armelfb_linux_eabi.sh \ $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} +earmelfb_linux_fdpiceabi.c: $(srcdir)/emulparams/armelfb_linux_fdpiceabi.sh \ + $(srcdir)/emulparams/armelfb_linux_fdpiceabi.sh \ + $(srcdir)/emulparams/armelf_linux.sh \ + $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \ + $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + earmelfb_nacl.c: $(srcdir)/emulparams/armelfb_nacl.sh \ $(srcdir)/emulparams/armelf_nacl.sh \ $(srcdir)/emulparams/armelf_linux_eabi.sh \ diff --git a/ld/Makefile.in b/ld/Makefile.in index d2201acef83..8e0122c8556 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -541,6 +541,7 @@ ALL_EMULATION_SOURCES = \ earmelf_fuchsia.c \ earmelf_linux.c \ earmelf_linux_eabi.c \ + earmelf_linux_fdpiceabi.c \ earmelf_nacl.c \ earmelf_nbsd.c \ earmelf_phoenix.c \ @@ -550,6 +551,7 @@ ALL_EMULATION_SOURCES = \ earmelfb_fuchsia.c \ earmelfb_linux.c \ earmelfb_linux_eabi.c \ + earmelfb_linux_fdpiceabi.c \ earmelfb_nacl.c \ earmelfb_nbsd.c \ earmnto.c \ @@ -1086,6 +1088,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_fuchsia.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux_eabi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux_fdpiceabi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_nacl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_nbsd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_phoenix.Po@am__quote@ @@ -1095,6 +1098,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_fuchsia.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_linux.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_linux_eabi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_linux_fdpiceabi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_nacl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_nbsd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmnto.Po@am__quote@ @@ -2202,6 +2206,11 @@ earmelf_linux_eabi.c: $(srcdir)/emulparams/armelf_linux_eabi.sh \ $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} +earmelf_linux_fdpiceabi.c: $(srcdir)/emulparams/armelf_linux_fdpiceabi.sh \ + $(srcdir)/emulparams/armelf_linux.sh \ + $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \ + $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + earmelf_nacl.c: $(srcdir)/emulparams/armelf_nacl.sh \ $(srcdir)/emulparams/armelf_linux_eabi.sh \ $(srcdir)/emulparams/armelf_linux.sh \ @@ -2248,6 +2257,12 @@ earmelfb_linux_eabi.c: $(srcdir)/emulparams/armelfb_linux_eabi.sh \ $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} +earmelfb_linux_fdpiceabi.c: $(srcdir)/emulparams/armelfb_linux_fdpiceabi.sh \ + $(srcdir)/emulparams/armelf_linux_fdpiceabi.sh \ + $(srcdir)/emulparams/armelf_linux.sh \ + $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \ + $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + earmelfb_nacl.c: $(srcdir)/emulparams/armelfb_nacl.sh \ $(srcdir)/emulparams/armelf_nacl.sh \ $(srcdir)/emulparams/armelf_linux_eabi.sh \ diff --git a/ld/configure.tgt b/ld/configure.tgt index 1b456117a3d..1999010896f 100644 --- a/ld/configure.tgt +++ b/ld/configure.tgt @@ -129,7 +129,12 @@ arm*b-*-linux-*) targ_emul=armelfb_linux targ_extra_libpath="armelf_linux" ;; arm*-*-linux-*eabi*) targ_emul=armelf_linux_eabi - targ_extra_emuls=armelfb_linux_eabi + targ_extra_emuls="armelfb_linux_eabi" + targ_extra_libpath=$targ_extra_emuls + ;; +arm*-*-uclinuxfdpiceabi) + targ_emul=armelf_linux_eabi + targ_extra_emuls="armelfb_linux_eabi armelf_linux_fdpiceabi armelfb_linux_fdpiceabi" targ_extra_libpath=$targ_extra_emuls ;; arm*-*-linux-*) targ_emul=armelf_linux diff --git a/ld/emulparams/armelf_linux_fdpiceabi.sh b/ld/emulparams/armelf_linux_fdpiceabi.sh new file mode 100644 index 00000000000..104cf38520d --- /dev/null +++ b/ld/emulparams/armelf_linux_fdpiceabi.sh @@ -0,0 +1,13 @@ +. ${srcdir}/emulparams/armelf_linux.sh + +OUTPUT_FORMAT="elf32-littlearm-fdpic" +BIG_OUTPUT_FORMAT="elf32-bigarm-fdpic" +LITTLE_OUTPUT_FORMAT="elf32-littlearm-fdpic" + +# Use the ARM ABI-compliant exception-handling sections. +OTHER_READONLY_SECTIONS=" + .ARM.extab ${RELOCATING-0} : { *(.ARM.extab${RELOCATING+* .gnu.linkonce.armextab.*}) } + ${RELOCATING+ PROVIDE_HIDDEN (__exidx_start = .); } + .ARM.exidx ${RELOCATING-0} : { *(.ARM.exidx${RELOCATING+* .gnu.linkonce.armexidx.*}) } + ${RELOCATING+ PROVIDE_HIDDEN (__exidx_end = .); }" + diff --git a/ld/emulparams/armelfb_linux_fdpiceabi.sh b/ld/emulparams/armelfb_linux_fdpiceabi.sh new file mode 100644 index 00000000000..988ea7aecea --- /dev/null +++ b/ld/emulparams/armelfb_linux_fdpiceabi.sh @@ -0,0 +1,2 @@ +. ${srcdir}/emulparams/armelf_linux_fdpiceabi.sh +OUTPUT_FORMAT="elf32-bigarm-fdpic"