This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Miscompilation of glibc with CVS mainline
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: rth at twiddle dot net (Richard Henderson)
- Cc: prj at po dot cwru dot edu, gcc at gcc dot gnu dot org, libc-alpha at sources dot redhat dot com
- Date: Thu, 2 Jan 2003 20:02:18 -0500 (EST)
- Subject: Re: Miscompilation of glibc with CVS mainline
> On Thu, Jan 02, 2003 at 02:16:03PM -0500, John David Anglin wrote:
> > How can any specific code know whether a function pointer resolves to a weak
> > function or not when it is extern?
>
> By having it properly declared.
Isn't it possible for both a global define and weak defines to occur
when a program is linked without incuring an error in the system V ABI?
How do you properly declare a function in cases where the symbol binding
is not determined until runtime?
I think Ulrich has a point in questioning whether the optimization is
useful. Being able to track whether a function is weak or not at the
rtl level doesn't justify the change in gcc's behavior for gnu code.
Basically, the default in handling function pointers has changed from
gnu to iso c99. To get the old behavior users are now forced to use
something like gcc's TARGET_ATTRIBUTE_WEAK macro. A better approach
might have been to enable the optimization for c99 but leave the previous
treatment (all symbols assumed weak) for gnu code.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)