configure: tighten pie toolchain support test for tls variables
PATCH v3 1/1 configure: tighten pie toolchain support test for tls variables
Some toolchains don't support pie properly when tls variables are in use. Disallow pie when such toolchains are detected.
---
v3: only check __thread on Linux, where we require it, and where the
toolchain fails
v2: give tls_var a type; avoids invisible warning
configure | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
configure +11 -1
@@ -1120,7 +1120,17 @@ fi if test "$pie" != "no" ; then cat > $TMPC << EOF -int main(void) { return 0; } + +#ifdef __linux__ +# define THREAD __thread +#else +# define THREAD +#endif + +static THREAD int tls_var; + +int main(void) { return tls_var; } + EOF if compile_prog "-fPIE -DPIE" "-pie"; then QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
Signature · 1 line
1.7.7.1
Quoted 4 lines · Avi Kivity
Some toolchains don't support pie properly when tls variables are in use. Disallow pie when such toolchains are detected.
Signed-off-by Avi Kivity<[email protected]>
Thanks. Works as expected now.
Signature · 3 lines
This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Anthony Liguori
AppliedQuoted 4 lines · Avi Kivity
Some toolchains don't support pie properly when tls variables are in use. Disallow pie when such toolchains are detected.
Signed-off-by Avi Kivity<[email protected]>
Applied. Thanks.
Regards,
Anthony Liguori
Quoted 33 lines
---
v3: only check
__threadon Linux, where we require it, and where the
toolchain failsv2: give
tls_vara type; avoids invisible warningconfigure | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)configure +11
-1@@ -1120,7 +1120,17 @@ fi if test "$pie" != "no" ; then cat> $TMPC<< EOF -int main(void) { return 0; } + +#ifdef __linux__ +# define THREAD __thread +#else +# define THREAD +#endif + +static THREAD int tls_var; + +int main(void) { return tls_var; } + EOF if compile_prog "-fPIE -DPIE" "-pie"; then QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"