I am having a MinGW compiler setup in windows. and having project setup where some third party *.a files are directly copied from Linux machine.
Tried compiling a simple C program and when I look into the symbol table of *.o file, it has leading underscore for all the symbol names.
Example program :
int main(int argc, char** argv)
{
int xyz=0;
printf("I am Here\n");
}
SymbolTable entry:
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000040 00000000 00000000 0000008c 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
1 .data 00000000 00000000 00000000 00000000 2**2
ALLOC, LOAD, DATA
2 .bss 00000000 00000000 00000000 00000000 2**2
ALLOC
SYMBOL TABLE:
[ 0](sec -2)(fl 0x00)(ty 0)(scl 103) (nx 1) 0x00000000 abcd01.c
File
[ 2](sec 1)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x0000000b **_main**
[ 3](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .text
AUX scnlen 0x3e nreloc 4 nlnno 0
[ 5](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .data
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 7](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .bss
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 9](sec 0)(fl 0x00)(ty 20)(scl 2) (nx 1) 0x00000000 ___main
AUX tagndx 0 ttlsiz 0x0 lnnos 0 next 0
[ 11](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 __alloca
[ 12](sec 0)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 **_printf**
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
00000020 DISP32 __alloca
00000025 DISP32 ___main
00000033 dir32 .text
00000038 DISP32 **_printf**
Here even base C functions are prepended with underscore.
Tried using -fno-leading-underscore, but no use.
MingW version:
$ gcc -v Reading specs from C:/PROGRA~1/GNUCFO~1//ncbin/../lib/gcc-lib/i386-pc-mks/3.3.1/ specs Configured with: configure --prefix=/usr/gnu i386-pc-mks --enable-languages=c,c+ + --disable-nls --disable-shared --enable-sjlj-exceptions --enable-threads --dis able-win32-registry Thread model: win32 gcc version 3.3.1 (mingw special 20030804-1)