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][Revised]: Fix PR42854 so weak linking works again on darwin


On Sun, Feb 14, 2010 at 06:32:23PM -0500, Jack Howarth wrote:
>    Fix PR 42854, caused by revision 155919, by insuring that
> weak_finish_1 is called for weak_import. Bootstrapped without
> regressions on x86_64-apple-darwin10. Okay for gcc trunk and
> gcc 4.4.4?

This looks fine to me except the extra ()s around !lookup_attribute
in the first hunk and not fixed indentation of the next line, but
needs to be approved by a Darwin or GWP maintainer.

> 	PR 42854
> 	* gcc/darwin.h: (ASM_WEAKEN_DECL): Call weak_finish_1 for weak_import.
> 	* gcc/darwin.c: (machopic_select_section): Same.
> 
> Index: gcc/config/darwin.c
> ===================================================================
> --- gcc/config/darwin.c	(revision 156761)
> +++ gcc/config/darwin.c	(working copy)
> @@ -1177,8 +1177,7 @@
>  {
>    bool weak = (DECL_P (decl)
>  	       && DECL_WEAK (decl)
> -	       && (lookup_attribute ("weak", DECL_ATTRIBUTES (decl))
> -		   || ! lookup_attribute ("weak_import",
> +	       && (! lookup_attribute ("weak_import",
>  					  DECL_ATTRIBUTES (decl))));
>    section *base_section;
>  
> Index: gcc/config/darwin.h
> ===================================================================
> --- gcc/config/darwin.h	(revision 156761)
> +++ gcc/config/darwin.h	(working copy)
> @@ -502,8 +502,7 @@
>        targetm.asm_out.globalize_label (FILE, NAME);			\
>      if (DECL_EXTERNAL (DECL))						\
>        fputs ("\t.weak_reference ", FILE);				\
> -    else if (! lookup_attribute ("weak", DECL_ATTRIBUTES (DECL))	\
> -	&& lookup_attribute ("weak_import", DECL_ATTRIBUTES (DECL)))	\
> +    else if (lookup_attribute ("weak_import", DECL_ATTRIBUTES (DECL)))	\
>        break;								\
>      else if (TREE_PUBLIC (DECL))					\
>        fputs ("\t.weak_definition ", FILE);				\

	Jakub


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