[PATCH 5/6] bfd: don't silently wrap or truncate PE image section RVAs
Alan Modra
amodra@gmail.com
Thu Mar 4 06:13:10 GMT 2021
On Tue, Mar 02, 2021 at 10:49:54AM +0100, Jan Beulich via Binutils wrote:
> In PE images section addresses get expressed as addresses relative to
> the image base. Therefore the VA of a section must be no less than the
> image base, and after subtraction of the image base the resulting value
> should fit in 32 bits. (The issue is particularly obvious to notice when
> sections, perhaps because of ELF assumptions, get placed at VA 0 by
> default. Debugging info sections as well as .comment, when input files
> are ELF, are a good example. All such sections need proper mentioning in
> the linker script to avoid this warning.)
>
> There are a number of test cases which previously produced bogus images,
> yet still declared the test a success. Like done for other tests
> already, force a zero image base for these. This then also allows (and
> requires) dropping again xfail-s which 39a7b38fac0e ("Fix linker tests
> to work with 16-bit targets") had added to ld-scripts/default-script*.d
> (originally as skip-s). This also depends on similar adjustments to
> testsuite/ld-scripts/map-address.* made by an earlier patch.
>
> For ld-scripts/print-memory-usage.* I suppose xcoff could be dropped
> from the exclusion list by suppressing garbage collection, just like
> already done in e.g. (as seen in the diff here) ld-scripts/data.*, but I
> didn't want to make unrelated adjustments.
>
> bfd/
> 2021-02-XX Jan Beulich <jbeulich@suse.com>
>
> * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Diagnose out of range RVA.
>
> ld/
> 2021-02-XX Jan Beulich <jbeulich@suse.com>
>
> * testsuite/ld-scripts/alignof.exp,
> testsuite/ld-scripts/data.exp,
> testsuite/ld-scripts/default-script.exp,
> testsuite/ld-scripts/log2.exp,
> testsuite/ld-scripts/print-memory-usage.exp,
> testsuite/ld-scripts/sizeof.exp,
> testsuite/ld-undefined/weak-undef.exp: Set image base to zero
> for PE/COFF.
> * testsuite/ld-scripts/default-script1.d,
> testsuite/ld-scripts/default-script2.d,
> testsuite/ld-scripts/default-script3.d,
> testsuite/ld-scripts/default-script4.d: Drop xfail and comment.
OK, but again you need to add some spaces before function call open
parentheses.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list