This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[RS6000] Fix PR 16343
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 27 Nov 2004 21:26:21 +1030
- Subject: [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 <a_fisch@gmx.de>
Alan Modra <amodra@bigpond.net.au>
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