]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
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 01:21:01 +0000 (11:51 +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.

(cherry picked from commit c4566785ac265b3e4b3cde0e43733975c58d9175)

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

index b0f734e1c971ceb9af664dcd739f8df83c100801..18d48ace726f43f9f119c243bc45395d62cb6c64 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-26  Alan Modra  <amodra@gmail.com>
 
        * elf32-ft32.c (ft32_reloc_type_lookup): Don't miss ft32_reloc_map[0].
index 27564adb8c3d95eb071d87015d49a4c4c0154c35..45ecd770046f3d0bbc62b308937731df9ae2515d 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 ccef43aac189c308a510988c2a41e38c84fb0bc2..2ac80ea2761a021090a4359d075e9014af591735 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-29  Alan Modra  <amodra@gmail.com>
+
+       * testsuite/ld-tic6x/tic6x.exp: Add pr27271 test.
+
 2021-01-27  Nick Clifton  <nickc@redhat.com>
 
        Import from mainline:
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