c/6799: #pragma weak no longer works<synopsis of the problem (one line)>
j.w.c.a. lokin
janwillem.lokin@nl.thalesgroup.com
Fri May 24 05:56:00 GMT 2002
>Number: 6799
>Category: c
>Synopsis: #pragma weak no longer works
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Fri May 24 05:56:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Jan Willem Lokin
>Release: 3.1
>Organization:
Thales Nederland BV
>Environment:
System: SunOS sunc1185 5.6 Generic_105181-16 sun4u sparc SUNW,Ultra-60
Architecture: sun4
host: sparc-sun-solaris2.6
build: sparc-sun-solaris2.6
target: sparc-sun-solaris2.6
configured with: ../configure --prefix=/home/db693/tstgnu
>Description:
Prior versions of gcc used to generate the appropriate weak
symbol `main' for the following code snippet:
>How-To-Repeat:
in a file weak.c:
static int spliced_main (int argc, char **argv)
{
return 1;
}
#pragma weak main = sp_spliced_main
int sp_spliced_main (int argc, char **argv)
{
return spliced_main (argc, argv);
}
EOF
compile with:
gcc weak.c -o weak
Undefined first referenced
symbol in file
main /home/db693/tstgnu/lib/gcc-lib/sparc-sun-solaris2.6/3.1/crt1.o
ld: fatal: Symbol referencing errors. No output written to weak
collect2: ld returned 1 exit status
>Fix:
Probably could use `weak' attribute?
(this email must mandatorily contain the word Unclassified)
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list