Skip to content

Commit 3b6c196

Browse files
committed
Fix some dlx fails
Generic linker ELF targets using CREATE_OBJECT_SYMBOLS in their scripts run into a problem. The file symbols are created by _bfd_generic_link_output_symbols in each object file, in the section corresponding to the CREATE_OBJECT_SYMBOLS section, typically .text. If it so happens that the output .text section is stripped due to being empty, then elf.c:assign_section_numbers won't assign an ELF section number and swap_out_syms will report "unable to find equivalent output section" for the object symbols. Fix this by always keeping an output section with CREATE_OBJECT_SYMBOLS. * ldlang.c (lang_size_sections_1): Set SEC_KEEP on create_object_symbols_section. * testsuite/ld-elf/pr22319.d: Don't xfail dlx.
1 parent acde6c6 commit 3b6c196

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

ld/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2019-03-21 Alan Modra <amodra@gmail.com>
2+
3+
* ldlang.c (lang_size_sections_1): Set SEC_KEEP on
4+
create_object_symbols_section.
5+
* testsuite/ld-elf/pr22319.d: Don't xfail dlx.
6+
17
2019-03-18 Alan Modra <amodra@gmail.com>
28

39
* testsuite/ld-elf/merge.d: Remove csky from xfails, add moxie.

ld/ldlang.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5619,8 +5619,9 @@ lang_size_sections_1
56195619
break;
56205620

56215621
case lang_object_symbols_statement_enum:
5622-
link_info.create_object_symbols_section =
5623-
output_section_statement->bfd_section;
5622+
link_info.create_object_symbols_section
5623+
= output_section_statement->bfd_section;
5624+
output_section_statement->bfd_section->flags |= SEC_KEEP;
56245625
break;
56255626

56265627
case lang_output_statement_enum:

ld/testsuite/ld-elf/pr22319.d

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#name: PR 22319 - required undefined symbols in output
22
#ld: -u undefined_symbol -e 0
33
#nm: -u
4-
#xfail: dlx-*-*
5-
# The DLX target fails because it needs a special linker script to handle file symbols.
64

75
[ ]+U+[ ]+undefined_symbol
86
#pass

0 commit comments

Comments
 (0)