This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
other/9682: unclear assembler/linker behaviour
- From: bas at equator dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 13 Feb 2003 00:14:41 -0000
- Subject: other/9682: unclear assembler/linker behaviour
- Reply-to: bas at equator dot com
>Number: 9682
>Category: other
>Synopsis: unclear assembler/linker behaviour
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Feb 13 00:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: bas aarts
>Release: unknown-1.0
>Organization:
>Environment:
bas@marilyn:~/public > gcc --version
gcc (GCC) 3.2.1
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
bas@marilyn:~/public > uname -a
Linux marilyn.cam.equator.com 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
>Description:
bas@marilyn:~/public > cat attr1.c
int a; extern int h __attribute__ ((alias ("a")));
bas@marilyn:~/public > cat attr2.c
extern int h; int main(void){return h;}
bas@marilyn:~/public > gcc -save-temps attr1.c attr2.c
attr2.o: In function `main':
attr2.o(.text+0x11): undefined reference to `h'
collect2: ld returned 1 exit status
I don't know why I have a missing symbol here
2 cases:
1) when in attr1.c, initializing a (so that its not a common anymore),
it links fine
2) when in attr1.s, the
.set h,a
.comm a,4,4
are interchanged into
.comm a,4,4
.set h,a
bas@marilyn:~/public > gcc -save-temps attr1.s attr2.c -nostdlib
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 08048074
bas@marilyn:~/public > nm a.out
0804908c A __bss_start
0804908c A _edata
08049094 A _end
08049090 B a
0804908c B h
08048074 T main
now a and h are two distinct symbols!
What is the semantics of the .set directive?
>How-To-Repeat:
see above
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: