Fixes for testsuite failures introduced by the changes made for PR 19011.
authorNick Clifton <nickc@redhat.com>
Fri, 28 Aug 2020 08:43:13 +0000 (09:43 +0100)
committerNick Clifton <nickc@redhat.com>
Fri, 28 Aug 2020 08:43:13 +0000 (09:43 +0100)
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.

bfd/ChangeLog
bfd/cofflink.c
ld/ChangeLog
ld/testsuite/lib/ld-lib.exp

index cbec1c5eecb6691713d1c43145747c4f429cc7bd..51bfbda55d06d48a1ad361bfd923d1bff4076fcb 100644 (file)
@@ -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
index 63bdcde115deae70f52d4eb543ab1170d2c49d81..8833cd0caf9c46e7d58666691b008708a46efe3c 100644 (file)
@@ -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
index 824e00de5f1e3e32ae41e14a54c248a3380a2115..568e2217a62cc24778230fcb0f355b038167d69e 100644 (file)
@@ -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
index 6628372d26f14b5373166e4e6ac3cfaa69d67d7c..7972e8fd33c84066c3fdfdc2ba861eae86771acb 100644 (file)
@@ -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.