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: Thu, 10 Mar 2016 22:49:48 +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>
On Thu, Mar 10, 2016 at 02:08:41PM +0000, Nick Clifton wrote:
> >> I'm trying to debug a mingw crash. My program failed to start with a acess violation on Windows.
> >
> > It is the ld option --gc-sections:
>
> Take a look at these bug reports. They have patches that you can try out and see if they
> fix the problem...
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=19531
> https://sourceware.org/bugzilla/show_bug.cgi?id=19480
master (00dbd492e462565366a2691e0579b510ce4c3733) with both patches:
ld still produces executables showing the same error.
$ x86_64-w64-mingw32-objdump -xSd d1.o
d1.o: file format pe-x86-64
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000000 0000000000000000 0000000000000000 00000000 2**4
ALLOC, LOAD, READONLY, CODE
1 .data 00000000 0000000000000000 0000000000000000 00000000 2**4
ALLOC, LOAD, DATA
2 .bss 00000000 0000000000000000 0000000000000000 00000000 2**4
ALLOC
3 .rdata 00000010 0000000000000000 0000000000000000 000000dc 2**4
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .rdata$zzz 00000020 0000000000000000 0000000000000000 000000ec 2**4
CONTENTS, ALLOC, LOAD, READONLY, DATA
SYMBOL TABLE:
[ 0](sec -2)(fl 0x00)(ty 0)(scl 103) (nx 1) 0x0000000000000000 d1.cpp
File
[ 2](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x0000000000000000 .text
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 4](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x0000000000000000 .data
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 6](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x0000000000000000 .bss
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 8](sec 4)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x0000000000000000 .rdata
AUX scnlen 0x8 nreloc 0 nlnno 0
[ 10](sec 5)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x0000000000000000 .rdata$zzz
AUX scnlen 0x11 nreloc 0 nlnno 0
[ 12](sec 4)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x0000000000000000 testval
Contents of section .rdata:
0000 01000000 02000000 00000000 00000000 ................
Contents of section .rdata$zzz:
0000 4743433a 2028474e 55292035 2e332e30 GCC: (GNU) 5.3.0
0010 00000000 00000000 00000000 00000000 ................
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'
Regards,
Martin