This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
".globl" symbol
- From: Mr Steven Mark <steven_mark_99 at yahoo dot com>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 29 Mar 2002 20:11:50 -0800 (PST)
- Subject: ".globl" symbol
Hi,
Please look at the following code:
test1.c test2.c
-------- --------
int s; int s = 4;
main() {}; main() {};
Please look at the assembly code generated in both
cases:
test1.c
--------------------------------------------------
.file "test1.c"
.version "01.01"
gcc2_compiled.:
.text
.p2align 2,0x90
.globl main
.type main,@function
main:
pushl %ebp
movl %esp,%ebp
.L2:
leave
ret
.Lfe1:
.size main,.Lfe1-main
.comm s,4,4
.ident "[ASM_FILE_END]GCC: (c) 2.95.219991024
(release)"
-----------------------------------------------------
test2.s
-----------------------------------------------------
.file "test2.c"
.version "01.01"
gcc2_compiled.:
.globl s <======= PLEASE NOTE
.data
.p2align 2
.type s,@object
.size s,4
s:
.long 4
.text
.p2align 2,0x90
.globl main
.type main,@function
main:
pushl %ebp
movl %esp,%ebp
.L2:
leave
ret
.Lfe1:
.size main,.Lfe1-main
.ident "[ASM_FILE_END]GCC: (c) 2.95.2
19991024 (release)"
----------------------------------------------------
My question is that why in second case "s" is being
declared as a ".globl" and in first case not?
I am using gcc version 2.95.2. I am running the
programs on a i386 machine running FreeBsd 4.0
thanks,
Steve
__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - send holiday greetings for Easter, Passover
http://greetings.yahoo.com/