PR27271, c6x-uclinux-ld segfaults linking ld-uClibc-1.0.37.so
authorAlan Modra <amodra@gmail.com>
Fri, 29 Jan 2021 00:27:48 +0000 (10:57 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 29 Jan 2021 00:37:18 +0000 (11:07 +1030)
bfd/
PR 27271
* elflink.c (bfd_elf_link_record_dynamic_symbol): Don't segfault
on symbols defined in absolute or other special sections.
ld/
* testsuite/ld-tic6x/tic6x.exp: Add pr27271 test.

bfd/ChangeLog
bfd/elflink.c
ld/ChangeLog
ld/testsuite/ld-tic6x/tic6x.exp

index 0fdc1fa1bc30ac19fa80a1677f08a2a65913eb97..1eebae0404dd48ac9888372a65b65916ef9e54e5 100644 (file)
@@ -1,3 +1,9 @@
+2021-01-29  Alan Modra  <amodra@gmail.com>
+
+       PR 27271
+       * elflink.c (bfd_elf_link_record_dynamic_symbol): Don't segfault
+       on symbols defined in absolute or other special sections.
+
 2021-01-28  Alan Modra  <amodra@gmail.com>
 
        PR 27259
index 47c3fb4e683bb5f8fed5ebfeb173d72a09ebe951..3a3ca3b04f7ac5276b20c17e9eb8a9c82f46e8fa 100644 (file)
@@ -537,8 +537,10 @@ bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info,
              if (!elf_hash_table (info)->is_relocatable_executable
                  || ((h->root.type == bfd_link_hash_defined
                       || h->root.type == bfd_link_hash_defweak)
+                     && h->root.u.def.section->owner != NULL
                      && h->root.u.def.section->owner->no_export)
                  || (h->root.type == bfd_link_hash_common
+                     && h->root.u.c.p->section->owner != NULL
                      && h->root.u.c.p->section->owner->no_export))
                return TRUE;
            }
index 6d47b7be36ac00c54179f4fa37b19d3f8c5c9530..a2f2f88fb64cffcbf1c981e957a8cdb50cdd3466 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-29  Alan Modra  <amodra@gmail.com>
+
+       * testsuite/ld-tic6x/tic6x.exp: Add pr27271 test.
+
 2021-01-28  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/27259
index e11699bed316eb3216defe9a4f5934260698c585..0a913da25d92dccae7c281d0e7dd2e02f9d9ef54 100644 (file)
@@ -130,6 +130,11 @@ set shlibtests {
       {objdump -sj.got static-app-1rb.sd}
       {objdump -R static-app-1rb.od}}
      "static-app-1rb"}
+
+    {"C6X shared library with --export-dynamic"
+     "-shared --export-dynamic -Tdsbt.ld --dsbt-size=3 --hash-style=sysv" ""
+     "-mdsbt -mpic -mpid=near" {shlib-1.s shlib-2.s}
+     {} "pr27271.so"}
 }
 
 run_ld_link_tests $shlibtests