This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR36955, TLS LIBCALL change breaks libstdc++
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 30 Jul 2008 10:57:50 +0930
- Subject: [PATCH] Fix PR36955, TLS LIBCALL change breaks libstdc++
-msecure-plt -fPIC/-fpic calls need the GOT register to be valid for
the PLT call stub. I chose to use the old scheme of adding a "use"
of the register at rtl generation rather than implementing a splitter
as in http://gcc.gnu.org/ml/gcc-patches/2008-06/msg01716.html since
there is no possibility of combine generating the tls_gd_sysv or
tls_ld_sysv patterns. Bootstrapped and regression tested
powerpc-linux.
PR target/36955
* config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Add
a use of pic_offset_table_rtx for -msecure-plt __tls_get_addr calls.
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 138226)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -3948,6 +3948,8 @@ rs6000_legitimize_tls_address (rtx addr,
insn = emit_call_insn (insn);
RTL_CONST_CALL_P (insn) = 1;
use_reg (&CALL_INSN_FUNCTION_USAGE (insn), r3);
+ if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT && flag_pic)
+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
insn = get_insns ();
end_sequence ();
emit_libcall_block (insn, dest, r3, addr);
@@ -3970,6 +3972,8 @@ rs6000_legitimize_tls_address (rtx addr,
insn = emit_call_insn (insn);
RTL_CONST_CALL_P (insn) = 1;
use_reg (&CALL_INSN_FUNCTION_USAGE (insn), r3);
+ if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT && flag_pic)
+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
insn = get_insns ();
end_sequence ();
tmp1 = gen_reg_rtx (Pmode);
--
Alan Modra
Australia Development Lab, IBM