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 01:27:03PM -0500, Jack Howarth wrote:
> 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",
> DECL_ATTRIBUTES (decl))));
> 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.
Either you want weak_finish_1 called for weak_import, then you need to drop
the lookup_attribute ("weak", ...) checks from both places in
config/darwin.[ch], or you don't want weak_finish_1 called, then darwin just
shouldn't call declare_weak in darwin_handle_weak_import_attribute.