This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[BFD][AARCH64] Emit one single AARCH64 MAP_INSN symbol for the whole plt.


Hi all,

This is a simple patch to insert a single AARCH64_MAP_INSN mapping symbol for the whole PLT section. Before the change, there is no mapping symbol for PLT0 (the first entry in PLT), one AARCH64_MAP_INSN symbol is inserted at second entry.

LD, GAS regression test done without any issues, Okay to commit?

bfd/ChangeLog:

2015-09-15  Renlin Li  <renlin.li@arm.com>

    * elfnn-aarch64.c (elfNN_aarch64_output_map_sym):
    (elfNN_aarch64_output_arch_local_syms):

ld/testsuite/ChangeLog:

2015-09-15  Renlin Li  <renlin.li@arm.com>

    * ld-aarch64/aarch64-elf.exp: Run new test.
    * ld-aarch64/plt_mapping_symbol.d: New.
    * ld-aarch64/plt_mapping_symbol.s: New.
commit f97a81cbc70059eeb39f5f1a7243f88f740b9501
Author: Renlin Li <renlin.li@arm.com>
Date:   Mon Sep 7 12:40:51 2015 +0100

    emit plt mapping symbol

diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index beedb70..741c738 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -7002,38 +7002,6 @@ elfNN_aarch64_output_map_sym (output_arch_syminfo *osi,
   return osi->func (osi->finfo, names[type], &sym, osi->sec, NULL) == 1;
 }
 
-
-
-/* Output mapping symbols for PLT entries associated with H.  */
-
-static bfd_boolean
-elfNN_aarch64_output_plt_map (struct elf_link_hash_entry *h, void *inf)
-{
-  output_arch_syminfo *osi = (output_arch_syminfo *) inf;
-  bfd_vma addr;
-
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
-
-  if (h->root.type == bfd_link_hash_warning)
-    /* When warning symbols are created, they **replace** the "real"
-       entry in the hash table, thus we never get to see the real
-       symbol in a hash traversal.  So look at it now.  */
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
-  if (h->plt.offset == (bfd_vma) - 1)
-    return TRUE;
-
-  addr = h->plt.offset;
-  if (addr == 32)
-    {
-      if (!elfNN_aarch64_output_map_sym (osi, AARCH64_MAP_INSN, addr))
-	return FALSE;
-    }
-  return TRUE;
-}
-
-
 /* Output a single local symbol for a generated stub.  */
 
 static bfd_boolean
@@ -7166,13 +7134,11 @@ elfNN_aarch64_output_arch_local_syms (bfd *output_bfd,
   if (!htab->root.splt || htab->root.splt->size == 0)
     return TRUE;
 
-  /* For now live without mapping symbols for the plt.  */
   osi.sec_shndx = _bfd_elf_section_from_bfd_section
     (output_bfd, htab->root.splt->output_section);
   osi.sec = htab->root.splt;
 
-  elf_link_hash_traverse (&htab->root, elfNN_aarch64_output_plt_map,
-			  (void *) &osi);
+  elfNN_aarch64_output_map_sym (&osi, AARCH64_MAP_INSN, 0);
 
   return TRUE;
 
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index 15247dc..808194c 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -224,6 +224,8 @@ run_dump_test "relocs-1027-symbolic-func"
 
 run_dump_test "dt_textrel"
 
+run_dump_test "plt_mapping_symbol"
+
 set aarch64elflinktests {
   {"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s}
   {} "copy-reloc-so.so"}
diff --git a/ld/testsuite/ld-aarch64/plt_mapping_symbol.d b/ld/testsuite/ld-aarch64/plt_mapping_symbol.d
new file mode 100644
index 0000000..3b86cff
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/plt_mapping_symbol.d
@@ -0,0 +1,10 @@
+#source: plt_mapping_symbol.s
+#ld: -shared -T relocs.ld -e0
+#objdump: --syms --special-syms
+#name: AArch64 mapping symbol for plt section test.
+#...
+
+SYMBOL TABLE:
+#...
+[0]+10010 l       .plt	0[0]+00 \$x
+#...
diff --git a/ld/testsuite/ld-aarch64/plt_mapping_symbol.s b/ld/testsuite/ld-aarch64/plt_mapping_symbol.s
new file mode 100644
index 0000000..ac20482
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/plt_mapping_symbol.s
@@ -0,0 +1,6 @@
+	.text
+test:
+	bl   __tls_get_addr
+	nop
+
+	.xword 0xffee

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]