Skip to contentSkip to conversation

gcc: Pass --enable-tls=no on uclibc builds

PATCH In review Holger Hans Peter Freyther 3 participants 3 messages Jul 27, 2009 – Jul 29, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gcc: Pass --enable-tls=no on uclibc builds

From 9edbdfdb41d61fc07e0d3e17cfde500e8ac40a4b Mon Sep 17 00:00:00 2001
From: Holger Hans Peter Freyther <[email protected]>
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(-)
recipes/gcc/gcc-common.inc +7 -0
index 6e777e6..9d6d04f 100644
@@ -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"
recipes/gcc/gcc-configure- renamed from recipes/gcc/gcc-configure-common.inc +0 -0

common.inc
index 9363585..bcc1c4f 100644

recipes/gcc/gcc-configure-common.inc +0 -0
@@ -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 = ""

Signature · 1 line
1.6.3.3
#2 lore raw
Quoted 7 lines · Henning Heinold

Hm.

might we easier we relay on the tls.m4 marco as before which finds out if the libc is tls-aware. It was broken for cross-compiling and shared library, but there are fixes now available according to this thread:
http://www.nabble.com/Improve-TLS-link-test-for-cross-compiling-td24312975.html

I have adopted this patch to fix the tls.m4 macro for pulseaudio which now works nice.

You need to backport tls.m4 change to gcc version you are using as well so that libstdc++
is build correctly. Then there might be other packages like latest util-linux-ng etc.

Quoted 8 lines

Bye Henning

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel