]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[ARM] Add armelf_linux_fdpiceabi and armelfb_linux_fdpiceabi BFD backends
authorChristophe Lyon <christophe.lyon@st.com>
Tue, 20 Mar 2018 09:54:26 +0000 (10:54 +0100)
committerChristophe Lyon <christophe.lyon@st.com>
Tue, 20 Mar 2018 09:54:26 +0000 (10:54 +0100)
Initial definition of these new backends.

2018-XX-XX  Christophe Lyon  <christophe.lyon@st.com>
Mickaël Guêné  <mickael.guene@st.com>

bfd/
* config.bfd (arm*b-*-linux-*): Add arm_elf32_fdpic_be_vec and
arm_elf32_fdpic_le_vec to targ_selvecs.
(arm*-*-linux-*): Likewise.
* 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*b-*-linux-*eabi*): Add armelf_linux_fdpiceabi
and armelfb_linux_fdpiceabi.
(arm*-*-linux-*eabi*): Likewise.
* emulparams/armelf_linux_fdpiceabi.sh: New.
* emulparams/armelfb_linux_fdpiceabi.sh: New.

bfd/config.bfd
bfd/configure
bfd/configure.ac
bfd/elf32-arm.c
bfd/targets.c
ld/Makefile.am
ld/Makefile.in
ld/configure.tgt
ld/emulparams/armelf_linux_fdpiceabi.sh [new file with mode: 0644]
ld/emulparams/armelfb_linux_fdpiceabi.sh [new file with mode: 0644]

index f04a993f06f20ae74bda22cf0440af23cdde85fa..2fe22eb82ef2e2505d67ec5369749fe861403038 100644 (file)
@@ -436,7 +436,7 @@ case "${targ}" in
     ;;
   armeb-*-elf | arm*b-*-freebsd* | arm*b-*-linux-* | armeb-*-eabi*)
     targ_defvec=arm_elf32_be_vec
-    targ_selvecs=arm_elf32_le_vec
+    targ_selvecs="arm_elf32_fdpic_be_vec arm_elf32_le_vec arm_elf32_fdpic_le_vec"
     ;;
   arm-*-kaos*)
     targ_defvec=arm_elf32_le_vec
@@ -446,7 +446,7 @@ case "${targ}" in
   arm*-*-uclinux* | arm-*-kfreebsd*-gnu | \
   arm*-*-eabi* | arm-*-rtems*)
     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
index d1fe335530c8378766db4bba0ea7e8b4db73b0de..a023806fb0220e86794b6d7650a8e27147484164 100755 (executable)
@@ -14355,6 +14355,8 @@ do
     arm_coff_le_vec)            tb="$tb coff-arm.lo $coff" ;;
     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" ;;
index 20e2c022e8a5d76853dd1e5dc0564fcecef5578f..64df7db96fa72c1f70c092be93b31af4bbaad9e8 100644 (file)
@@ -432,6 +432,8 @@ do
     arm_coff_le_vec)            tb="$tb coff-arm.lo $coff" ;;
     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" ;;
index ce9c2f29bf82b680fea7281ffb723a1c04bd5d0c..565bb404f2ceca749bb30cf19ce2a69d9db64852 100644 (file)
@@ -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
index 43102d428b9e919c7bc4cc41b512f1885d347bde..79e330992455825b6ea1614350470ddd88b8694b 100644 (file)
@@ -612,6 +612,8 @@ extern const bfd_target arm_coff_be_vec;
 extern const bfd_target arm_coff_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;
@@ -1021,6 +1023,8 @@ static const bfd_target * const _bfd_target_vector[] =
        &arm_coff_le_vec,
        &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,
index d94fce7fa56172953c52e1fe793601d3657305a1..31ac5928255d8e370fd43c0df9ed737e6ee0a01b 100644 (file)
@@ -176,6 +176,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 \
@@ -185,6 +186,7 @@ ALL_EMULATION_SOURCES = \
        earmelfb_fuchsia.c \
        earmelfb_linux.c \
        earmelfb_linux_eabi.c \
+       earmelfb_linux_fdpiceabi.c \
        earmelfb_nacl.c \
        earmelfb_nbsd.c \
        earmnbsd.c \
@@ -780,6 +782,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 \
@@ -826,6 +833,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 \
index 704694b2ca496f134eb2863e06306ece099e4abe..897a2fbb64269b8a014a56b9936d6022aee811b9 100644 (file)
@@ -545,6 +545,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 \
@@ -554,6 +555,7 @@ ALL_EMULATION_SOURCES = \
        earmelfb_fuchsia.c \
        earmelfb_linux.c \
        earmelfb_linux_eabi.c \
+       earmelfb_linux_fdpiceabi.c \
        earmelfb_nacl.c \
        earmelfb_nbsd.c \
        earmnbsd.c \
@@ -1155,6 +1157,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@
@@ -1164,6 +1167,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)/earmnbsd.Po@am__quote@
@@ -2344,6 +2348,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 \
@@ -2390,6 +2399,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 \
index 7897448e6438bada02eb88244dfb1336621511b0..ea2aff89e67d1baf552fc5685ef6e96210ca570e 100644 (file)
@@ -129,7 +129,7 @@ arm*-*-symbianelf*) targ_emul=armsymbian;;
 arm-*-kaos*)           targ_emul=armelf ;;
 arm9e-*-elf)           targ_emul=armelf ;;
 arm*b-*-linux-*eabi*)  targ_emul=armelfb_linux_eabi
-                       targ_extra_emuls=armelf_linux_eabi
+                       targ_extra_emuls="armelf_linux_eabi armelf_linux_fdpiceabi armelfb_linux_fdpiceabi"
                        targ_extra_libpath=$targ_extra_emuls
                        ;;
 arm*b-*-linux-*)       targ_emul=armelfb_linux
@@ -137,7 +137,7 @@ 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 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 (file)
index 0000000..104cf38
--- /dev/null
@@ -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 (file)
index 0000000..988ea7a
--- /dev/null
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/armelf_linux_fdpiceabi.sh
+OUTPUT_FORMAT="elf32-bigarm-fdpic"