This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

Re: [opensuse-mingw] RFH: Strange mingw behaviour


On Fri, Mar 11, 2016 at 10:50:50AM +0000, Nick Clifton wrote:
> > ld still produces executables showing the same error.
> 
> > It looks like, ld is removing the .rdata + .rdata$zzz section:
> > /tmp/binutils-gdb/inst/usr/local/bin/x86_64-w64-mingw32-ld: Removing unused section '.rdata' in file '/tmp/ccmBHoSC.o'
> > /tmp/binutils-gdb/inst/usr/local/bin/x86_64-w64-mingw32-ld: Removing unused section '.rdata$zzz' in file '/tmp/ccmBHoSC.o'
> 
> Is this wrong ?  Ie why should these sections be retained ?  
> 
> Presumably the linker has not found any relocations that point into
> these sections, so it deduces that they are not needed and discards
> them.

The problem is, that the symbols of deleted sections are still exported:
=====
d1a.dll:     file format pei-x86-64

Export Address Table -- Ordinal Base 1
        [   0] +base[   1] 94880000 Export RVA

[Ordinal/Name Pointer] Table
        [   0] testval

SYMBOL TABLE:
[1023](sec  0)(fl 0x00)(ty   0)(scl 106) (nx 0) 0x0000000000000000 testval
====

or in the import library:
====
SYMBOL TABLE:
[  0](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 0) 0x0000000000000000 .text
[  1](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 0) 0x0000000000000000 .idata$7
[  2](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 0) 0x0000000000000000 .idata$5
[  3](sec  4)(fl 0x00)(ty   0)(scl   3) (nx 0) 0x0000000000000000 .idata$4
[  4](sec  5)(fl 0x00)(ty   0)(scl   3) (nx 0) 0x0000000000000000 .idata$6
[  5](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp_testval
[  6](sec  5)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __nm_testval
[  7](sec  0)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _head_d1a_dll


Contents of section .idata$7:
 0000 00000000                             ....            
Contents of section .idata$5:
 0000 00000000 00000000                    ........        
Contents of section .idata$4:
 0000 00000000 00000000                    ........        
Contents of section .idata$6:
 0000 00007465 73747661 6c000000           ..testval...    
====

I can't answer, if ld should delete/or keep that sections, but it should not export
deleted symbols with bogus values.

Regards,
Martin


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