Fixes for "Ignore dynamic references on forced local symbols"
authorAlan Modra <amodra@gmail.com>
Fri, 12 Jan 2018 06:28:04 +0000 (16:58 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 12 Jan 2018 10:43:11 +0000 (21:13 +1030)
PowerPC64 has its own mark_dynamic_ref, which needs the same change as
made by d664fd41e1 to the generic ELF version.  Some other targets
discard more than just .data, so allow for that too in expected ld
messages.

bfd/
PR ld/22649
* elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Ignore dynamic
references on forced local symbols.
ld/
PR ld/22649
* testsuite/ld-elf/pr22649.msg: Allow other messages.
* testsuite/ld-elf/shared.exp: Check that --gc-sections is
supported before running ld/22649 tests.

bfd/ChangeLog
bfd/elf64-ppc.c
ld/ChangeLog
ld/testsuite/ld-elf/pr22649.msg
ld/testsuite/ld-elf/shared.exp

index a31693e3a43eceb9caa0719285735ec8ebb5b95c..85ea86a004b748b69dd4e58fa94be04f995871d1 100644 (file)
@@ -1,3 +1,9 @@
+2018-01-12  Alan Modra  <amodra@gmail.com>
+
+       PR ld/22649
+       * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Ignore dynamic
+       references on forced local symbols.
+
 2018-01-12  Vlad Ivanov  <vlad@ivanov.email>
 
        * elfxx-mips.c (_bfd_mips_elf_final_link): Notify user when
index c548fef62e0778ed51f3817d6b0bca0dd44923ac..d4016b9a4442852e524afb353206cc39c76fc83e 100644 (file)
@@ -6447,7 +6447,7 @@ ppc64_elf_gc_mark_dynamic_ref (struct elf_link_hash_entry *h, void *inf)
 
   if ((eh->elf.root.type == bfd_link_hash_defined
        || eh->elf.root.type == bfd_link_hash_defweak)
-      && (eh->elf.ref_dynamic
+      && ((eh->elf.ref_dynamic && !eh->elf.forced_local)
          || ((eh->elf.def_regular || ELF_COMMON_DEF_P (&eh->elf))
              && ELF_ST_VISIBILITY (eh->elf.other) != STV_INTERNAL
              && ELF_ST_VISIBILITY (eh->elf.other) != STV_HIDDEN
index a2c13c8385b47cc9952aaf3e818d5fab2212b51a..39f79fecc240970889f39306ef30b69346e82ed7 100644 (file)
@@ -1,3 +1,10 @@
+2018-01-12  Alan Modra  <amodra@gmail.com>
+
+       PR ld/22649
+       * testsuite/ld-elf/pr22649.msg: Allow other messages.
+       * testsuite/ld-elf/shared.exp: Check that --gc-sections is
+       supported before running ld/22649 tests.
+
 2018-01-12  Nick Clifton  <nickc@redhat.com>
 
        * emultempl/elf32.em (_handle_option): Add support for "-z undefs"
index b4e45bd66274567f87a114ebb4a086ab6d150403..66b5f25bdf25e13f8cfc15e05b04842dae51bd35 100644 (file)
@@ -1 +1,3 @@
+#...
 .*: Removing unused section '\.data' in file 'tmpdir/pr22649-2.*\.o'
+#pass
index 1247fd217cc300ff0d1c535fbc626dac008f7c80..5c4d78aa2d33ff4f795402507b1a87dcc4472f7b 100644 (file)
@@ -90,44 +90,49 @@ run_ld_link_tests [list \
        {} \
        "pr22649-1.so" \
     ] \
-    [list \
-       "Build pr22649-2a.so" \
-       "$LFLAGS -shared -gc-sections -print-gc-sections" \
-       "" \
-       "$AFLAGS_PIC" \
-       {pr22649-2a.s} \
-       {{ld pr22649.msg}} \
-       "pr22649-2a.so" \
-    ] \
-    [list \
-       "Build pr22649-2b.so" \
-       "$LFLAGS -shared -gc-sections -print-gc-sections" \
-       "tmpdir/pr22649-1.so" \
-       "$AFLAGS_PIC" \
-       {pr22649-2a.s} \
-       {{ld pr22649.msg}} \
-       "pr22649-2b.so" \
-    ] \
-    [list \
-       "Build pr22649-2c.so" \
-       "$LFLAGS -shared -gc-sections -print-gc-sections" \
-       "" \
-       "$AFLAGS_PIC" \
-       {pr22649-2b.s} \
-       {} \
-       "pr22649-2b.so" \
-    ] \
-    [list \
-       "Build pr22649-2d.so" \
-       "$LFLAGS -shared -gc-sections -print-gc-sections" \
-       "tmpdir/pr22649-1.so" \
-       "$AFLAGS_PIC" \
-       {pr22649-2b.s} \
-       {} \
-       "pr22649-2b.so" \
-    ] \
 ]
 
+if { [check_gc_sections_available] } {
+    run_ld_link_tests [list \
+       [list \
+           "Build pr22649-2a.so" \
+           "$LFLAGS -shared -gc-sections -print-gc-sections" \
+           "" \
+           "$AFLAGS_PIC" \
+           {pr22649-2a.s} \
+           {{ld pr22649.msg}} \
+           "pr22649-2a.so" \
+       ] \
+       [list \
+           "Build pr22649-2b.so" \
+           "$LFLAGS -shared -gc-sections -print-gc-sections" \
+           "tmpdir/pr22649-1.so" \
+           "$AFLAGS_PIC" \
+           {pr22649-2a.s} \
+           {{ld pr22649.msg}} \
+           "pr22649-2b.so" \
+       ] \
+       [list \
+           "Build pr22649-2c.so" \
+           "$LFLAGS -shared -gc-sections -print-gc-sections" \
+           "" \
+           "$AFLAGS_PIC" \
+           {pr22649-2b.s} \
+           {} \
+           "pr22649-2b.so" \
+       ] \
+       [list \
+           "Build pr22649-2d.so" \
+           "$LFLAGS -shared -gc-sections -print-gc-sections" \
+           "tmpdir/pr22649-1.so" \
+           "$AFLAGS_PIC" \
+           {pr22649-2b.s} \
+           {} \
+           "pr22649-2b.so" \
+       ] \
+    ]
+}
+
 run_ld_link_tests [list \
     [list \
        "DT_TEXTREL in shared lib" \
This page took 0.033667 seconds and 4 git commands to generate.