From c4566785ac265b3e4b3cde0e43733975c58d9175 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 29 Jan 2021 10:57:48 +1030 Subject: [PATCH] PR27271, c6x-uclinux-ld segfaults linking ld-uClibc-1.0.37.so 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 | 6 ++++++ bfd/elflink.c | 2 ++ ld/ChangeLog | 4 ++++ ld/testsuite/ld-tic6x/tic6x.exp | 5 +++++ 4 files changed, 17 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0fdc1fa1bc3..1eebae0404d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2021-01-29 Alan Modra + + 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 PR 27259 diff --git a/bfd/elflink.c b/bfd/elflink.c index 47c3fb4e683..3a3ca3b04f7 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -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; } diff --git a/ld/ChangeLog b/ld/ChangeLog index 6d47b7be36a..a2f2f88fb64 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,7 @@ +2021-01-29 Alan Modra + + * testsuite/ld-tic6x/tic6x.exp: Add pr27271 test. + 2021-01-28 H.J. Lu PR ld/27259 diff --git a/ld/testsuite/ld-tic6x/tic6x.exp b/ld/testsuite/ld-tic6x/tic6x.exp index e11699bed31..0a913da25d9 100644 --- a/ld/testsuite/ld-tic6x/tic6x.exp +++ b/ld/testsuite/ld-tic6x/tic6x.exp @@ -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 -- 2.30.2