[RFA:] PR37170, extern weak broken, like for gcc.dg/weak/weak-1.c
Hans-Peter Nilsson
hans-peter.nilsson@axis.com
Mon Aug 25 16:53:00 GMT 2008
> Date: Mon, 25 Aug 2008 14:48:56 +0100
> From: "Rafael Espindola" <espindola@google.com>
> > But, all of this seems just a hack anyway, and the
> > assemble_external calls should be only in the "expand" pass; not
> > in front-ends nor in the back-end (varasm.c, final.c). If you
> > could fix *that*, it'd be nice.
>
> I think I agree with Zack on this one:
> http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00491.html
That message is 3.5 years old and things have changed since
then. We no longer call expand before EOF; all declarations
have been seen at expand and, e.g. the "asm" part is folded into
whatever declaration expand sees.
(For the record, I think it'd be logical to the judge the
redeclare-with-asm-after-use in the PR as invalid, just as you
can't redefine an implicitly declared function to be static
after use. But I guess that's too late to change; too many
important users.)
> The best place to know if we need an external declaration is when we
> output an use of it.
Nah, the best place is before the target-specific things see it,
but after inlining and all calls having been optimized out.
Which is certain to have happened at time of expand; the logical
tollgate for target-specific actions such as what
assemble_external does.
> Doesn't the use of for_each_rtx solves your
> concern about playing target-specific tricks?
No, please see the PR for all relevant information. To wit, we
can't rely on output_operand to be a tollgate of all symbol
references from code. Proof: on Darwin output_operand doesn't
see the symbol_ref in question at -O0 (it creates some weird
file-local GOT and IIUC output_operand only sees offsets).
> I might be able to help remove some FE calls to assemble_external.
Thanks.
brgds, H-P
More information about the Gcc-patches
mailing list