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]

pe-coff BFD breakage


The following BFD patch breaks pe-coff targets:

1999-08-05  Ian Lance Taylor  <ian@zembu.com>

        Based on patches from Donn Terry <donn@interix.com>:
        * coffcode.h (enum coff_symbol_classification): Define.
        (bfd_coff_backend_data): Rename _bfd_coff_sym_is_global to
        _bfd_coff_classify_symbol.  Change return type.
        (bfd_coff_classify_symbol): Rename from bfd_coff_sym_is_global.
        (coff_slurp_symbol_table): Use coff_classify_symbol.
        (coff_classify_symbol): New static function.
        (coff_sym_is_global): Never define.
        (bfd_coff_std_swap_table): Initialize with coff_classify_symbol.
        * cofflink.c (coff_link_check_ar_symbols): Use
        bfd_coff_classify_symbol rather than bfd_coff_sym_is_global.
        (coff_link_add_symbols): Likewise.
        (_bfd_coff_link_input_bfd): Likewise.
        * coff-sh.c (bfd_coff_small_swap_table): Initialize with
        coff_classify_symbol.
        * libcoff.h: Rebuild.

If I revert this, I can get the current CVS tree to build executables.
Otherwise, windows won't load the executables.

I'm appending the objump -p on hello world cygwin applications. The
pe header bits are ok, but import tables (whatever they're called
in PE parlance) are messed up.

If cvs update to -D 1999-08-05, everything is fine; 1999-08-06 goes bad.

GOOD
====
foo.exe:     file format pei-i386

Characteristics 0x107
	relocations stripped
	executable
	line numbers stripped
	32 bit words

ImageBase		00400000
SectionAlignment	00001000
FileAlignment		00000200
MajorOSystemVersion	4
MinorOSystemVersion	0
MajorImageVersion	1
MinorImageVersion	0
MajorSubsystemVersion	4
MinorSubsystemVersion	0
Reserved1		00000000
SizeOfImage		0004e000
SizeOfHeaders		00000400
CheckSum		00000000
Subsystem		00000003
DllCharacteristics	00000000
SizeOfStackReserve	02000000
SizeOfStackCommit	00001000
SizeOfHeapReserve	00100000
SizeOfHeapCommit	00001000
LoaderFlags		00000000
NumberOfRvaAndSizes	00000010

The Data Directory
Entry 0 00000000 00000000 Export Directory [.edata (or where ever we found it)]
Entry 1 00004000 00000174 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 00000000 00000000 Base Relocation Directory [.reloc]
Entry 6 00000000 00000000 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 00000000 00000000 Import Address Table Directory
Entry d 00000000 00000000 Reserved
Entry e 00000000 00000000 Reserved
Entry f 00000000 00000000 Reserved

The Import Tables (interpreted .idata section contents)
 vma:            Hint    Time      Forward  DLL       First
                 Table   Stamp     Chain    Name      Thunk
 00404000	00004040 00000000 00000000 00004154 00004074

	DLL Name: cygwin1.dll
	vma:  Hint/Ord Member-Name
	40a4	  459  calloc
	40b0	  525  dll_crt0__FP11per_process
	40cc	  526  dll_dllcrt0
	40dc	  528  dll_noncygwin_dllcrt0
	40f4	  588  free
	40fc	    7  __main
	4108	  714  malloc
	4114	  771  realloc
	The Import Address Table is identical

 00404014	00004068 00000000 00000000 00004164 0000409c

	DLL Name: KERNEL32.dll
	vma:  Hint/Ord Member-Name
	4120	  290  GetModuleHandleA
	The Import Address Table is identical

 00404028	00000000 00000000 00000000 00000000 00000000

====================== END ==================================

BAD
===
foo.exe:     file format pei-i386

Characteristics 0x107
	relocations stripped
	executable
	line numbers stripped
	32 bit words

ImageBase		00400000
SectionAlignment	00001000
FileAlignment		00000200
MajorOSystemVersion	4
MinorOSystemVersion	0
MajorImageVersion	1
MinorImageVersion	0
MajorSubsystemVersion	4
MinorSubsystemVersion	0
Reserved1		00000000
SizeOfImage		0004e000
SizeOfHeaders		00000400
CheckSum		00000000
Subsystem		00000003
DllCharacteristics	00000000
SizeOfStackReserve	02000000
SizeOfStackCommit	00001000
SizeOfHeapReserve	00100000
SizeOfHeapCommit	00001000
LoaderFlags		00000000
NumberOfRvaAndSizes	00000010

The Data Directory
Entry 0 00000000 00000000 Export Directory [.edata (or where ever we found it)]
Entry 1 00004000 00000174 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 00000000 00000000 Base Relocation Directory [.reloc]
Entry 6 00000000 00000000 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 00000000 00000000 Import Address Table Directory
Entry d 00000000 00000000 Reserved
Entry e 00000000 00000000 Reserved
Entry f 00000000 00000000 Reserved

The Import Tables (interpreted .idata section contents)
 vma:            Hint    Time      Forward  DLL       First
                 Table   Stamp     Chain    Name      Thunk
 00404000	00004058 00000000 00000000 00004154 0000408c

	DLL Name: cygwin1.dll
	vma:  Hint/Ord Member-Name
	40fc	    7  __main
	40fc	    7  __main
	The Import Address Table is identical

 00404014	00004058 00000000 00000000 00004164 0000408c

	DLL Name: KERNEL32.dll
	vma:  Hint/Ord Member-Name
	40fc	    7  __main
	40fc	    7  __main
	The Import Address Table is identical

 00404028	00000000 00000000 00000000 00000000 00000000

====================== END ==================================

Regards,
Mumit


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