Miscompilation of glibc with CVS mainline

John David Anglin dave@hiauly1.hia.nrc.ca
Fri Jan 3 01:02:00 GMT 2003


> 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)



More information about the Libc-alpha mailing list