Fix pe-coff reloc overflow problems

Nathan Sidwell nathan@codesourcery.com
Fri Sep 19 14:43:00 GMT 2003


Hi,
this patch fixes some problems with the way pe-coff reloc overflows
are treated. There were a couple of off-by-one errors.

A reloc overflow causes an initial reloc to be prepended containing
the real number of relocs. The header mentions 0xffff relocs and sets
an overflow bit.

We were not removing that first reloc correctly when reading back the
reloc table, but we would prepend a new reloc when writing the table
out. This caused objcopy to grow the reloc table by 1, and prepend
a sequence of bogus relocs.

A section with exactly 65535 relocs would lose the final reloc as
we'd not set the header overflow bit, but would prepend an overflow
reloc.

tested by targeting i386-pc-mingw32

nathan
-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
          The voices in my head said this was stupid too
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 85859.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20030919/e3eda407/attachment.ksh>


More information about the Binutils mailing list