Skip to contentSkip to conversation

Fix uclibc build in thumb mode

PATCH Applied Khem Raj 2 participants 5 messages May 27, 2011

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

cover Fix uclibc build in thumb mode

slugos uses uclibc in thumb mode. These patches fix the build of uclibc in thumb mode and additionally fixes shared-mime-info which failed to build with -j4

The following changes since commit 31b3d1f9aa6fa1640874f7da9cce37f4aa13eab1:

uclibc_git.bb: Fix compilation on arm when using thumb instruction set (2011-05-26 22:44:50 -0700)

are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib kraj/uclibc-thumb
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=kraj/uclibc-thumb

Khem Raj (3):
uclibc_git.bb: Fix compilation on arm when using thumb instruction
set
uclibc.inc: Set COMPILE_IN_THUMB_MODE in .config if

    ARM_INSTRUCTION_SET != arm

shared-mime-info_0.90.bb: Fix more parallel build issues

 .../uclibc-git/append_UCLIBC_EXTRA_CFLAGS.patch    |   33 ++++++++++++++++++++
 .../uclibc-git/compile-arm-fork-with-O2.patch      |   21 ++++++++++++
 meta/recipes-core/uclibc/uclibc.inc                |    1 +
 meta/recipes-core/uclibc/uclibc_git.bb             |    4 ++-
 .../files/fix-parallel-build-backport.patch        |   26 +++++++++++++++
 .../shared-mime-info/shared-mime-info_0.90.bb      |    5 ++-
 6 files changed, 87 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-core/uclibc/uclibc-git/append_UCLIBC_EXTRA_CFLAGS.patch
 create mode 100644 meta/recipes-core/uclibc/uclibc-git/compile-arm-fork-with-O2.patch
 create mode 100644 meta/recipes-support/shared-mime-info/files/fix-parallel-build-backport.patch
Signature · 1 line
1.7.4.1
author
#1 lore raw

PATCH 1/3 uclibc_git.bb: Fix compilation on arm when using thumb instruction set

---
 .../uclibc-git/append_UCLIBC_EXTRA_CFLAGS.patch    |   33 ++++++++++++++++++++
 .../uclibc-git/compile-arm-fork-with-O2.patch      |   21 ++++++++++++
 meta/recipes-core/uclibc/uclibc_git.bb             |    4 ++-
 3 files changed, 57 insertions(+), 1 deletions(-)
 create mode 100644 meta/recipes-core/uclibc/uclibc-git/append_UCLIBC_EXTRA_CFLAGS.patch
 create mode 100644 meta/recipes-core/uclibc/uclibc-git/compile-arm-fork-with-O2.patch
meta/recipes-core/uclibc/uclibc-git/append_UCLIBC_EXTRA_CFLAGS.patch new file +33 -0
new file mode 100644
index 0000000..edcb4e3
@@ -0,0 +1,33 @@
+UCLIBC_EXTRA_CFLAGS is currently added before the OPTIMIZATION flags
+and OPTIMIZATION is chosen to be Os by default. But in OE we pass the optimisation
+flags through UCLIBC_EXTRA_CFLAGS but they are not effective since -Os is
+specified at last. So we need to change the order of these option flags
+
+Signed-off-by: Khem Raj <[email protected]>
+
+Upstream-Status: Pending
+
+diff --git a/Rules.mak b/Rules.mak
+index 65fe47c..eca7f40 100644
+--- a/Rules.mak
++++ b/Rules.mak
+@@ -585,9 +574,6 @@ CFLAGS := -include $(top_srcdir)include/libc-symbols.h \
+ 	-nostdinc -I$(top_builddir)include -I$(top_srcdir)include -I. \
+ 	-I$(top_srcdir)libc/sysdeps/linux \
+ 	-I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)
+-ifneq ($(strip $(UCLIBC_EXTRA_CFLAGS)),"")
+-CFLAGS += $(call qstrip,$(UCLIBC_EXTRA_CFLAGS))
+-endif
+ 
+ # We need this to be checked within libc-symbols.h
+ ifneq ($(HAVE_SHARED),y)
+@@ -633,6 +619,9 @@ LDFLAGS += -Wl,-s
+ else
+ STRIPTOOL := true -Stripping_disabled
+ endif
++ifneq ($(strip $(UCLIBC_EXTRA_CFLAGS)),"")
++CFLAGS += $(call qstrip,$(UCLIBC_EXTRA_CFLAGS))
++endif
+ 
+ ifeq ($(DOMULTI),y)
+ # we try to compile all sources at once into an object (IMA), but
meta/recipes-core/uclibc/uclibc-git/compile-arm-fork-with-O2.patch new file +21 -0
new file mode 100644
index 0000000..429f27d
@@ -0,0 +1,21 @@
+When compiling in thumb mode for arm with -Os gcc gives up since it can not find registers
+to spill. So we use -O2 option for compiling fork.c It may be addressable is gcc.
+
+Signed-off-by: Khem Raj <[email protected]>
+
+Upstream-Status: Pending
+
+diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
+index 329d8a9..41e3646 100644
+--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
++++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
+@@ -30,3 +30,9 @@ CFLAGS-OMIT-libc-lowlevellock.c = -DNOT_IN_libc -DIS_IN_libpthread
+ # This macro should be alternatively implemented in THUMB
+ # assembly.
+ ASFLAGS-vfork.S = -marm
++
++# For arm fork.c does not compile with -Os when in compiling
++# in thumb1 mode
++ifeq ($(COMPILE_IN_THUMB_MODE),y)
++CFLAGS-fork.c = -O2
++endif
meta/recipes-core/uclibc/uclibc_git.bb +3 -1
index 18619cd..3d5f7a7 100644
@@ -2,7 +2,7 @@ SRCREV="71d63ed75648da9b0b71afabb9c60aaad792c55c"
 
 require uclibc.inc
 PV = "0.9.31+0.9.32rc3"
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 PROVIDES += "virtual/${TARGET_PREFIX}libc-for-gcc"
 
 #recent versions uclibc require real kernel headers
@@ -27,5 +27,7 @@ SRC_URI = "git://uclibc.org/uClibc.git;branch=master;protocol=git \
 	file://argp-support.patch \
 	file://argp-headers.patch \
 	file://remove_attribute_optimize_Os.patch \
+	file://uclibc-git/append_UCLIBC_EXTRA_CFLAGS.patch \
+	file://compile-arm-fork-with-O2.patch \
 	"
 S = "${WORKDIR}/git"
Signature · 1 line
1.7.4.1
author
#2 lore raw

PATCH 2/3 uclibc.inc: Set COMPILE_IN_THUMB_MODE in .config if ARM_INSTRUCTION_SET != arm

This will configure uclibc to be compiled in thumb/thumb2 mode

---
 meta/recipes-core/uclibc/uclibc.inc |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
meta/recipes-core/uclibc/uclibc.inc +1 -0
index e7d8846..c1bc422 100644
@@ -135,6 +135,7 @@ configmangle = '/^KERNEL_HEADERS/d; \
                 /^SHARED_LIB_LOADER_PREFIX/d; \
                 /^UCLIBC_EXTRA_CFLAGS/d; \
                 s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \
+                ${@["","s,.*COMPILE_IN_THUMB_MODE.*,COMPILE_IN_THUMB_MODE=y,;"][bb.data.getVar("ARM_INSTRUCTION_SET", d, 1) != "arm"]} \
                 ${@["","s,.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=y,;"][bb.data.getVar("USE_NLS", d, 1) == "yes"]} \
                 ${@["","s,.*LDSO_GNU_HASH_SUPPORT.*,# LDSO_GNU_HASH_SUPPORT is not set,;"][bb.data.getVar("TARGET_ARCH", d, 1) in ['mips', 'mipsel', 'mips64', 'mips64el', 'avr32']]} \
                 /^CROSS/d; \
Signature · 1 line
1.7.4.1
author
#3 lore raw

PATCH 3/3 shared-mime-info_0.90.bb: Fix more parallel build issues

In reply to Khem Raj

From: Khem Raj <[email protected]>

While building for beagleboard with -j4 I ended up failures in generating and checking xml files. This is a backport from upstream that fixes the issue.

---
 .../files/fix-parallel-build-backport.patch        |   26 ++++++++++++++++++++
 .../shared-mime-info/shared-mime-info_0.90.bb      |    5 ++-
 2 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-support/shared-mime-info/files/fix-parallel-build-backport.patch
meta/recipes-support/shared-mime-info/files/fix-parallel-build-backport.patch new file +26 -0
new file mode 100644
index 0000000..a78e6a8
@@ -0,0 +1,26 @@
+Backport fix for https://bugs.freedesktop.org/show_bug.cgi?id=32127
+
+Upstream-Status: Inappropriate [Backport]
+
+Signed-off-by: Khem Raj <[email protected]>
+
+From 68e31f61f5e50e5222bc05437d1123e932922796 Mon Sep 17 00:00:00 2001
+From: Samuli Suominen <[email protected]>
+Date: Mon, 06 Dec 2010 19:46:57 +0000
+Subject: Fix parallel build
+
+https://bugs.freedesktop.org/show_bug.cgi?id=32127
+---
+Index: shared-mime-info-0.90/Makefile.am
+===================================================================
+--- shared-mime-info-0.90.orig/Makefile.am	2011-05-25 15:50:18.000000000 -0700
++++ shared-mime-info-0.90/Makefile.am	2011-05-25 15:50:45.153489305 -0700
+@@ -72,7 +72,7 @@
+ create-pot:
+ 	$(MAKE) -C po shared-mime-info.pot
+ 
+-check: freedesktop.org.xml check-translations
++check: create-pot freedesktop.org.xml check-translations
+ 	if test -n $(XMLLINT) ; then \
+ 		if test -e $(top_builddir)/freedesktop.org.xml; then \
+ 		xmllint --noout --valid $(top_builddir)/freedesktop.org.xml;	\
meta/recipes-support/shared-mime-info/shared-mime-info_0.90.bb +3 -2
index a806b36..cbbd0fe 100644
@@ -1,7 +1,8 @@
 require shared-mime-info.inc
 PR = "r0"
 
-SRC_URI += "file://fix-parallel-build.patch"
-
+SRC_URI += "file://fix-parallel-build.patch \
+            file://fix-parallel-build-backport.patch \
+           "
 SRC_URI[md5sum] = "967d68d3890ba3994cfce3adf5b8f15b"
 SRC_URI[sha256sum] = "52c9f84a8c72de631a0458542980b1728560f59845eb5e93e1dbe825f4b72304"
Signature · 1 line
1.7.4.1
#4 lore raw
In reply to Khem Raj
Quoted 11 lines · Khem Raj

slugos uses uclibc in thumb mode. These patches fix the build of uclibc in thumb mode and additionally fixes shared-mime-info which failed to build with -j4

The following changes since commit 31b3d1f9aa6fa1640874f7da9cce37f4aa13eab1:

uclibc_git.bb: Fix compilation on arm when using thumb instruction set (2011-05-26 22:44:50 -0700)

are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib kraj/uclibc-thumb
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=kraj/uclibc-thumb

Quoted 6 lines

Khem Raj (3):
uclibc_git.bb: Fix compilation on arm when using thumb instruction
set
uclibc.inc: Set COMPILE_IN_THUMB_MODE in .config if

    ARM_INSTRUCTION_SET != arm

shared-mime-info_0.90.bb: Fix more parallel build issues

Merged to master, thanks.

Richard