This is the mail archive of the 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]

[RS6000] Fix PR 16343

This fixes linker errors on ABI violations for powerpc targets that
support a small data section.

Instead of the thread-local test here (which is also needed by other
targets with small data) we could change default_encode_section_info to

  if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl))
    flags |= decl_tls_model (decl) << SYMBOL_FLAG_TLS_SHIFT;
  else if (targetm.in_small_data_p (decl))
    flags |= SYMBOL_FLAG_SMALL;

This would be consistent with categorize_decl_for_section, which doesn't
allow thread-local in small data.

2004-11-27  Andreas Fischer <>
	    Alan Modra  <>

	PR target/16343
	* config/rs6000/rs6000.c (rs6000_elf_in_small_data_p): Disallow
	functions, strings and thread-local vars.

Bootstrap and regression test powerpc-linux in progress.  OK for
mainline and 3.4 branch?

diff -urp -xCVS -x'*~' gcc-virgin/gcc/config/rs6000/rs6000.c gcc-current/gcc/config/rs6000/rs6000.c
--- gcc-virgin/gcc/config/rs6000/rs6000.c	2004-11-27 11:30:01.513696539 +1030
+++ gcc-current/gcc/config/rs6000/rs6000.c	2004-11-27 19:20:10.092968434 +1030
@@ -17261,6 +17280,18 @@ rs6000_elf_in_small_data_p (tree decl)
   if (rs6000_sdata == SDATA_NONE)
     return false;
+  /* We want to merge strings, so we never consider them small data.  */
+  if (TREE_CODE (decl) == STRING_CST)
+    return false;
+  /* Functions are never in the small data area.  */
+  if (TREE_CODE (decl) == FUNCTION_DECL)
+    return false;
+  /* Thread-local vars can't go in the small data area.  */
+  if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl))
+    return false;
   if (TREE_CODE (decl) == VAR_DECL && DECL_SECTION_NAME (decl))
       const char *section = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));

Alan Modra
IBM OzLabs - Linux Technology Centre

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