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] Stop the v850 linker from converting to other output formats whilst linking.


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

commit 2824e1bd4fc93f112875969b1ba606980aaa55ba
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Nov 21 14:15:51 2017 +0000

    Stop the v850 linker from converting to other output formats whilst linking.
    
    	PR 22419
    	* emultempl/v850elf.em (v850_create_output_section_statements):
    	New function.  Generate an error if attempting to convert the
    	format of the output file.
    	* testsuite/ld-unique/pr21529.d: Skip for the V850.
    	* testsuite/ld-elf/pr21884.d: Skip for the V850.

Diff:
---
 ld/ChangeLog                     |  9 +++++++++
 ld/emultempl/v850elf.em          | 21 +++++++++++++++++++++
 ld/testsuite/ld-elf/pr21884.d    |  2 +-
 ld/testsuite/ld-unique/pr21529.d |  2 +-
 4 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index c7d9999..4cfcf6d 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2017-11-21  Nick Clifton  <nickc@redhat.com>
+
+	PR 22419
+	* emultempl/v850elf.em (v850_create_output_section_statements):
+	New function.  Generate an error if attempting to convert the
+	format of the output file.
+	* testsuite/ld-unique/pr21529.d: Skip for the V850.
+	* testsuite/ld-elf/pr21884.d: Skip for the V850.
+
 2017-11-21  Claudiu Zissulescu <claziss@synopsys.com>
 
 	* testsuite/ld-arc/jli-simple.d: Update test.
diff --git a/ld/emultempl/v850elf.em b/ld/emultempl/v850elf.em
index 2d59023..5bc82cc 100644
--- a/ld/emultempl/v850elf.em
+++ b/ld/emultempl/v850elf.em
@@ -49,6 +49,27 @@ v850_after_open (void)
   gld${EMULATION_NAME}_after_open ();
 }
 
+/* This is a convenient point to tell BFD about target specific flags.
+   After the output has been created, but before inputs are read.  */
+
+static void
+v850_create_output_section_statements (void)
+{
+  /* See PR 22419 for an example of why this is necessary.  */
+  if (strstr (bfd_get_target (link_info.output_bfd), "v850") == NULL)
+    {
+      /* The V850 backend needs special fields in the output hash structure.
+	 These will only be created if the output format is an arm format,
+	 hence we do not support linking and changing output formats at the
+	 same time.  Use a link followed by objcopy to change output formats.  */
+      einfo (_("%F%X%P: error: Cannot change output format (to %s) whilst linking V850 binaries.\n"),
+	     bfd_get_target (link_info.output_bfd));
+      return;
+    }
+}
+
+
 EOF
 
 LDEMUL_AFTER_OPEN=v850_after_open
+LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=v850_create_output_section_statements
diff --git a/ld/testsuite/ld-elf/pr21884.d b/ld/testsuite/ld-elf/pr21884.d
index 0de7b83..2645a87 100644
--- a/ld/testsuite/ld-elf/pr21884.d
+++ b/ld/testsuite/ld-elf/pr21884.d
@@ -2,7 +2,7 @@
 #source: pr21884b.s
 #ld: -T pr21884.t
 #objdump: -b binary -s
-#notarget: aarch64*-*-* arm*-*-* avr-*-* hppa-*-* ia64-*-* m68hc1*-*-* nds32*-*-* score-*-*
+#notarget: aarch64*-*-* arm*-*-* avr-*-* hppa-*-* ia64-*-* m68hc1*-*-* nds32*-*-* score-*-* v850-*-*
 # Skip targets which can't change output format to binary.
 
 .*:     file format binary
diff --git a/ld/testsuite/ld-unique/pr21529.d b/ld/testsuite/ld-unique/pr21529.d
index ffc1a72..655a9ef 100644
--- a/ld/testsuite/ld-unique/pr21529.d
+++ b/ld/testsuite/ld-unique/pr21529.d
@@ -1,6 +1,6 @@
 #ld: --oformat binary -T pr21529.ld -e main
 #objdump: -s -b binary
-#notarget: aarch64*-*-* arm*-*-* avr-*-* ia64-*-* m68hc1*-*-* nds32*-*-* score-*-*
+#notarget: aarch64*-*-* arm*-*-* avr-*-* ia64-*-* m68hc1*-*-* nds32*-*-* score-*-* v850-*-*
 # Skip targets which can't change output format to binary.
 
 #pass


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