This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] MIPS16 TLS support for GCC
Richard Sandiford <rdsandiford@googlemail.com> writes:
> "Maciej W. Rozycki" <macro@codesourcery.com> writes:
>>> If there's still some concern that __mips16_rdhwr might not have
>>> the right ABI, then maybe we should simply emit a link-once function
>>> in each object that needs it. We could then switch to another function
>>> (and another API) without having to keep the old one in libgcc.a for
>>> compatibility. It would also avoid the -shared-libgcc thing.
>>>
>>> Admittedly that's just an off-the-top-of-my-head idea. :-)
>>> What do you think?
>>
>> Actually I had that idea of a link-once function too, but it turned out
>> quite complicated to do without rewriting some generic parts of GCC as it
>> is currently not prepared to emit link-once functions outside C++
>> compilations. It's been a while and I did lots of other stuff meanwhile,
>> so please excuse me if I got anything wrong here.
>
> Hmm, OK, I wouldn't have expected that. But if you've tried making
> __mips16_rdhwr link-once and had a bad experience with it, then yeah,
> let's go with the hidden libgcc function. It's just a shame that we're
> having to force static linking of libgcc for this one case.
>
> I'll take the relevant parts from Chung-Lin's patch and test them
> over the weekend.
Here's what I committed after testing on mips64-linux-gnu, both with
and without PLTs.
Richard
libgcc/
2012-02-05 Chung-Lin Tang <cltang@codesourcery.com>
* config.host (mips64*-*-linux*, mipsisa64*-*-linux*, mips*-*-linux*):
Add t-slibgcc-libgcc to tmake_file.
* config/mips/libgcc-mips16.ver: Revert previous patch.
* config/mips/mips16.S (__mips16_rdhwr): Hide.
Index: libgcc/config.host
===================================================================
--- libgcc/config.host 2012-02-04 10:27:18.000000000 +0000
+++ libgcc/config.host 2012-02-04 11:34:03.000000000 +0000
@@ -746,12 +746,12 @@ mips*-*-netbsd*) # NetBSD/mips, either
;;
mips64*-*-linux* | mipsisa64*-*-linux*)
extra_parts="$extra_parts crtfastmath.o"
- tmake_file="${tmake_file} t-crtfm mips/t-mips16 mips/t-tpbit"
+ tmake_file="${tmake_file} t-crtfm mips/t-mips16 mips/t-tpbit t-slibgcc-libgcc"
md_unwind_header=mips/linux-unwind.h
;;
mips*-*-linux*) # Linux MIPS, either endian.
extra_parts="$extra_parts crtfastmath.o"
- tmake_file="${tmake_file} t-crtfm mips/t-mips16"
+ tmake_file="${tmake_file} t-crtfm mips/t-mips16 t-slibgcc-libgcc"
md_unwind_header=mips/linux-unwind.h
;;
mips*-*-openbsd*)
Index: libgcc/config/mips/libgcc-mips16.ver
===================================================================
--- libgcc/config/mips/libgcc-mips16.ver 2012-02-04 11:12:01.000000000 +0000
+++ libgcc/config/mips/libgcc-mips16.ver 2012-02-04 11:34:03.000000000 +0000
@@ -84,7 +84,3 @@ GCC_4.4.0 {
__mips16_call_stub_dc_9
__mips16_call_stub_dc_10
}
-
-GCC_4.7.0 {
- __mips16_rdhwr
-}
Index: libgcc/config/mips/mips16.S
===================================================================
--- libgcc/config/mips/mips16.S 2012-02-04 10:27:18.000000000 +0000
+++ libgcc/config/mips/mips16.S 2012-02-04 11:34:03.000000000 +0000
@@ -712,6 +712,9 @@ CALL_STUB_RET (__mips16_call_stub_dc_10,
#ifdef L_m16rdhwr
STARTFN (__mips16_rdhwr)
+ /* Forced always hidden, because the PLT resolver function would
+ not preserve all necessary registers. */
+ .hidden __mips16_rdhwr
.set push
.set mips32r2
.set noreorder