This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Improve TLS link test for cross-compiling
On Thu, 2 Jul 2009, Andrew Pinski wrote:
> > This patch adds an additional link-time test for linking with -shared
> > -Wl,--no-undefined in this case: if linking a non-TLS file with those
> > options succeeds (so, in particular, they are appropriate options for the
> > target in question), but linking TLS code with them fails, then TLS is not
> > supported. ÂTested with no regressions with cross to i686-pc-linux-gnu
> > using a sysroot with pre-TLS libc. ÂOK to commit?
>
> What about the case when TLS enum is used and -shared does not exist
> for the target (I am thinking of darwin or windows)?
> Does it check for that case too?
If the non-TLS -shared link fails (because -shared does not exist for the
target or --no-undefined is not a valid linker option for the target) then
it will rely on the result of the non-shared link test and report TLS as
available. The only case changed by the patch is where linking an
executable with TLS succeeds, linking -shared without TLS succeeds, and
linking -shared with TLS fails, in which case TLS will be reported as not
available. This is similar to the non-cross-compiling check that TLS
works with -static that only applies if a previous non-TLS -static test
passes, because some targets lack -static.
--
Joseph S. Myers
joseph@codesourcery.com