[binutils-gdb] Fixes for testsuite failures introduced by the changes made for PR 19011.

Nick Clifton nickc@sourceware.org
Fri Aug 28 08:44:05 GMT 2020


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

commit 6194b866b7a89969d8c66f8a97d40acc028373b1
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Aug 28 09:43:13 2020 +0100

    Fixes for testsuite failures introduced by the changes made for PR 19011.
    
            PR19011
    bfd     * cofflink.c (_bfd_coff_generic_relocate_section): Provide a value
            for undefined symbols which will not generate extra warning
            messages about truncated relocs.
    
    ld      * testsuite/lib/ld-lib.exp (ld_link_defsyms): For PE based targets
            define the __main and ___main symbols in terms of the main symbol.

Diff:
---
 bfd/ChangeLog               |  7 +++++++
 bfd/cofflink.c              | 12 +++++++++---
 ld/ChangeLog                |  6 ++++++
 ld/testsuite/lib/ld-lib.exp |  2 +-
 4 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index cbec1c5eecb..51bfbda55d0 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2020-08-28  Nick Clifton  <nickc@redhat.com>
+
+	PR19011
+	* cofflink.c (_bfd_coff_generic_relocate_section): Provide a value
+	for undefined symbols which will not generate extra warning
+	messages about truncated relocs.
+
 2020-08-28  Nelson Chu  <nelson.chu@sifive.com>
 
 	* elfnn-riscv.c (riscv_elf_check_relocs): Treat R_RISCV_CALL
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 63bdcde115d..8833cd0caf9 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -3053,9 +3053,15 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
 	    }
 
 	  else if (! bfd_link_relocatable (info))
-	    (*info->callbacks->undefined_symbol)
-	      (info, h->root.root.string, input_bfd, input_section,
-	       rel->r_vaddr - input_section->vma, TRUE);
+	    {
+	      (*info->callbacks->undefined_symbol)
+		(info, h->root.root.string, input_bfd, input_section,
+		 rel->r_vaddr - input_section->vma, TRUE);
+	      /* Stop the linker from issueing errors about truncated relocs
+		 referencing this undefined symbol by giving it an address
+		 that should be in range.  */
+	      val = input_section->output_section->vma;
+	    }
 	}
 
       /* If the input section defining the symbol has been discarded
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 824e00de5f1..568e2217a62 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2020-08-28  Nick Clifton  <nickc@redhat.com>
+
+	PR 19011
+	* testsuite/lib/ld-lib.exp (ld_link_defsyms): For PE based targets
+	define the __main and ___main symbols in terms of the main symbol.
+
 2020-08-28  Alan Modra  <amodra@gmail.com>
 
 	PR 19011
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 6628372d26f..7972e8fd33c 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -378,7 +378,7 @@ proc ld_link_defsyms {} {
 
     # Windows targets need __main, some prefixed with underscore.
     if {[istarget *-*-cygwin* ] || [istarget *-*-mingw*]} {
-        append flags " --defsym __main=0 --defsym ___main=0"
+        append flags " --defsym __main=main --defsym ___main=main"
     }
 
     # PowerPC EABI code calls __eabi.


More information about the Binutils-cvs mailing list