Skip to content

Commit 00e280d

Browse files
committed
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. (cherry picked from commit c456678)
1 parent 6ff2462 commit 00e280d

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

bfd/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2021-01-29 Alan Modra <amodra@gmail.com>
2+
3+
PR 27271
4+
* elflink.c (bfd_elf_link_record_dynamic_symbol): Don't segfault
5+
on symbols defined in absolute or other special sections.
6+
17
2021-01-26 Alan Modra <amodra@gmail.com>
28

39
* elf32-ft32.c (ft32_reloc_type_lookup): Don't miss ft32_reloc_map[0].

bfd/elflink.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,10 @@ bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info,
537537
if (!elf_hash_table (info)->is_relocatable_executable
538538
|| ((h->root.type == bfd_link_hash_defined
539539
|| h->root.type == bfd_link_hash_defweak)
540+
&& h->root.u.def.section->owner != NULL
540541
&& h->root.u.def.section->owner->no_export)
541542
|| (h->root.type == bfd_link_hash_common
543+
&& h->root.u.c.p->section->owner != NULL
542544
&& h->root.u.c.p->section->owner->no_export))
543545
return TRUE;
544546
}

ld/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2021-01-29 Alan Modra <amodra@gmail.com>
2+
3+
* testsuite/ld-tic6x/tic6x.exp: Add pr27271 test.
4+
15
2021-01-27 Nick Clifton <nickc@redhat.com>
26

37
Import from mainline:

ld/testsuite/ld-tic6x/tic6x.exp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ set shlibtests {
130130
{objdump -sj.got static-app-1rb.sd}
131131
{objdump -R static-app-1rb.od}}
132132
"static-app-1rb"}
133+
134+
{"C6X shared library with --export-dynamic"
135+
"-shared --export-dynamic -Tdsbt.ld --dsbt-size=3 --hash-style=sysv" ""
136+
"-mdsbt -mpic -mpid=near" {shlib-1.s shlib-2.s}
137+
{} "pr27271.so"}
133138
}
134139

135140
run_ld_link_tests $shlibtests

0 commit comments

Comments
 (0)