This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [opensuse-mingw] RFH: Strange mingw behaviour
- From: Martin Koegler <martin dot koegler at chello dot at>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: Martin Koegler <martin dot koegler at chello dot at>, binutils at sourceware dot org, opensuse-mingw at opensuse dot org
- Date: Fri, 11 Mar 2016 19:49:53 +0100
- Subject: Re: [opensuse-mingw] RFH: Strange mingw behaviour
- Authentication-results: sourceware.org; auth=none
- References: <20160307194610 dot GA11986 at mail dot zuhause> <20160309212756 dot GA21220 at mail dot zuhause> <56E17FE9 dot 2070602 at redhat dot com> <20160310214948 dot GA24855 at mail dot zuhause> <56E2A30A dot 2030501 at redhat dot com>
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