[oe] [PATCH] gcc: Pass --enable-tls=no on uclibc builds

Holger Hans Peter Freyther holger+oe at freyther.de
Mon Jul 27 10:03:05 UTC 2009


From 9edbdfdb41d61fc07e0d3e17cfde500e8ac40a4b Mon Sep 17 00:00:00 2001
From: Holger Hans Peter Freyther <zecke at selfish.org>
Date: Mon, 27 Jul 2009 11:31:32 +0200
Subject: [PATCH] gcc: Pass --enable-tls=no on uclibc builds

gcc is checking if GNU as supports TLS for the platform and then
turns on tls support on the compiler. The result is that __thread
is recognized and tls code gets emitted. This will lead to configure
scripts detecting tls (e.g. util-linux-ng) and the build breaking
with an undefined reference to ___tls_get_addr.

Introduce a get_gcc_uclibc_tls_setting python function, call it for
uclibc. A function is picked to support turning on TLS support once
uclibc is gaining a stable implementation.
---
 recipes/gcc/gcc-common.inc           |    7 +++++++
 recipes/gcc/gcc-configure-common.inc |    4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/recipes/gcc/gcc-common.inc b/recipes/gcc/gcc-common.inc
index 6e777e6..9d6d04f 100644
--- a/recipes/gcc/gcc-common.inc
+++ b/recipes/gcc/gcc-common.inc
@@ -15,6 +15,13 @@ def get_gcc_fpu_setting(bb, d):
         return "--with-float=soft"
     return ""
 
+# The tls/ntpl support in uclibc is work in progress. For the current
+# targets we should build gcc with --enable-tls=no. In the future we
+# might want to enable TLS for certain architectures and uclibc versions
+# so this is why this method exists.
+def get_gcc_uclibc_tls_setting(bb, d):
+    return "--enable-tls=no"
+
 # We really need HOST_SYS here for some packages and TARGET_SYS for others.
 # For now, libgcc is most important so we fix for that - RP.
 SHLIBSDIR = "${STAGING_DIR_TARGET}/shlibs"
diff --git a/recipes/gcc/gcc-configure-common.inc b/recipes/gcc/gcc-configure-
common.inc
index 9363585..bcc1c4f 100644
--- a/recipes/gcc/gcc-configure-common.inc
+++ b/recipes/gcc/gcc-configure-common.inc
@@ -40,8 +40,8 @@ EXTRA_OECONF = "${@['--enable-clocale=generic', '']
[bb.data.getVar('USE_NLS', d,
 # Build uclibc compilers without cxa_atexit support
 EXTRA_OECONF_append_linux               = " --enable-__cxa_atexit"
 EXTRA_OECONF_append_linux-gnueabi       = " --enable-__cxa_atexit"
-EXTRA_OECONF_append_linux-uclibc        = " --disable-__cxa_atexit"
-EXTRA_OECONF_append_linux-uclibcgnueabi = " --disable-__cxa_atexit"
+EXTRA_OECONF_append_linux-uclibc        = " --disable-__cxa_atexit 
${@get_gcc_uclibc_tls_setting(bb, d)}"
+EXTRA_OECONF_append_linux-uclibcgnueabi = " --disable-__cxa_atexit 
${@get_gcc_uclibc_tls_setting(bb, d)}"
 EXTRA_OECONF_FPU = "${@get_gcc_fpu_setting(bb, d)}"
 CPPFLAGS = ""
 
-- 
1.6.3.3





More information about the Openembedded-devel mailing list