This is the mail archive of the gas2@sourceware.cygnus.com mailing list for the gas2 project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Under DJGPP 1.12 with G++ 2.6.0, I experience the following problem
when using filename extension .cpp instead of .cc. The assembler
output contains the incorrect ".file" heading. Included here is an
intentional link-time error to illustrate that ld then
reports the wrong filename.
--------------------- main.cpp ------------------------------
int main()
{
int i;
for (i = 0; i < 55; i++)
my_function(i);
}
------------------- output of 'gcc main.cpp -o main -g -v' --------
Reading specs from d:/gcc/lib/specs
gcc version 2.6.0
d:/gcc/bin/cpp.exe -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2
-D__cplusplus -D__GNUC_MINOR__=6 -Dunix -Di386 -DGO32 -DMSDOS -D__unix__
-D__i386__ -D__GO32__ -D__MSDOS__ -D__unix -D__i386 -D__GO32 -D__MSDOS -g
main.cpp f:/cc000073
GNU CPP version 2.6.0 (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
d:/gcc/cplusinc
d:/gcc/include
/usr/local/lib/g++-include
/usr/local/include
/usr/local/go32/include
/usr/local/lib/gcc-lib/go32/2.6.0/include
/usr/include
End of search list.
d:/gcc/bin/cc1plus.exe f:/cc000073 -quiet -dumpbase main.cc -g -version
-o f:/cca00073
GNU C++ version 2.6.0 (80386, BSD syntax) compiled by GNU C version 2.6.0.
main.cpp: In function `int main()':
main.cpp:7: warning: implicit declaration of function `int my_function(...)'
d:/gcc/bin/as.exe -o f:/ccb00073 f:/cca00073
d:/gcc/bin/ld.exe -o main d:/gcc/lib/crt0.o -Ld:/gcc/lib f:/ccb00073
-lgcc -lg -lc -lgcc
main.cc:7: main: undefined reference to `my_function'
^^^^^
This is incorrect!
--------------------------------------------------------------------------
Running 'gcc main.cpp -g -v -S -o main.s', we get the file main.s:
-------------------------------------------------------------------------
.file "main.cc"
gcc2_compiled.:
___gnu_compiled_cplusplus:
.text
.align 2
.def _main; .val _main; .scl 2; .type 044; .endef
.globl _main
_main:
pushl %ebp
movl %esp,%ebp
subl $4,%esp
.def .bf; .val .; .scl 101; .line 3; .endef
call ___main
.def _i; .val -4; .scl 1; .type 04; .endef
.ln 4
movl $0,-4(%ebp)
L2:
.def .bb; .val .; .scl 100; .line 4; .endef
cmpl $54,-4(%ebp)
jle L5
jmp L3
.align 2,0x90
L5:
.ln 5
pushl -4(%ebp)
call _my_function
addl $4,%esp
.def .eb; .val .; .scl 100; .line 5; .endef
L4:
incl -4(%ebp)
jmp L2
.align 2,0x90
L3:
xorl %eax,%eax
jmp L1
.align 2,0x90
jmp L1
.align 2,0x90
.ln 7
L1:
.def .ef; .val .; .scl 101; .line 7; .endef
leave
ret
.def _main; .val .; .scl -1; .endef
----------------------------------------------------------------------------
Thus the '.file' is incorrect in the assembler output.
----------------------------------------------------------------------------
Thanks,
Gordon Hogenson