This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH]: Fix PR42854 so weak linking works again on darwin
On Sun, Feb 14, 2010 at 11:00:20AM +0100, Jakub Jelinek wrote:
> On Sat, Feb 13, 2010 at 09:08:09PM -0500, Jack Howarth wrote:
> > 2010-02-13 Jack Howarth <firstname.lastname@example.org>
> > PR 42854
> > * gcc/varasm.c: (declare_weak): Don't add weak attribute to
> > decl if OBJECT_FORMAT_MACHO.
> > (assemble_external): Don't restrict adding decls those with weak
> > attribute if OBJECT_FORMAT_MACHO.
> This is a wrong. IMNSHO you want to drop the lookup_attribute (, "weak")
> tests in code related to weak_import inside of the darwin backend, instead
> of this gross hack.
I think it is pretty clear from the code from the machopic_select_section()
routine in gcc/config/darwin.c...
bool weak = (DECL_P (decl)
&& DECL_WEAK (decl)
&& (lookup_attribute ("weak", DECL_ATTRIBUTES (decl))
|| ! lookup_attribute ("weak_import",
that Apple's definition of weak_import is not supposed to be marked
as weak to function properly with the darwin linker. Again, I don't
understand why darwin must have r155919 enforced on it when our
target has never suffered from the bug that required it. It may be
that the handling of weak/weak_import in darwin.h/darwin.c makes
us immune to that issue.