delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/11/26/21:49:43

From: sos AT prospect DOT com DOT ru (Sergey Okhapkin)
Subject: Linking gcc and msvc objects
26 Nov 1997 21:49:43 -0800 :
Message-ID: <01BCFA7E.876E7E40.cygnus.gnu-win32@gater.krystalbank.msk.ru>
To: "'Geoffrey Noer'" <noer AT cygnus DOT com>
Cc: "'Gnu-Win32'" <gnu-win32 AT cygnus DOT com>

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
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019