This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: f build dies with: undefined reference to `lookup_name'
- From: Richard Henderson <rth at redhat dot com>
- To: David Edelsohn <dje at watson dot ibm dot com>
- Cc: Andrew Cagney <cagney at mac dot com>, Alan Modra <amodra at bigpond dot net dot au>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 6 Mar 2002 15:07:09 -0800
- Subject: Re: f build dies with: undefined reference to `lookup_name'
- References: <rth@redhat.com> <200203062239.RAA25372@makai.watson.ibm.com>
On Wed, Mar 06, 2002 at 05:39:05PM -0500, David Edelsohn wrote:
> That means weak_decls now needs to be global, but it is defined in
> varasm.c so we will not have any undefined symbols.
No, the *entire* processing of #pragma weak should be moved.
> Current weak_finish() is run at the end of the file, not each function.
Yeah, so? Means we'd properly get DECL_WEAK set asap.
Which in fact fixes a bug. Consider
#pragma weak a
int a;
int foo() { return a; }
int b __attribute__((weak));
int bar() { return b; }
Compiled on alpha-linux, with ./cc1 -O -fno-common,
foo:
ldah $1,a($29) !gprelhigh
ldl $0,a($1) !gprellow
ret $31,($26),1
bar:
ldq $1,b($29) !literal
ldl $0,0($1)
ret $31,($26),1
We've miscompiled foo. It should look like bar, since the weak
binding means that the variable may not be resolved within the
current module.
r~