Skip to contentSkip to conversation

klibc: Pass Optimization with KLIBCOPTFLAGS

PATCH In review Khem Raj 4 participants 9 messages Oct 2, 2017 – Apr 10, 2018

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/5 klibc: Pass Optimization with KLIBCOPTFLAGS

Overriding KLIBCOPTFLAGS also meant that -Ox flags were taken off. Which results in errors like

| usr/dash/shell.h: In function 'max_int_length':
| usr/dash/shell.h:103:25: error: '-mgeneral-regs-only' is incompatible with floating-point code
|   return (bytes * 8 - 1) * 0.30102999566398119521 + 14;
|          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
| usr/dash/shell.h:103:25: error: '-mgeneral-regs-only' is incompatible with floating-point argument
---
 ...arm-Do-not-set-a-fallback-march-and-mtune.patch | 33 ++++++++++++++++++++++
 meta-initramfs/recipes-devtools/klibc/klibc.inc    |  4 ++-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-arm-Do-not-set-a-fallback-march-and-mtune.patch
meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-arm-Do-not-set-a-fallback-march-and-mtune.patch new file +33 -0
new file mode 100644
index 000000000..9c0ea6397
@@ -0,0 +1,33 @@
+From a46a144ac883898d9cedf7a0b13aec6d10116125 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 29 Sep 2017 23:11:53 -0700
+Subject: [PATCH] arm: Do not set a fallback march and mtune
+
+In OE we pass the options explicitly, there is
+no need to set it inside the makefiles, we will
+need to compute values for CPU_ARCH and CPU_TUNE
+which is a bit harder in OE
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+Upstream-Status: Pending
+
+ usr/klibc/arch/arm/MCONFIG | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/usr/klibc/arch/arm/MCONFIG b/usr/klibc/arch/arm/MCONFIG
+index 53bc1dc3..857e2f2d 100644
+--- a/usr/klibc/arch/arm/MCONFIG
++++ b/usr/klibc/arch/arm/MCONFIG
+@@ -10,7 +10,7 @@
+ CPU_ARCH ?= armv4
+ CPU_TUNE ?= strongarm
+ 
+-KLIBCOPTFLAGS += -Os -march=$(CPU_ARCH) -mtune=$(CPU_TUNE)
++KLIBCOPTFLAGS += -Os
+ KLIBCBITSIZE  = 32
+ KLIBCREQFLAGS += -fno-exceptions
+ KLIBCSTRIPFLAGS += -R .ARM.exidx
+-- 
+2.14.2
+
meta-initramfs/recipes-devtools/klibc/klibc.inc +3 -1
index dec3d3704..30294b19a 100644
@@ -19,6 +19,7 @@ SRC_URI = "git://git.kernel.org/pub/scm/libs/klibc/klibc.git \
            file://0001-always-use-bfd-linker.patch \
            file://0001-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch \
            file://0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch \
+           file://0001-arm-Do-not-set-a-fallback-march-and-mtune.patch \
 "
 
 ARMPATCHES ?= ""
@@ -40,7 +41,8 @@ EXTRA_OEMAKE = "'KLIBCARCH=${KLIBC_ARCH}' \
                 'INSTALLDIR=${libdir}/klibc' \
                 'SHLIBDIR=${libdir}' \
                 '${KLIBCTHUMB}' \
-                'KLIBCOPTFLAGS=${TUNE_CCARGS}' \
+                'KLIBCOPTFLAGS=${TUNE_CCARGS} -Os' \
+                 V=1 \
                 "
 
 export FIX_ARMV4_EABI_BX = "${FIX_V4BX}"
Signature · 1 line
2.14.2
author
#1 lore raw

PATCH 2/5 python-m2crypto: Upgrade to 0.26.4

---
 .../m2crypto-0.26.4-gcc_macros.patch               | 24 ++++++++++++++++++++++
 ...2crypto_0.26.0.bb => python-m2crypto_0.26.4.bb} |  6 +++---
 2 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100644 meta-python/recipes-devtools/python/python-m2crypto/m2crypto-0.26.4-gcc_macros.patch
 rename meta-python/recipes-devtools/python/{python-m2crypto_0.26.0.bb => python-m2crypto_0.26.4.bb} (88%)
meta-python/recipes-devtools/python/python-m2crypto/m2crypto-0.26.4-gcc_macros.patch new file +24 -0
new file mode 100644
index 000000000..2d738cc94
@@ -0,0 +1,24 @@
+Imported from Fedora
+
+--- M2Crypto/SWIG/_m2crypto.i	2017-09-26 11:26:33.000000000 +0200
++++ M2Crypto-0.26.4/SWIG/_m2crypto.i	2017-09-26 21:04:14.080330741 +0200
+@@ -7,6 +7,7 @@
+  * Copyright (c) 2009-2010 Heikki Toivonen. All rights reserved.
+  *
+  */
++%import "gcc_macros.h"
+ 
+ %module(threads=1) m2crypto
+ /* We really don't need threadblock (PyGILState_Ensure() etc.) anywhere.
+@@ -15,11 +16,6 @@
+ %nothreadblock;
+ %nothreadallow;
+ 
+-#if SWIG_VERSION >= 0x030000
+-#define __WCHAR_MAX__ __WCHAR_MAX
+-#define __WCHAR_MIN__ __WCHAR_MIN
+-#endif
+-
+ %{
+ #if __GNUC__ < 5
+ #pragma GCC diagnostic ignored "-Wunused-label"
meta-python/recipes-devtools/python/python-m2crypto_0.26.4.bb renamed from meta-python/recipes-devtools/python/python-m2crypto_0.26.0.bb +3 -3
similarity index 88%
rename from meta-python/recipes-devtools/python/python-m2crypto_0.26.0.bb
rename to meta-python/recipes-devtools/python/python-m2crypto_0.26.4.bb
index 4b4fbbb7c..272c76ca1 100644
@@ -6,9 +6,10 @@ LIC_FILES_CHKSUM = "file://LICENCE;md5=b0e1f0b7d0ce8a62c18b1287b991800e"
 
 SRC_URI += "file://0001-setup.py-link-in-sysroot-not-in-host-directories.patch \
             file://cross-compile-platform.patch \
+            file://m2crypto-0.26.4-gcc_macros.patch \
            "
-SRC_URI[md5sum] = "9f02f0b88fbe225cc6ea8680945cafa0"
-SRC_URI[sha256sum] = "05d94fd9b2dae2fb8e072819a795f0e05d3611b09ea185f68e1630530ec09ae8"
+SRC_URI[md5sum] = "5c74c25ba8b45122318a165a3a2059ad"
+SRC_URI[sha256sum] = "5cae7acc0b34821f8c0ddf6665e482893fe1f198ad6379e61ffa9d8e65f5c199"
 
 PYPI_PACKAGE = "M2Crypto"
 inherit pypi setuptools siteinfo
@@ -46,5 +47,4 @@ do_compile_prepend() {
     fi
 }
 
-
 BBCLASSEXTEND = "native"
Signature · 1 line
2.14.2
author
#2 lore raw

PATCH 3/5 ubi-utils-klibc: Update to 1.5.2 release of mtd-utils

In reply to Khem Raj
---
 .../0001-Makefile-only-build-ubi-utils.patch       | 25 ++++++++++------------
 .../0005-common.h-klibc-fixes-2.patch              | 22 +++++--------------
 ...ils-klibc_1.5.1.bb => ubi-utils-klibc_1.5.2.bb} |  8 +++----
 3 files changed, 19 insertions(+), 36 deletions(-)
 rename meta-initramfs/recipes-devtools/mtd/{ubi-utils-klibc_1.5.1.bb => ubi-utils-klibc_1.5.2.bb} (90%)
meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0001-Makefile-only-build-ubi-utils.patch +11 -14
index 9d5e4ebf0..6e1b9ff10 100644
@@ -25,11 +25,11 @@ Signed-off-by: Andrea Adami <[email protected]>
  Makefile | 24 ++----------------------
  1 file changed, 2 insertions(+), 22 deletions(-)
 
-diff --git a/Makefile b/Makefile
-index eade234..2275865 100644
---- a/Makefile
-+++ b/Makefile
-@@ -16,28 +16,13 @@ endif
+Index: git/Makefile
+===================================================================
+--- git.orig/Makefile
++++ git/Makefile
+@@ -16,28 +16,11 @@ endif
  
  TESTS = tests
  
@@ -37,7 +37,7 @@ index eade234..2275865 100644
 -	ftl_format flash_erase nanddump doc_loadbios \
 -	ftl_check mkfs.jffs2 flash_lock flash_unlock \
 -	flash_otp_info flash_otp_dump flash_otp_lock flash_otp_write \
--	mtd_debug flashcp nandwrite nandtest \
+-	mtd_debug flashcp nandwrite nandtest mtdpart \
 -	jffs2dump \
 -	nftldump nftl_format docfdisk \
 -	rfddump rfdformat \
@@ -51,15 +51,15 @@ index eade234..2275865 100644
 -BINS += mkfs.ubifs/mkfs.ubifs
 -BINS += $(addprefix ubi-utils/,$(UBI_BINS))
 -SCRIPTS = flash_eraseall
-+BINS = $(addprefix ubi-utils/,$(UBI_BINS))
- 
- TARGETS = $(BINS)
+-
+-TARGETS = $(BINS)
 -TARGETS += lib/libmtd.a
 -TARGETS += ubi-utils/libubi.a
++BINS = $(addprefix ubi-utils/,$(UBI_BINS))
  
  OBJDEPS = $(BUILDDIR)/include/version.h
  
-@@ -61,12 +46,9 @@ endif
+@@ -61,12 +44,9 @@ endif
  	rm -f $(BUILDDIR)/include/version.h
  	$(MAKE) -C $(TESTS) clean
  
@@ -73,7 +73,7 @@ index eade234..2275865 100644
  
  tests::
  	$(MAKE) -C $(TESTS)
-@@ -91,8 +73,6 @@ LDLIBS_mkfs.jffs2  = -lz $(LZOLDLIBS)
+@@ -91,8 +71,6 @@ LDLIBS_mkfs.jffs2  = -lz $(LZOLDLIBS)
  LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
  LDLIBS_jffs2reader  = -lz $(LZOLDLIBS)
  
@@ -82,6 +82,3 @@ index eade234..2275865 100644
  #
  # Common libmtd
  #
--- 
-1.9.1
-
meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch +5 -17
index 2e43d5d97..6b09c14d6 100644
@@ -22,20 +22,11 @@ Signed-off-by: Andrea Adami <[email protected]>
  include/common.h | 10 ++++++----
  1 file changed, 6 insertions(+), 4 deletions(-)
 
-diff --git a/include/common.h b/include/common.h
-index 77f3f7d..2cbee0f 100644
---- a/include/common.h
-+++ b/include/common.h
-@@ -126,7 +126,7 @@ static char __PRIxoff_t_static_assert[sizeof(off_t) == 8 ? 1 : -1];
- 	fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \
- } while(0)
- 
--#if defined(__UCLIBC__)
-+#if defined(__UCLIBC__) || defined(__KLIBC__)
- /* uClibc versions before 0.9.34 don't have rpmatch() */
- #if __UCLIBC_MAJOR__ == 0 && \
- 		(__UCLIBC_MINOR__ < 9 || \
-@@ -146,15 +146,17 @@ static inline int __rpmatch(const char *resp)
+Index: git/include/common.h
+===================================================================
+--- git.orig/include/common.h
++++ git/include/common.h
+@@ -161,15 +161,17 @@ static inline int __rpmatch(const char *
   */
  static inline bool prompt(const char *msg, bool def)
  {
@@ -56,6 +47,3 @@ index 77f3f7d..2cbee0f 100644
  			printf("failed to read prompt; assuming '%s'\n",
  				def ? "yes" : "no");
  			break;
--- 
-1.9.1
-
meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb renamed from meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.1.bb +3 -5
similarity index 90%
rename from meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.1.bb
rename to meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb
index 8ca1ca727..518c02fc0 100644
@@ -9,7 +9,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
 
 inherit klibc
 
-SRC_URI = "git://git.infradead.org/mtd-utils.git;tag=b7455d847ab4f9eeeb6a729efc306bfda7bddc99 \
+SRCREV = "aea36417067dade75192bafa03af70b6eb2677b1"
+SRC_URI = "git://git.infradead.org/mtd-utils.git \
              file://0001-Makefile-only-build-ubi-utils.patch \
              file://0002-common.mk-for-klibc-CC-is-klcc.patch \
              file://0003-libubi.c-add-klibc-specific-fixes.patch \
@@ -23,10 +24,7 @@ S = "${WORKDIR}/git/"
 EXTRA_OEMAKE = "'CC=${CC}' 'RANLIB=${RANLIB}' 'AR=${AR}' 'CFLAGS=${CFLAGS} -I${S}include -DWITHOUT_XATTR' 'BUILDDIR=${S}'"
 
 do_install () {
-
-    install -d ${D}${sbindir}
-    oe_runmake DESTDIR="${D}" install
-
+	oe_runmake install DESTDIR=${D} SBINDIR=${sbindir} MANDIR=${mandir} INCLUDEDIR=${includedir}
 }
 
 PACKAGES = "ubi-utils-klibc-dbg"
Signature · 1 line
2.14.2
Acked-by on v1 3/5
#3 lore raw

Re: [meta-initramfs][PATCH 3/5] ubi-utils-klibc: Update to 1.5.2 release of mtd-utils

Quoted 129 lines · Khem Raj
---
 .../0001-Makefile-only-build-ubi-utils.patch       | 25 ++++++++++------------
 .../0005-common.h-klibc-fixes-2.patch              | 22 +++++--------------
 ...ils-klibc_1.5.1.bb => ubi-utils-klibc_1.5.2.bb} |  8 +++----
 3 files changed, 19 insertions(+), 36 deletions(-)
 rename meta-initramfs/recipes-devtools/mtd/{ubi-utils-klibc_1.5.1.bb => ubi-utils-klibc_1.5.2.bb} (90%)
meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0001-Makefile-only-build-ubi-utils.patch +11 -14
index 9d5e4ebf0..6e1b9ff10 100644
@@ -25,11 +25,11 @@ Signed-off-by: Andrea Adami <[email protected]>
  Makefile | 24 ++----------------------
  1 file changed, 2 insertions(+), 22 deletions(-)
 
-diff --git a/Makefile b/Makefile
-index eade234..2275865 100644
---- a/Makefile
-+++ b/Makefile
-@@ -16,28 +16,13 @@ endif
+Index: git/Makefile
+===================================================================
+--- git.orig/Makefile
++++ git/Makefile
+@@ -16,28 +16,11 @@ endif
 
  TESTS = tests
 
@@ -37,7 +37,7 @@ index eade234..2275865 100644
 -      ftl_format flash_erase nanddump doc_loadbios \
 -      ftl_check mkfs.jffs2 flash_lock flash_unlock \
 -      flash_otp_info flash_otp_dump flash_otp_lock flash_otp_write \
--      mtd_debug flashcp nandwrite nandtest \
+-      mtd_debug flashcp nandwrite nandtest mtdpart \
 -      jffs2dump \
 -      nftldump nftl_format docfdisk \
 -      rfddump rfdformat \
@@ -51,15 +51,15 @@ index eade234..2275865 100644
 -BINS += mkfs.ubifs/mkfs.ubifs
 -BINS += $(addprefix ubi-utils/,$(UBI_BINS))
 -SCRIPTS = flash_eraseall
-+BINS = $(addprefix ubi-utils/,$(UBI_BINS))
-
- TARGETS = $(BINS)
+-
+-TARGETS = $(BINS)
 -TARGETS += lib/libmtd.a
 -TARGETS += ubi-utils/libubi.a
++BINS = $(addprefix ubi-utils/,$(UBI_BINS))
 
  OBJDEPS = $(BUILDDIR)/include/version.h
 
-@@ -61,12 +46,9 @@ endif
+@@ -61,12 +44,9 @@ endif
        rm -f $(BUILDDIR)/include/version.h
        $(MAKE) -C $(TESTS) clean
 
@@ -73,7 +73,7 @@ index eade234..2275865 100644
 
  tests::
        $(MAKE) -C $(TESTS)
-@@ -91,8 +73,6 @@ LDLIBS_mkfs.jffs2  = -lz $(LZOLDLIBS)
+@@ -91,8 +71,6 @@ LDLIBS_mkfs.jffs2  = -lz $(LZOLDLIBS)
  LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
  LDLIBS_jffs2reader  = -lz $(LZOLDLIBS)
 
@@ -82,6 +82,3 @@ index eade234..2275865 100644
  #
  # Common libmtd
  #
---
-1.9.1
-
meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch +5 -17
index 2e43d5d97..6b09c14d6 100644
@@ -22,20 +22,11 @@ Signed-off-by: Andrea Adami <[email protected]>
  include/common.h | 10 ++++++----
  1 file changed, 6 insertions(+), 4 deletions(-)
 
-diff --git a/include/common.h b/include/common.h
-index 77f3f7d..2cbee0f 100644
---- a/include/common.h
-+++ b/include/common.h
-@@ -126,7 +126,7 @@ static char __PRIxoff_t_static_assert[sizeof(off_t) == 8 ? 1 : -1];
-       fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \
- } while(0)
-
--#if defined(__UCLIBC__)
-+#if defined(__UCLIBC__) || defined(__KLIBC__)
- /* uClibc versions before 0.9.34 don't have rpmatch() */
- #if __UCLIBC_MAJOR__ == 0 && \
-               (__UCLIBC_MINOR__ < 9 || \
-@@ -146,15 +146,17 @@ static inline int __rpmatch(const char *resp)
+Index: git/include/common.h
+===================================================================
+--- git.orig/include/common.h
++++ git/include/common.h
+@@ -161,15 +161,17 @@ static inline int __rpmatch(const char *
   */
  static inline bool prompt(const char *msg, bool def)
  {
@@ -56,6 +47,3 @@ index 77f3f7d..2cbee0f 100644
                        printf("failed to read prompt; assuming '%s'\n",
                                def ? "yes" : "no");
                        break;
---
-1.9.1
-
meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb renamed from meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.1.bb +2 -1
similarity index 90%
rename from meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.1.bb
rename to meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb
index 8ca1ca727..518c02fc0 100644
@@ -9,7 +9,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
 
 inherit klibc
 
-SRC_URI = "git://git.infradead.org/mtd-utils.git;tag=b7455d847ab4f9eeeb6a729efc306bfda7bddc99 \
+SRCREV = "aea36417067dade75192bafa03af70b6eb2677b1"
+SRC_URI = "git://git.infradead.org/mtd-utils.git \
              file://0001-Makefile-only-build-ubi-utils.patch \
              file://0002-common.mk-for-klibc-CC-is-klcc.patch \
              file://0003-libubi.c-add-klibc-specific-fixes.patch \

meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb S = "${WORKDIR}/git/" · line 27

Quoted 5 lines
meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb renamed from meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.1.bb +0 -2
@@ -23,10 +24,7 @@ S = "${WORKDIR}/git/"
 EXTRA_OEMAKE = "'CC=${CC}' 'RANLIB=${RANLIB}' 'AR=${AR}' 'CFLAGS=${CFLAGS} -I${S}include -DWITHOUT_XATTR' 'BUILDDIR=${S}'"
 
 do_install () {
-
-    install -d ${D}${sbindir}

I don't remember if it is actually necessary but here sbindir was purposedly created for safety.
Maybe building it anew after having wiped tmp makes install fail?

Quoted 9 lines
meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb renamed from meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.1.bb +1 -3
-    oe_runmake DESTDIR="${D}" install
-
+       oe_runmake install DESTDIR=${D} SBINDIR=${sbindir} MANDIR=${mandir} INCLUDEDIR=${includedir}
 }
 
 PACKAGES = "ubi-utils-klibc-dbg"
--

2.14.2

Quoted 5 lines

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

Thanks for taking care of this.
I planned to update to 2.x one day, at least the ubi-utils, but you know, these old binaries do work perfectly on armv4/armv5 so I never did it...

For the klibc patchset,

Cheers
Andrea

author
#4 lore raw

PATCH 4/5 klibc.bbclass: Pass TUNE_CCARGS in flags

In reply to Khem Raj

This is needed for ABI compatibility since
march defines if -mthumb means thumb1 or thumb2

---
 meta-initramfs/classes/klibc.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta-initramfs/classes/klibc.bbclass +3 -3
index 1ec7b2b05..b7b72b728 100644
@@ -11,6 +11,6 @@ CC_append_armv7a = " ${@' -mfloat-abi=${TUNE_CCARGS_MFLOAT}' if (d.getVar('TUNE_
 CPP_forcevariable = "${CC} -E"
 
 # klcc uses own optimizations by default. See klcc(1) man file.
-export CFLAGS=""
-export CPPFLAGS=""
-export LDFLAGS=""
+export CFLAGS="${TUNE_CCARGS}"
+export CPPFLAGS="${TUNE_CCARGS}"
+export LDFLAGS="${TUNE_CCARGS}"
Signature · 1 line
2.14.2
author
#5 lore raw

PATCH 5/5 gperftools: Enable on mips

In reply to Khem Raj
---
 meta-oe/recipes-support/gperftools/gperftools_2.6.1.bb | 4 ----
 1 file changed, 4 deletions(-)
meta-oe/recipes-support/gperftools/gperftools_2.6.1.bb +0 -4
index 23284670b..8ce376c91 100644
@@ -18,10 +18,6 @@ inherit autotools
 
 S = "${WORKDIR}/git"
 
-# On mips, we have the following error.
-#   do_page_fault(): sending SIGSEGV to ls for invalid read access from 00000008
-#   Segmentation fault (core dumped)
-COMPATIBLE_HOST = "(i.86|x86_64|powerpc|powerpc64|arm|aarch64).*-linux*"
 # Disable thumb1
 # {standard input}: Assembler messages:
 # {standard input}:434: Error: lo register required -- `ldr pc,[sp]'
Signature · 1 line
2.14.2
#6 lore raw

Re: [meta-oe][PATCH 5/5] gperftools: Enable on mips

Quoted 10 lines · Khem Raj
---
  meta-oe/recipes-support/gperftools/gperftools_2.6.1.bb | 4 ----
  1 file changed, 4 deletions(-)
meta-oe/recipes-support/gperftools/gperftools_2.6.1.bb +0 -0
index 23284670b..8ce376c91 100644

meta-oe/recipes-support/gperftools/gperftools_2.6.1.bb inherit autotools · line 23

Quoted 10 lines
meta-oe/recipes-support/gperftools/gperftools_2.6.1.bb +0 -4
@@ -18,10 +18,6 @@ inherit autotools
 
  S = "${WORKDIR}/git"
 
-# On mips, we have the following error.
-#   do_page_fault(): sending SIGSEGV to ls for invalid read access from 00000008
-#   Segmentation fault (core dumped)
-COMPATIBLE_HOST = "(i.86|x86_64|powerpc|powerpc64|arm|aarch64).*-linux*"
  # Disable thumb1
  # {standard input}: Assembler messages:
  # {standard input}:434: Error: lo register required -- `ldr pc,[sp]'

Hi Khem,

On qemumips, I still get the error.

               root@qemumips:~# LD_PRELOAD=libtcmalloc.so ls /
            [  407.636947] do_page_fault(): sending SIGSEGV to ls for 
invalid read access from 00000008
            [  407.646240] epc = 77e1ae08 in 
libunwind.so.8.0.1[77e18000+c000]
            [  407.651497] ra  = 77e1b3ac in 
libunwind.so.8.0.1[77e18000+c000]
            Segmentation fault (core dumped)

The libc is glibc. I didn't test for musl.

I guess you've tested mips for musl. So how about we add this setting back but limit it to glibc? Something like:
COMPATIBLE_HOST_libc-glibc = "(i.86|x86_64|powerpc|powerpc64|arm|aarch64).*-linux*"

Best Regards,
Chen Qi

author
#7 lore raw
In reply to Khem Raj

Martin

This is missing in master-next

Quoted 80 lines · Khem Raj

Overriding KLIBCOPTFLAGS also meant that -Ox flags were taken off. Which results in errors like

| usr/dash/shell.h: In function 'max_int_length':
| usr/dash/shell.h:103:25: error: '-mgeneral-regs-only' is incompatible with floating-point code
|   return (bytes * 8 - 1) * 0.30102999566398119521 + 14;
|          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
| usr/dash/shell.h:103:25: error: '-mgeneral-regs-only' is incompatible with floating-point argument
---
 ...arm-Do-not-set-a-fallback-march-and-mtune.patch | 33 ++++++++++++++++++++++
 meta-initramfs/recipes-devtools/klibc/klibc.inc    |  4 ++-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-arm-Do-not-set-a-fallback-march-and-mtune.patch
meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-arm-Do-not-set-a-fallback-march-and-mtune.patch new file +33 -0
new file mode 100644
index 000000000..9c0ea6397
@@ -0,0 +1,33 @@
+From a46a144ac883898d9cedf7a0b13aec6d10116125 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 29 Sep 2017 23:11:53 -0700
+Subject: [PATCH] arm: Do not set a fallback march and mtune
+
+In OE we pass the options explicitly, there is
+no need to set it inside the makefiles, we will
+need to compute values for CPU_ARCH and CPU_TUNE
+which is a bit harder in OE
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+Upstream-Status: Pending
+
+ usr/klibc/arch/arm/MCONFIG | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/usr/klibc/arch/arm/MCONFIG b/usr/klibc/arch/arm/MCONFIG
+index 53bc1dc3..857e2f2d 100644
+--- a/usr/klibc/arch/arm/MCONFIG
++++ b/usr/klibc/arch/arm/MCONFIG
+@@ -10,7 +10,7 @@
+ CPU_ARCH ?= armv4
+ CPU_TUNE ?= strongarm
+
+-KLIBCOPTFLAGS += -Os -march=$(CPU_ARCH) -mtune=$(CPU_TUNE)
++KLIBCOPTFLAGS += -Os
+ KLIBCBITSIZE  = 32
+ KLIBCREQFLAGS += -fno-exceptions
+ KLIBCSTRIPFLAGS += -R .ARM.exidx
+--
+2.14.2
+
meta-initramfs/recipes-devtools/klibc/klibc.inc +3 -2
index dec3d3704..30294b19a 100644
@@ -19,6 +19,7 @@ SRC_URI = "git://git.kernel.org/pub/scm/libs/klibc/klibc.git \
            file://0001-always-use-bfd-linker.patch \
            file://0001-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch \
            file://0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch \
+           file://0001-arm-Do-not-set-a-fallback-march-and-mtune.patch \
 "
 
 ARMPATCHES ?= ""
@@ -40,7 +41,8 @@ EXTRA_OEMAKE = "'KLIBCARCH=${KLIBC_ARCH}' \
                 'INSTALLDIR=${libdir}/klibc' \
                 'SHLIBDIR=${libdir}' \
                 '${KLIBCTHUMB}' \
-                'KLIBCOPTFLAGS=${TUNE_CCARGS}' \
+                'KLIBCOPTFLAGS=${TUNE_CCARGS} -Os' \
+                 V=1 \
                 "
 
 export FIX_ARMV4_EABI_BX = "${FIX_V4BX}"
--

2.14.2

#8 lore raw

Thanks, I've moved it back to New state in patchwork, hopefully tomorrow I won't forget to pick it.

Quoted 99 lines · Khem Raj

Martin

This is missing in master-next

Quoted 5 lines · Khem Raj

Overriding KLIBCOPTFLAGS also meant that -Ox flags were taken off. Which results in errors like

| usr/dash/shell.h: In function 'max_int_length':
| usr/dash/shell.h:103:25: error: '-mgeneral-regs-only' is incompatible

with floating-point code

Quoted 3 lines
|   return (bytes * 8 - 1) * 0.30102999566398119521 + 14;
|          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
| usr/dash/shell.h:103:25: error: '-mgeneral-regs-only' is incompatible

with floating-point argument

Quoted 4 lines
---
 ...arm-Do-not-set-a-fallback-march-and-mtune.patch | 33

++++++++++++++++++++++

Quoted 3 lines
 meta-initramfs/recipes-devtools/klibc/klibc.inc    |  4 ++-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/

0001-arm-Do-not-set-a-fallback-march-and-mtune.patch

Review

Quoted 2 lines
(quoted diff) +0 -0

0001-arm-Do-not-set-a-fallback-march-and-mtune.patch b/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-arm-Do-not-set-a- fallback-march-and-mtune.patch

meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/

Quoted 4 lines

new file mode 100644
index 000000000..9c0ea6397

meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/ new file +0 -0

0001-arm-Do-not-set-a-fallback-march-and-mtune.patch

Review

Quoted 35 lines
meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/ new file +33 -0
@@ -0,0 +1,33 @@
+From a46a144ac883898d9cedf7a0b13aec6d10116125 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 29 Sep 2017 23:11:53 -0700
+Subject: [PATCH] arm: Do not set a fallback march and mtune
+
+In OE we pass the options explicitly, there is
+no need to set it inside the makefiles, we will
+need to compute values for CPU_ARCH and CPU_TUNE
+which is a bit harder in OE
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+Upstream-Status: Pending
+
+ usr/klibc/arch/arm/MCONFIG | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/usr/klibc/arch/arm/MCONFIG b/usr/klibc/arch/arm/MCONFIG
+index 53bc1dc3..857e2f2d 100644
+--- a/usr/klibc/arch/arm/MCONFIG
++++ b/usr/klibc/arch/arm/MCONFIG
+@@ -10,7 +10,7 @@
+ CPU_ARCH ?= armv4
+ CPU_TUNE ?= strongarm
+
+-KLIBCOPTFLAGS += -Os -march=$(CPU_ARCH) -mtune=$(CPU_TUNE)
++KLIBCOPTFLAGS += -Os
+ KLIBCBITSIZE  = 32
+ KLIBCREQFLAGS += -fno-exceptions
+ KLIBCSTRIPFLAGS += -R .ARM.exidx
+--
+2.14.2
+
(quoted diff) +0 -0

b/meta-initramfs/recipes-devtools/klibc/klibc.inc

meta-initramfs/recipes-devtools/klibc/klibc.inc SRC_URI = "git://git.kernel.org/pub/scm/

Quoted 4 lines

index dec3d3704..30294b19a 100644

meta-initramfs/recipes-devtools/klibc/klibc.inc +0 -0
@@ -19,6 +19,7 @@ SRC_URI = "git://git.kernel.org/pub/scm/

libs/klibc/klibc.git \

meta-initramfs/recipes-devtools/klibc/klibc.inc SRC_URI = "git://git.kernel.org/pub/scm/ · line 20

Quoted 2 lines
meta-initramfs/recipes-devtools/klibc/klibc.inc +0 -0
            file://0001-always-use-bfd-linker.patch \
            file://0001-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch

\

meta-initramfs/recipes-devtools/klibc/klibc.inc SRC_URI = "git://git.kernel.org/pub/scm/ · line 21

Quoted 1 line
meta-initramfs/recipes-devtools/klibc/klibc.inc +0 -0
            file://0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch

\

meta-initramfs/recipes-devtools/klibc/klibc.inc SRC_URI = "git://git.kernel.org/pub/scm/ · line 22

Quoted 1 line
meta-initramfs/recipes-devtools/klibc/klibc.inc +1 -0
+           file://0001-arm-Do-not-set-a-fallback-march-and-mtune.patch

\

Quoted 16 lines
meta-initramfs/recipes-devtools/klibc/klibc.inc +2 -2
 "
 
 ARMPATCHES ?= ""
@@ -40,7 +41,8 @@ EXTRA_OEMAKE = "'KLIBCARCH=${KLIBC_ARCH}' \
                 'INSTALLDIR=${libdir}/klibc' \
                 'SHLIBDIR=${libdir}' \
                 '${KLIBCTHUMB}' \
-                'KLIBCOPTFLAGS=${TUNE_CCARGS}' \
+                'KLIBCOPTFLAGS=${TUNE_CCARGS} -Os' \
+                 V=1 \
                 "
 
 export FIX_ARMV4_EABI_BX = "${FIX_V4BX}"
--

2.14.2