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 8 Jul 2010, at 17:14, Richard Henderson wrote:


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.

I'm sure it's confusion on my part - but :


__emutls_v.a
has size and align fields which cannot be 0.

so, either it should not be placed into .lcomm (I infer this is probably the case from your response), or these fields must be initialized by the emutls_register_common hook.

Iain




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