Subject: Linking gcc and msvc objects
From: [email-masked] (Sergey Okhapkin)

26 Nov 1997 21:49:43 -0800
Message-ID: <[email-masked]>
To: "'Geoffrey Noer'" <[email-masked]>
Cc: "'Gnu-Win32'" <[email-masked]>

Hi!

It's not possible to link together gcc and msvc compiled object files - ld 
complains:

h:\usr\src\bsc>gcc -o demangle.exe demangle.c BSC.LIB
ld: BSC.LIB(objnt/mbrdecor.obj): warning: ignoring duplicate section 
`.text'
ld: BSC.LIB(objnt/mbrdecor.obj): warning: ignoring duplicate section 
`.text'
ld: BSC.LIB(objnt/mbrdecor.obj): warning: ignoring duplicate section 
`.text'
....

I tried to compile single file with both gcc and msvc, the differences 
present:

h:\usr\src\bsc>objdump --section-headers demangle.obj

demangle.obj:     file format pe-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .drectve      00000026  00000000  00000000  00000064  2**0
                  CONTENTS, DEBUGGING, EXCLUDE
  1 .text         0000003a  00000000  00000000  0000008a  2**4
                  CONTENTS, ALLOC, LOAD, RELOC, CODE

h:\usr\src\bsc>objdump --section-headers demangle.o

demangle.o:     file format pe-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000050  00000000  00000000  0000008c  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, CODE
  1 .data         00000000  00000000  00000000  00000000  2**2
                  ALLOC, LOAD, DATA
  2 .bss          00000000  00000000  00000000  00000000  2**2
                  ALLOC

The .text section have the same attributes, but the alignment differs - 
2**2 for gcc and 2**4 for msvc-compiled object. Probably, if gnu tools will 
set the proper alignment, it will be posiible to build an application from 
gcc-compiled objects and msvc-compiled libraries. What do you think about?

--
Sergey Okhapkin, http://www.lexa.ru/sos
Moscow, Russia
Looking for a job.

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".