Mail Archives: cygwin/2001/08/26/01:12:31
Confirmed bug. (using the same example posted in the original report)
the auto-import stuff is ignoring the "+12" in this asm statement:
movb $33,_hwstr1+12
The .o file (disassembled) shows:
hello.o: file format pe-i386
Disassembly of section .text:
00000000 <_main>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
6: e8 00 00 00 00 call b <_main+0xb>
b: c6 05 0c 00 00 00 21 movb $0x21,0xc
12: c7 45 fc 00 00 00 00 movl $0x0,0xfffffffc(%ebp)
19: 8b 45 fc mov 0xfffffffc(%ebp),%eax
1c: 83 c0 0a add $0xa,%eax
1f: c6 00 21 movb $0x21,(%eax)
22: 83 c4 f4 add $0xfffffff4,%esp
25: 68 00 00 00 00 push $0x0
2a: e8 00 00 00 00 call 2f <_main+0x2f>
2f: 83 c4 10 add $0x10,%esp
32: 83 c4 f4 add $0xfffffff4,%esp
35: 68 00 00 00 00 push $0x0
3a: e8 00 00 00 00 call 3f <_main+0x3f>
3f: 83 c4 10 add $0x10,%esp
42: 31 c0 xor %eax,%eax
44: eb 02 jmp 48 <_main+0x48>
46: 89 f6 mov %esi,%esi
48: 89 ec mov %ebp,%esp
4a: 5d pop %ebp
4b: c3 ret
And the .relocs section of hello.o sez:
hello.o: file format pe-i386
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
00000007 DISP32 ___main
0000000d dir32 _hwstr1
00000015 dir32 _hwstr2
00000026 dir32 _hwstr1
0000002b DISP32 _puts
00000036 dir32 _hwstr2
0000003b DISP32 _puts
RELOCATION RECORDS FOR [.stab]:
OFFSET TYPE VALUE
00000014 dir32 .text
00000020 dir32 .text
00000590 dir32 .text
00000644 dir32 .text
------------------------------------
so, what *should* happen is that in hello.o at offset 0x00d, the address
of _hwstr1 should be added to the current contents of 0x00d--0x010 (0c
00 00 00). What currently happens is that 0x00d--0x010 is simply
replaced by the address of _hwstr1 and the 0000000c is just thrown away.
Using --enable-extra-pe-debug when linking, I see this output (format is
<symbol>@<offset>: add=< arelent->addend >)
pe_find_data_imports:_hwstr1
->__head_cyghwstr_dll
arelent: _hwstr1 AT 0xd: add=0 <<<< this should be "add=12", right?
arelent: _hwstr1 AT 0x26: add=0
pe_find_data_imports:_hwstr2
->__head_cyghwstr_dll
arelent: _hwstr2 AT 0x15: add=0
arelent: _hwstr2 AT 0x36: add=0
Unfortunately, that's as far as I can go. I don't know where the
arelent structure gets filled with the approprate data from the .o, so I
can't track down WHY the "12" isn't going into (arelent)->addend.
Can anyone else shed some light, here?
--Chuck
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -