This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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 <howarth@bromo.med.uc.edu>
> > 
> >         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.
> 
> 	Jakub

Jakub,
   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.
               Jack


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]