Improve TLS link test for cross-compiling

Andrew Pinski pinskia@gmail.com
Thu Jul 2 19:47:00 GMT 2009


On Thu, Jul 2, 2009 at 12:44 PM, Joseph S. Myers<joseph@codesourcery.com> wrote:
> When cross-compiling, GCC_CHECK_TLS uses a link-time test for TLS
> support.  However, code built for an executable, or linked into an
> executable, can link OK when libc in fact lacks TLS support, even if
> code linked into a shared library would not, because of the different
> TLS access models and linker optimizations used in the different
> cases.
>
> 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?

Thanks,
Andrew Pinski



More information about the Java-patches mailing list