aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edelsohn <dje.gcc@gmail.com>2012-12-21 17:25:57 +0000
committerDavid Edelsohn <dje@gcc.gnu.org>2012-12-21 12:25:57 -0500
commit2d7b05000140db2ef7ef994559ca69b644cb2552 (patch)
treed7e15d93310c71b4b50fe76638218798e8d4132f
parent25743ba44ea969ce8dfcf9b89d246aedd4118a9c (diff)
downloadgcc-2d7b05000140db2ef7ef994559ca69b644cb2552.zip
gcc-2d7b05000140db2ef7ef994559ca69b644cb2552.tar.gz
gcc-2d7b05000140db2ef7ef994559ca69b644cb2552.tar.bz2
varasm.c (bss_initializer_p): Remove static.
* varasm.c (bss_initializer_p): Remove static. * output.h (bss_initializer_p): Declare. * xcoffout.c (xcoff_tbss_section_name): Define. * xcoffout.h (xcoff_tbss_section_name): Declare. * config/rs6000/xcoff.h (TARGET_ENCODE_SECTION_INFO): Define. (ASM_OUTPUT_TLS_COMMON): Merge strings. * config/rs6000/rs6000.c (tls_private_data_section): New. (output_toc): Only output CSECT decoration for TLS. Output appropriate CSECT for data or bss. (rs6000_xcoff_asm_init_sections) Define tls_private_data_section. (rs6000_xcoff_select_section): Handle TLS bss and private data. (rs6000_xcoff_file_start): Generate xcoff_tbss_section_name. (rs6000_xcoff_encode_section_info): Strip SYMBOL_FLAG_HAS_BLOCK_INFO from native TLS symbols. From-SVN: r194675
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/config/rs6000/rs6000.c70
-rw-r--r--gcc/config/rs6000/xcoff.h7
-rw-r--r--gcc/output.h2
-rw-r--r--gcc/varasm.c2
-rw-r--r--gcc/xcoffout.c1
-rw-r--r--gcc/xcoffout.h1
7 files changed, 89 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f0563db..e57a17b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,20 @@
+2012-12-21 David Edelsohn <dje.gcc@gmail.com>
+
+ * varasm.c (bss_initializer_p): Remove static.
+ * output.h (bss_initializer_p): Declare.
+ * xcoffout.c (xcoff_tbss_section_name): Define.
+ * xcoffout.h (xcoff_tbss_section_name): Declare.
+ * config/rs6000/xcoff.h (TARGET_ENCODE_SECTION_INFO): Define.
+ (ASM_OUTPUT_TLS_COMMON): Merge strings.
+ * config/rs6000/rs6000.c (tls_private_data_section): New.
+ (output_toc): Only output CSECT decoration for TLS.
+ Output appropriate CSECT for data or bss.
+ (rs6000_xcoff_asm_init_sections) Define tls_private_data_section.
+ (rs6000_xcoff_select_section): Handle TLS bss and private data.
+ (rs6000_xcoff_file_start): Generate xcoff_tbss_section_name.
+ (rs6000_xcoff_encode_section_info): Strip SYMBOL_FLAG_HAS_BLOCK_INFO
+ from native TLS symbols.
+
2012-12-21 Richard Biener <rguenther@suse.de>
PR rtl-optimization/52996
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index d25c63c..668566e 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -209,6 +209,7 @@ static short cached_can_issue_more;
static GTY(()) section *read_only_data_section;
static GTY(()) section *private_data_section;
static GTY(()) section *tls_data_section;
+static GTY(()) section *tls_private_data_section;
static GTY(()) section *read_only_private_data_section;
static GTY(()) section *sdata2_section;
static GTY(()) section *toc_section;
@@ -22316,23 +22317,33 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
output_addr_const (file, x);
#if HAVE_AS_TLS
- if (TARGET_XCOFF && GET_CODE (base) == SYMBOL_REF)
+ if (TARGET_XCOFF && GET_CODE (base) == SYMBOL_REF
+ && SYMBOL_REF_TLS_MODEL (base) != 0)
{
+ tree decl = SYMBOL_REF_DECL (base);
+ if (bss_initializer_p (decl))
+ fputs ("[UL]", file);
+ else
+ fputs ("[TL]", file);
+
if (SYMBOL_REF_TLS_MODEL (base) == TLS_MODEL_LOCAL_EXEC)
- fputs ("[TL]@le", file);
+ fputs ("@le", file);
else if (SYMBOL_REF_TLS_MODEL (base) == TLS_MODEL_INITIAL_EXEC)
- fputs ("[TL]@ie", file);
+ fputs ("@ie", file);
/* Use global-dynamic for local-dynamic. */
else if (SYMBOL_REF_TLS_MODEL (base) == TLS_MODEL_GLOBAL_DYNAMIC
|| SYMBOL_REF_TLS_MODEL (base) == TLS_MODEL_LOCAL_DYNAMIC)
{
- fputs ("[TL]\n", file);
+ putc ('\n', file);
(*targetm.asm_out.internal_label) (file, "LCM", labelno);
fputs ("\t.tc .", file);
RS6000_OUTPUT_BASENAME (file, name);
fputs ("[TC],", file);
output_addr_const (file, x);
- fputs ("[TL]@m", file);
+ if (TREE_PUBLIC (SYMBOL_REF_DECL (base)))
+ fputs ("[TL]@m", file);
+ else
+ fputs ("[UL]@m", file);
}
}
#endif
@@ -25705,6 +25716,11 @@ rs6000_xcoff_asm_init_sections (void)
rs6000_xcoff_output_tls_section_asm_op,
&xcoff_tls_data_section_name);
+ tls_private_data_section
+ = get_unnamed_section (SECTION_TLS,
+ rs6000_xcoff_output_tls_section_asm_op,
+ &xcoff_private_data_section_name);
+
read_only_private_data_section
= get_unnamed_section (0, rs6000_xcoff_output_readonly_section_asm_op,
&xcoff_private_data_section_name);
@@ -25758,7 +25774,18 @@ rs6000_xcoff_select_section (tree decl, int reloc,
{
#if HAVE_AS_TLS
if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl))
- return tls_data_section;
+ {
+ if (TREE_PUBLIC (decl))
+ return tls_data_section;
+ else if (bss_initializer_p (decl))
+ {
+ /* Convert to COMMON to emit in BSS. */
+ DECL_COMMON (decl) = 1;
+ return tls_comm_section;
+ }
+ else
+ return tls_private_data_section;
+ }
else
#endif
if (TREE_PUBLIC (decl))
@@ -25857,10 +25884,12 @@ rs6000_xcoff_file_start (void)
main_input_filename, ".bss_");
rs6000_gen_section_name (&xcoff_private_data_section_name,
main_input_filename, ".rw_");
- rs6000_gen_section_name (&xcoff_tls_data_section_name,
- main_input_filename, ".tls_");
rs6000_gen_section_name (&xcoff_read_only_section_name,
main_input_filename, ".ro_");
+ rs6000_gen_section_name (&xcoff_tls_data_section_name,
+ main_input_filename, ".tls_");
+ rs6000_gen_section_name (&xcoff_tbss_section_name,
+ main_input_filename, ".tbss_[UL]");
fputs ("\t.file\t", asm_out_file);
output_quoted_string (asm_out_file, main_input_filename);
@@ -25886,6 +25915,31 @@ rs6000_xcoff_file_end (void)
? "\t.long _section_.text\n" : "\t.llong _section_.text\n",
asm_out_file);
}
+
+#ifdef HAVE_AS_TLS
+static void
+rs6000_xcoff_encode_section_info (tree decl, rtx rtl, int first)
+{
+ rtx symbol;
+ int flags;
+
+ default_encode_section_info (decl, rtl, first);
+
+ /* Careful not to prod global register variables. */
+ if (!MEM_P (rtl))
+ return;
+ symbol = XEXP (rtl, 0);
+ if (GET_CODE (symbol) != SYMBOL_REF)
+ return;
+
+ flags = SYMBOL_REF_FLAGS (symbol);
+
+ if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl))
+ flags &= ~SYMBOL_FLAG_HAS_BLOCK_INFO;
+
+ SYMBOL_REF_FLAGS (symbol) = flags;
+}
+#endif /* HAVE_AS_TLS */
#endif /* TARGET_XCOFF */
/* Compute a (partial) cost for rtx X. Return true if the complete
diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h
index 15f8bbf..4c12e1f 100644
--- a/gcc/config/rs6000/xcoff.h
+++ b/gcc/config/rs6000/xcoff.h
@@ -98,6 +98,9 @@
#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
#define TARGET_STRIP_NAME_ENCODING rs6000_xcoff_strip_name_encoding
#define TARGET_SECTION_TYPE_FLAGS rs6000_xcoff_section_type_flags
+#ifdef HAVE_AS_TLS
+#define TARGET_ENCODE_SECTION_INFO rs6000_xcoff_encode_section_info
+#endif
/* FP save and restore routines. */
#define SAVE_FP_PREFIX "._savef"
@@ -308,8 +311,8 @@
#define ASM_OUTPUT_TLS_COMMON(FILE, DECL, NAME, SIZE) \
do { fputs(COMMON_ASM_OP, (FILE)); \
RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
- fputs("[UL]", (FILE)); \
- fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE)); \
+ fprintf ((FILE), "[UL],"HOST_WIDE_INT_PRINT_UNSIGNED"\n", \
+ (SIZE)); \
} while (0)
#endif
diff --git a/gcc/output.h b/gcc/output.h
index 3fb743a..bd5c3eb 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -556,6 +556,8 @@ extern void output_file_directive (FILE *, const char *);
extern unsigned int default_section_type_flags (tree, const char *, int);
extern bool have_global_bss_p (void);
+extern bool bss_initializer_p (const_tree);
+
extern void default_no_named_section (const char *, unsigned int, tree);
extern void default_elf_asm_named_section (const char *, unsigned int, tree);
extern enum section_category categorize_decl_for_section (const_tree, int);
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 53ebfbf..7d083fd 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -927,7 +927,7 @@ decode_reg_name (const char *name)
/* Return true if DECL's initializer is suitable for a BSS section. */
-static bool
+bool
bss_initializer_p (const_tree decl)
{
return (DECL_INITIAL (decl) == NULL
diff --git a/gcc/xcoffout.c b/gcc/xcoffout.c
index 457d34f..d073376 100644
--- a/gcc/xcoffout.c
+++ b/gcc/xcoffout.c
@@ -67,6 +67,7 @@ static const char *xcoff_current_function_file;
char *xcoff_bss_section_name;
char *xcoff_private_data_section_name;
char *xcoff_tls_data_section_name;
+char *xcoff_tbss_section_name;
char *xcoff_read_only_section_name;
/* Last source file name mentioned in a NOTE insn. */
diff --git a/gcc/xcoffout.h b/gcc/xcoffout.h
index 9a35e2d..1692279 100644
--- a/gcc/xcoffout.h
+++ b/gcc/xcoffout.h
@@ -127,6 +127,7 @@ extern const char *xcoff_current_include_file;
extern char *xcoff_bss_section_name;
extern char *xcoff_private_data_section_name;
extern char *xcoff_tls_data_section_name;
+extern char *xcoff_tbss_section_name;
extern char *xcoff_read_only_section_name;
/* Last source file name mentioned in a NOTE insn. */