Hello.

There is linkage problem with recent gcc 4.5 in MinGW configuration
build. Executables which are produced by gcc with default options set
treated as 'not a valid win32 application' by the system (Win2008 x64
server). After stripping with the 'strip' utility executables are
successfully ran. I suppose that problems in 'debug-xxx' sections
generated by the new gcc/linker.

I made the section dumps of the 'good' and 'bad' executable produced
by the gcc 4.4 and gcc 4.5 with the same options set. Here they are:

Section produced by gcc 4.4:
  0 .text         00009a2c  00401000  00401000  00000400  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA
  1 .data         00000040  0040b000  0040b000  0000a000  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .rdata        000017c0  0040c000  0040c000  0000a200  2**5
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .bss          00000b20  0040e000  0040e000  00000000  2**5
                  ALLOC
  4 .idata        0000051c  0040f000  0040f000  0000ba00  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  5 .debug_aranges 00000060  00410000  00410000  0000c000  2**3
                  CONTENTS, READONLY, DEBUGGING
  6 .debug_pubnames 00000076  00411000  00411000  0000c200  2**0
                  CONTENTS, READONLY, DEBUGGING
  7 .debug_info   00000d4d  00412000  00412000  0000c400  2**0
                  CONTENTS, READONLY, DEBUGGING
  8 .debug_abbrev 0000037c  00413000  00413000  0000d200  2**0
                  CONTENTS, READONLY, DEBUGGING
  9 .debug_line   00000316  00414000  00414000  0000d600  2**0
                  CONTENTS, READONLY, DEBUGGING
 10 .debug_frame  00000070  00415000  00415000  0000da00  2**2
                  CONTENTS, READONLY, DEBUGGING
 11 .debug_loc    00000539  00416000  00416000  0000dc00  2**0
                  CONTENTS, READONLY, DEBUGGING
 12 .debug_ranges 000000f8  00417000  00417000  0000e200  2**0
                  CONTENTS, READONLY, DEBUGGING


Sections produced by gcc 4.5:
Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .debug_pubtypes 0000017c  00000000  00000000  000003d0  2**0
                  CONTENTS, READONLY, DEBUGGING
  1 .text         00009a2c  00401000  00401000  00000600  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA
  2 .data         00000040  0040b000  0040b000  0000a200  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  3 .rdata        000017c0  0040c000  0040c000  0000a400  2**5
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .bss          00000b20  0040e000  0040e000  00000000  2**5
                  ALLOC
  5 .idata        0000051c  0040f000  0040f000  0000bc00  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  6 .debug_aranges 000000e0  00410000  00410000  0000c200  2**3
                  CONTENTS, READONLY, DEBUGGING
  7 .debug_pubnames 00000317  00411000  00411000  0000c400  2**0
                  CONTENTS, READONLY, DEBUGGING
  8 .debug_info   00002b04  00412000  00412000  0000c800  2**0
                  CONTENTS, READONLY, DEBUGGING
  9 .debug_abbrev 000008e2  00415000  00415000  0000f400  2**0
                  CONTENTS, READONLY, DEBUGGING
 10 .debug_line   00000882  00416000  00416000  0000fe00  2**0
                  CONTENTS, READONLY, DEBUGGING
 11 .debug_frame  000005f0  00417000  00417000  00010800  2**2
                  CONTENTS, READONLY, DEBUGGING
 12 .debug_str    0000007a  00418000  00418000  00010e00  2**0
                  CONTENTS, READONLY, DEBUGGING
 13 .debug_loc    00001e11  00419000  00419000  00011000  2**0
                  CONTENTS, READONLY, DEBUGGING
 14 .debug_ranges 00000198  0041b000  0041b000  00013000  2**0
                  CONTENTS, READONLY, DEBUGGING

As you can see there is two new debug sections ('.debug_pubtypes' and
'.debug_str') and .debug_pubtypes is the first section in the
executable.

gcc build configured with following options:
--prefix=/mingw-4.5 --host=mingw32 --target=mingw32 --program-prefix= 
--with-as=/mingw/bin/as.exe --with-ld=/mingw/bin/ld.exe --with-gcc 
--with-gnu-ld --with-gnu-as --enable-threads --disable-nls 
--enable-languages=c,c++ --disable-win32-registry --disable-shared --without-x 
--enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug 
--with-gmp-include=/projects/common/GMP/4.3.1 
--with-gmp-lib=/projects/common/GMP/4.3.1/.libs 
--with-mpfr-include=/projects/common/MPFR/2.4.1 
--with-mpfr-lib=/projects/common/MPFR/2.4.1/.libs --enable-bootstrap

Because of I'm not a specialist in compilers and linkers so I can't
fix this problem by myself.

-- 
Best Regards,
 Sergey                          mailto:flex_fer...@artberg.ru



Reply via email to