On 05/13/2011 03:03 AM, Rong Xu wrote:
* gcc/coverage.c (revision 173717): set a flag if building for Linux kernel. * gcc/tree-profile.c (revision 173717): don't emit TLS declarations for Linux kernel builds.
I think this should be done without touching at all the profiling machinery in GCC.
1) add a new TLS model -ftls-model=none and make the kernel uses it. The model would simply force targetm.have_tls to false.
2) as Richi mentioned, gcov-io and libgcov changes then can move to the kernel, and GCC needs no change at all here.
BTW, these parts of LIPO:
+ if (!is_kernel_build) + DECL_TLS_MODEL (dc_gcov_type_ptr_var) = + decl_default_tls_model (dc_gcov_type_ptr_var); dc_void_ptr_var = build_decl (UNKNOWN_LOCATION, VAR_DECL, @@ -1488,8 +1493,9 @@ ptr_void); DECL_ARTIFICIAL (dc_void_ptr_var) = 1; DECL_EXTERNAL (dc_void_ptr_var) = 1; - DECL_TLS_MODEL (dc_void_ptr_var) = - decl_default_tls_model (dc_void_ptr_var); + if (!is_kernel_build) + DECL_TLS_MODEL (dc_void_ptr_var) = + decl_default_tls_model (dc_void_ptr_var);
Probably are missing a !targetm.have_tls. Paolo