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, updated] Make emulated TLS lto-friendly.


On 07/08/2010 01:42 AM, IainS wrote:
>> Huh?  Why is DECL_COMMON not sufficient?
> 
> int foo (void)
> {
>   static __thread int a;
>   return a;
> }
> 
> places __emutls_v.a.1700  in .lcomm and therefore needs an initializer,
> but the decl is not marked DECL_COMMON.
> do you believe that indicates a bug elsewhere, or is it a reasonable
> explanation?

The purpose of __emutls_register_common is to merge COMMON block sizes,
as would normally be done in the linker.  The variable A is not a COMMON
variable (as you note by DECL_COMMON not being set).  No initialization
is needed.

You've simply been confused about .lcomm for zero-initialization of the
control variable and true COMMON block variables.


r~


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