schmidt@GLACIER.ICS.UCI.EDU ("Douglas C. Schmidt") (03/27/89)
Consider the following test program:
----------------------------------------
main ()
{
printf ("hello world\n");
}
----------------------------------------
When compiled with the -a and -p options on a Sun 4/260 running
Sun OS 4.0, the following occurs:
----------------------------------------
gcc version 1.34
/usr/public/lib/gnu/gcc-cpp -v -undef -D__GNUC__ -Dsparc -Dsun -Dunix
-D__sparc__ -D__sun__ -D__unix__ test.c /tmp/cca28201.cpp
GNU CPP version 1.34
/usr/public/lib/gnu/gcc-cc1 /tmp/cca28201.cpp -quiet -dumpbase test.c
-a -version -p -o /tmp/cca28201.s
GNU C version 1.34 (sparc) compiled by GNU C version 1.33.9.
as /tmp/cca28201.s -o test.o
as: "/tmp/cca28201.s", line 28: error: redefinition of symbol "LPB0"
----------------------------------------
Here's the asm:
----------------------------------------
gcc_compiled.:
.text
LC0:
.ascii "hello world\12\0"
.align 4
.global _main
.proc 1
_main:
!#PROLOGUE# 0
save %sp,-112,%sp
!#PROLOGUE# 1
sethi %hi(LPBX0),%o0
ld [%lo(LPBX0)+%o0],%o1
tst %o1
bne LPB0
nop
call ___bb_init_func
nop
LPB0:
.data
.align 4
LP0:
.word 0
.text
sethi %hi(LP0),%o0
call mcount
or %lo(LP0),%o0,%o0
LPB0:
sethi %hi(LPBX2+0),%g1
ld [%lo(LPBX2+0)+%g1],%g2
add %g2,1,%g2
st %g2,[%lo(LPBX2+0)+%g1]
sethi %hi(LC0),%o0
or %lo(LC0),%o0,%o0
call _printf,0
nop
L1:
ret
restore
.data
.align 4
LPBX0:
.word 0
.word LPBX1
.word LPBX2
.word 1
.word 0
.word LPBX3
LPBX1:
.ascii "test.c\0"
LPBX2:
.skip 4
.text
LPBX3:
.word LPB0
.word LPBX3
----------------------------------------
Doug