[PATCH] Miscompilation of __attribute__((constructor)) functions.

Paul Brook paul@codesourcery.com
Mon Oct 31 15:51:00 GMT 2011


> Ok if you move the clearing to after
> 
>   /* Generate a new name for the new version. */
>   DECL_NAME (new_decl) = clone_function_name (old_decl, clone_name);
>   SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
>   SET_DECL_RTL (new_decl, NULL);
> 
> using new_decl directly, thus add
> 
>   /* When the old decl was a con-/destructor make sure the clone isn't.  */
>   DECL_STATIC_CONSTRUCTOR(new_decl) = 0;
>   DECL_STATIC_DESTRUCTOR(new_decl) = 0;

Done, and applied.

Paul



More information about the Gcc-patches mailing list