This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix some dlx fails


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3b6c19668236e6fd60c6299e7d016396d645fa61

commit 3b6c19668236e6fd60c6299e7d016396d645fa61
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Mar 19 15:41:58 2019 +1030

    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.

Diff:
---
 ld/ChangeLog                  | 6 ++++++
 ld/ldlang.c                   | 5 +++--
 ld/testsuite/ld-elf/pr22319.d | 2 --
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index 9000cab..4fe6889 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2019-03-21  Alan Modra  <amodra@gmail.com>
+
+	* ldlang.c (lang_size_sections_1): Set SEC_KEEP on
+	create_object_symbols_section.
+	* testsuite/ld-elf/pr22319.d: Don't xfail dlx.
+
 2019-03-18  Alan Modra  <amodra@gmail.com>
 
 	* testsuite/ld-elf/merge.d: Remove csky from xfails, add moxie.
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 33f6bda..77d890e 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -5619,8 +5619,9 @@ lang_size_sections_1
 	  break;
 
 	case lang_object_symbols_statement_enum:
-	  link_info.create_object_symbols_section =
-	    output_section_statement->bfd_section;
+	  link_info.create_object_symbols_section
+	    = output_section_statement->bfd_section;
+	  output_section_statement->bfd_section->flags |= SEC_KEEP;
 	  break;
 
 	case lang_output_statement_enum:
diff --git a/ld/testsuite/ld-elf/pr22319.d b/ld/testsuite/ld-elf/pr22319.d
index 8ad2f3e..f5413f0 100644
--- a/ld/testsuite/ld-elf/pr22319.d
+++ b/ld/testsuite/ld-elf/pr22319.d
@@ -1,8 +1,6 @@
 #name: PR 22319 - required undefined symbols in output
 #ld: -u undefined_symbol -e 0
 #nm: -u
-#xfail: dlx-*-* 
-# The DLX target fails because it needs a special linker script to handle file symbols.
 
 [ 	]+U+[ 	]+undefined_symbol
 #pass


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]