objdump prints PE relocations with --private-headers, not --reloc

Pavel Roskin proski@gnu.org
Thu Oct 30 14:45:00 GMT 2003


On Thu, 30 Oct 2003, Nick Clifton wrote:

> Hi Pavel,
>
> > There is an inconsistency in the way how objdump prints
> > relocations.  Relocations for ELF of COFF files are printed by
> > "objdump --reloc", but relocations in PE files are printed by
> > "objdump --private-headers".  In the later case the relocations are
> > not grouped by sections they apply to.
>
> Which version of binutils were you using and compiled for which target?

It was CVS binutils configured for i586-pc-mingw32.

> I tried a simple test file:
>
> 	.text
> 	.global foo
>   foo:
> 	.word	fred
>
> with several different targets (arm-wince-pe, mingw32-pe, mcore-pe,
> i686-pc-cygwin) and in all cases the reloc generated in the object
> file was reported by "objdump -r" and not "objdump -p".

I was talking about the executable, not about object files.  Windows
object files are in the COFF format (sometimes the source calls it "pei",
but I think it's a variant of COFF).

Note that you cannot use GNU ld to create a relocatable Windows binary.
GNU ld can only output relocations during the final link in ELF files.
See "--emit-relocs" in ld.texinfo.

The linkers from lcc-win32 and RSXNT can create relocations.  RSXNT is now
under GPL, including the linker, so I hoped to port this support to GNU
ld.

My plan was to fix objdump to print relocations as the first step of
getting familiar with GNU binutils and the issues involved.

Then I found that objdump can already dump PE relocations, it just treats
them as "private" information.  So the intent of my question was if there
is any fundamental reason for that, or it's something that can and should
be fixed.

-- 
Regards,
Pavel Roskin



More information about the Binutils mailing list