This is the mail archive of the
mailing list for the binutils project.
Commit: Fix spurious relocation truncated to fit errors for 64-bit PE targets.
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils at sourceware dot org
- Date: Wed, 26 Mar 2014 16:29:24 +0000
- Subject: Commit: Fix spurious relocation truncated to fit errors for 64-bit PE targets.
- Authentication-results: sourceware.org; auth=none
I am applying the patch below to fix a problem for 64-bit PE targets
(specifically Cygwin), whereby the linker can issue spurious
complaints about truncated relocations. What is happening is that the
linker is attempting to resolve a 32-bit relocation against a symbol
in a section that is going to be discarded. So the output section's
address is set to 0, but since we are using 64-bit addresses and the
base address can be above 4Gb, we can end up with an invalid 32-bit
The fix is simple - ignore relocations against discarded sections.
Tested without regressions on an x86_64-pc-cygwin toolchain.
2014-03-26 Nick Clifton <firstname.lastname@example.org>
* cofflink.c (_bfd_coff_generic_relocate_section): Skip
relocations in discarded sections.
RCS file: /cvs/src/src/bfd/cofflink.c,v
retrieving revision 1.84
diff -c -p -r1.84 cofflink.c
*** bfd/cofflink.c 10 Jan 2013 20:03:52 -0000 1.84
--- bfd/cofflink.c 4 Jun 2013 12:03:23 -0000
*************** _bfd_coff_generic_relocate_section (bfd
*** 3060,3065 ****
--- 3060,3070 ----
sec = sections[symndx];
+ /* If the output section has been discarded then ignore this reloc. */
+ if (sec->output_section->vma == 0)
val = (sec->output_section->vma