This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: bfd/peigen.c problems and fix


On Wed, 3 May 2000, Donn Terry wrote:

> In looking at an objdump -p of a MSVC-generated a.out (yes... on Interix
> that statement makes sense) the data offset column for the Data Directory
> contains values which do NOT contain the value of ImageBase (that is they
> are RVAs).  The change you propose would change them into absolute VAs
> (unless theres additional magic I'm not seeing.  Here's a cut of what I get
> (from MSVC/LINK.EXE generated code):
> 
> Entry 0 00000000 00000000 Export Directory [.edata (or where ever we found
> it)]
> Entry 1 00012000 00000028 Import Directory [parts of .idata]
> Entry 2 00000000 00000000 Resource Directory [.rsrc]
> Entry 3 00000000 00000000 Exception Directory [.pdata]
> Entry 4 00000000 00000000 Security Directory
> Entry 5 00013000 00000594 Base Relocation Directory [.reloc]
> Entry 6 0000f020 00000054 Debug Directory
> Entry 7 00000000 00000000 Description Directory
> Entry 8 00000000 00000000 Special Directory
> Entry 9 00000000 00000000 Thread Storage Directory [.tls]
> Entry a 00000000 00000000 Load Configuration Directory
> Entry b 00000000 00000000 Bound Import Directory
> Entry c 000120a4 0000007c Import Address Table Directory
> Entry d 00000000 00000000 Reserved
> Entry e 00000000 00000000 Reserved
> Entry f 00000000 00000000 Reserved
>            ^
>            This column
> 
> If I understand the "add_data_entry" part of your proposed change
> correctly, it would have the effect of adding 0x400000 (in effect) to every
> value in "This column" above. For maximal MS compatability, that's wrong.

Actually, my change does just the opposite of what you're saying.  (How
long have you been working at Microsoft?  Grin)  The current code has the
0x400000 added in because section->vma is set to 0x40xxxx.  Subtracting
off ImageBase turns what was an absolute address back into a relative one.

> (I
> believe things "work" with ImageBase added in, in most instances, however

The report I had from Martin Kahlert, was that this isn't so.  He was
testing on WinNT.  My few experiments using "objdump -p" were with .exe
files from Windows 95.

Incidentally, why this change too?
1999-09-06  Donn Terry  <donn@interix.com>
	* coffcode.h
	(coff_write_object_contents): Don't set F_AR32W(R)? if
	COFF_WITH_PE.

The Windows95 exe files I looked at all had this flag set.

-- 
Linuxcare.  Support for the Revolution.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]