Skip to contentSkip to conversation

mips64/openssl gcc5 fix, musl and debug file system patch

PATCH In review Khem Raj 2 participants 7 messages May 22, 2015 – May 28, 2015

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

cover mips64/openssl gcc5 fix, musl and debug file system patch

these patches have been tested fairly well for now, creating debug file system is a forward ported from last time and has been working quite well

Khem Raj (2):
openssl: Fix build with gcc5 on mips64
glibc: ignore for musl/uclibc but only for target recipes

Mark Hatle (1):
image.bbclass: Add a method for creating a companion debug filesystem

 meta/classes/image.bbclass                         |  5 +-
 meta/lib/oe/rootfs.py                              | 57 ++++++++++++++++++++++
 ...ine-GCC_VERSION-macro-to-cover-upto-gcc-5.patch | 53 ++++++++++++++++++++
 .../recipes-connectivity/openssl/openssl_1.0.2a.bb |  1 +
 meta/recipes-core/glibc/glibc-collateral.inc       |  3 ++
 meta/recipes-core/glibc/glibc_2.21.bb              |  9 ++--
 6 files changed, 121 insertions(+), 7 deletions(-)
 create mode 100644 meta/recipes-connectivity/openssl/openssl/0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch
Signature · 1 line
2.1.4
author
#1 lore raw

PATCH 1/3 openssl: Fix build with gcc5 on mips64

Patch is submitted upstream as well

---
 ...ine-GCC_VERSION-macro-to-cover-upto-gcc-5.patch | 53 ++++++++++++++++++++++
 .../recipes-connectivity/openssl/openssl_1.0.2a.bb |  1 +
 2 files changed, 54 insertions(+)
 create mode 100644 meta/recipes-connectivity/openssl/openssl/0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch
meta/recipes-connectivity/openssl/openssl/0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch new file +53 -0
new file mode 100644
index 0000000..46d1adf
@@ -0,0 +1,53 @@
+From 0aa68f7681a74f6ff80a80c5843bc35e5effffb9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 22 May 2015 12:43:39 -0700
+Subject: [PATCH] Define GCC_VERSION macro to cover upto gcc-5
+
+Current check is limited to gcc 4 with minor versions
+but when we use gcc 5.1, then minor version check fails
+with current setup and we end up with build errors like
+
+| In file included from bn_div.c:62:0:
+| bn_div.c: In function 'BN_div':
+| bn_lcl.h:311:9: error: impossible constraint in 'asm'
+|          asm ("dmultu    %2,%3"          \
+|          ^
+| bn_div.c:402:13: note: in expansion of macro 'BN_UMULT_LOHI'
+|              BN_UMULT_LOHI(t2l, t2h, d1, q);
+|              ^
+| <builtin>: recipe for target 'bn_div.o' failed
+| make[2]: *** [bn_div.o] Error 1
+
+Signed-off-by: Khem Raj <[email protected]>
+
+---
+Upstream-Status: [Submitted]
+ crypto/bn/bn_lcl.h | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/crypto/bn/bn_lcl.h b/crypto/bn/bn_lcl.h
+index 196df7e..e801ba7 100644
+--- a/crypto/bn/bn_lcl.h
++++ b/crypto/bn/bn_lcl.h
+@@ -118,6 +118,9 @@
+ extern "C" {
+ #endif
+ 
++#define GCC_VERSION (__GNUC__ * 10000 \
++                     + __GNUC_MINOR__ * 100 \
++                     + __GNUC_PATCHLEVEL__)
+ /*-
+  * Bignum consistency macros
+  * There is one "API" macro, bn_fix_top(), for stripping leading zeroes from
+@@ -443,7 +446,7 @@ unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b,
+ #   endif
+ #  elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG))
+ #   if defined(__GNUC__) && __GNUC__>=2
+-#    if __GNUC__>=4 && __GNUC_MINOR__>=4
++#    if GCC_VERSION > 40400
+                                      /* "h" constraint is no more since 4.4 */
+ #     define BN_UMULT_HIGH(a,b)          (((__uint128_t)(a)*(b))>>64)
+ #     define BN_UMULT_LOHI(low,high,a,b) ({     \
+-- 
+2.1.4
+
meta/recipes-connectivity/openssl/openssl_1.0.2a.bb +1 -0
index 9a218be..c05be1f 100644
@@ -37,6 +37,7 @@ SRC_URI += "file://configure-targets.patch \
             file://ptest-deps.patch \
             file://run-ptest \
             file://crypto_use_bigint_in_x86-64_perl.patch \
+            file://0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch \
            "
 
 SRC_URI[md5sum] = "a06c547dac9044161a477211049f60ef"
Signature · 1 line
2.1.4
author
#2 lore raw

PATCH 2/3 glibc: ignore for musl/uclibc but only for target recipes

we still need nativesdk or native recipes for libc to come from glibc, but only be ignored for target recipes types

Change-Id Ibaf8114f2aef63f1eadf493b264e78cd928535a0
---
 meta/recipes-core/glibc/glibc-collateral.inc | 3 +++
 meta/recipes-core/glibc/glibc_2.21.bb        | 9 +++------
 2 files changed, 6 insertions(+), 6 deletions(-)
meta/recipes-core/glibc/glibc-collateral.inc +3 -0
index f82db06..60655eb 100644
@@ -17,3 +17,6 @@ do_compile[noexec] = "1"
 
 do_install[depends] += "virtual/${MLPREFIX}libc:do_populate_sysroot"
 
+COMPATIBLE_HOST_libc-musl_class-target = "null"
+COMPATIBLE_HOST_libc-uclibc_class-target = "null"
+
meta/recipes-core/glibc/glibc_2.21.bb +3 -6
index 0c28814..4b94cba 100644
@@ -69,14 +69,11 @@ TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}"
 GLIBC_BROKEN_LOCALES = " _ER _ET so_ET yn_ER sid_ET tr_TR mn_MN gez_ET gez_ER bn_BD te_IN es_CR.ISO-8859-1"
 
 #
-# We will skip parsing glibc when system C library selection is not glibc
+# We will skip parsing glibc when target system C library selection is not glibc
 # this helps in easing out parsing for non-glibc system libraries
 #
-python __anonymous () {
-    if d.getVar('TCLIBC', True) != "glibc":
-        raise bb.parse.SkipPackage("incompatible with %s C library" %
-                                   d.getVar('TCLIBC', True))
-}
+COMPATIBLE_HOST_libc-musl_class-target = "null"
+COMPATIBLE_HOST_libc-uclibc_class-target = "null"
 
 EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
                 --without-cvs --disable-profile \
Signature · 1 line
2.1.4
author
#4 lore raw

PATCH 3/3 image.bbclass: Add a method for creating a companion debug filesystem

In reply to Khem Raj

From: Mark Hatle <[email protected]>

The companion debug filesystem contains only the package database and the complementary *-dbg packages for the main filesystem component. This is useful in a production environment to produce a companion filesystem capable of remote system debugging, without requiring corresponding debug symbols or source code on the device.

If dbg pkgs have already been installed to the rootfs image, the installation to companion debug filesystem will fail, because both of image creation make use of the same pm database.

In this situation, try to copy installed dbg files from rootfs image to companion debug filesystem.

---
 meta/classes/image.bbclass |  5 +++-
 meta/lib/oe/rootfs.py      | 57 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 1 deletion(-)
meta/classes/image.bbclass +4 -1
index 01f8b3f..58b4add 100644
@@ -24,6 +24,9 @@ IMAGE_FEATURES ?= ""
 IMAGE_FEATURES[type] = "list"
 IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs empty-root-password allow-empty-password post-install-logging"
 
+# Generate companion debugfs?
+IMAGE_GEN_DEBUGFS ?= "0"
+
 # rootfs bootstrap install
 ROOTFS_BOOTSTRAP_INSTALL = "${@bb.utils.contains("IMAGE_FEATURES", "package-management", "", "${ROOTFS_PKGMANAGE_BOOTSTRAP}",d)}"
 
@@ -108,7 +111,7 @@ def rootfs_variables(d):
                  'SDK_OUTPUT','SDKPATHNATIVE','SDKTARGETSYSROOT','SDK_DIR','SDK_VENDOR','SDKIMAGE_INSTALL_COMPLEMENTARY','SDK_PACKAGE_ARCHS','SDK_OUTPUT','SDKTARGETSYSROOT','MULTILIBRE_ALLOW_REP',
                  'MULTILIB_TEMP_ROOTFS','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS','PACKAGE_ARCHS',
                  'PACKAGE_CLASSES','TARGET_VENDOR','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','OVERRIDES','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI','INTERCEPT_DIR','USE_DEVFS',
-                 'COMPRESSIONTYPES']
+                 'COMPRESSIONTYPES', 'IMAGE_GEN_DEBUGFS']
     variables.extend(command_variables(d))
     variables.extend(variable_depends(d))
     return " ".join(variables)
meta/lib/oe/rootfs.py +57 -0

81 lines not on this page · raw message

Signature · 1 line
2.1.4
#5 lore raw

Re: [PATCH 1/3] openssl: Fix build with gcc5 on mips64

In reply to Khem Raj
Quoted 68 lines · Khem Raj

Patch is submitted upstream as well

---
...ine-GCC_VERSION-macro-to-cover-upto-gcc-5.patch | 53
++++++++++++++++++++++
.../recipes-connectivity/openssl/openssl_1.0.2a.bb | 1 +

2 files changed, 54 insertions(+)

create mode 100644 meta/recipes-connectivity/openssl/openssl/0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch

diff --git a/meta/recipes-connectivity/openssl/openssl/0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch b/meta/recipes-connectivity/openssl/openssl/0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch new file mode 100644
index 0000000..46d1adf
--- /dev/null
+++
b/meta/recipes-connectivity/openssl/openssl/0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch

meta/recipes-connectivity/openssl/openssl/0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch new file +41 -0
@@ -0,0 +1,53 @@
+From 0aa68f7681a74f6ff80a80c5843bc35e5effffb9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 22 May 2015 12:43:39 -0700
+Subject: [PATCH] Define GCC_VERSION macro to cover upto gcc-5
+
+Current check is limited to gcc 4 with minor versions
+but when we use gcc 5.1, then minor version check fails
+with current setup and we end up with build errors like
+
+| In file included from bn_div.c:62:0:
+| bn_div.c: In function 'BN_div':
+| bn_lcl.h:311:9: error: impossible constraint in 'asm'
+|          asm ("dmultu    %2,%3"          \
+|          ^
+| bn_div.c:402:13: note: in expansion of macro 'BN_UMULT_LOHI'
+|              BN_UMULT_LOHI(t2l, t2h, d1, q);
+|              ^
+| <builtin>: recipe for target 'bn_div.o' failed
+| make[2]: *** [bn_div.o] Error 1
+
+Signed-off-by: Khem Raj <[email protected]>
+
+---
+Upstream-Status: [Submitted]
+ crypto/bn/bn_lcl.h | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/crypto/bn/bn_lcl.h b/crypto/bn/bn_lcl.h
+index 196df7e..e801ba7 100644
+--- a/crypto/bn/bn_lcl.h
++++ b/crypto/bn/bn_lcl.h
+@@ -118,6 +118,9 @@
+ extern "C" {
+ #endif
+ 
++#define GCC_VERSION (__GNUC__ * 10000 \
++                     + __GNUC_MINOR__ * 100 \
++                     + __GNUC_PATCHLEVEL__)
+ /*-
+  * Bignum consistency macros
+  * There is one "API" macro, bn_fix_top(), for stripping leading

zeroes from
+@@ -443,7 +446,7 @@ unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b,
+ # endif
+ # elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG))
+ # if defined(__GNUC__) && __GNUC__>=2

Quoted 2 lines
+-#    if __GNUC__>=4 && __GNUC_MINOR__>=4
++#    if GCC_VERSION > 40400

Not that it would really matter nowadays, but this should likely be >=

Cheers,

Quoted 21 lines

+ /* "h" constraint is no more
since 4.4 */
+ # define BN_UMULT_HIGH(a,b) (((__uint128_t)(a)*(b))>>64)
+ # define BN_UMULT_LOHI(low,high,a,b) ({ \
+--
+2.1.4

(quoted diff) +1 -0
+
meta/recipes-connectivity/openssl/openssl_1.0.2a.bb +1 -0
index 9a218be..c05be1f 100644
@@ -37,6 +37,7 @@ SRC_URI += "file://configure-targets.patch \
            file://ptest-deps.patch \
            file://run-ptest \
            file://crypto_use_bigint_in_x86-64_perl.patch \
+           
 file://0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch \
           "
 

SRC_URI[md5sum] = "a06c547dac9044161a477211049f60ef"

author
#6 lore raw

Re: [PATCH 1/3] openssl: Fix build with gcc5 on mips64

Quoted 65 lines · Bernhard Reutner-Fischer
Quoted 64 lines · Khem Raj

Patch is submitted upstream as well

---
...ine-GCC_VERSION-macro-to-cover-upto-gcc-5.patch | 53
++++++++++++++++++++++
.../recipes-connectivity/openssl/openssl_1.0.2a.bb | 1 +

2 files changed, 54 insertions(+)

create mode 100644 meta/recipes-connectivity/openssl/openssl/0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch

diff --git a/meta/recipes-connectivity/openssl/openssl/0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch b/meta/recipes-connectivity/openssl/openssl/0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch new file mode 100644
index 0000000..46d1adf
--- /dev/null
+++
b/meta/recipes-connectivity/openssl/openssl/0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch

meta/recipes-connectivity/openssl/openssl/0001-Define-GCC_VERSION-macro-to-cover-upto-gcc-5.patch new file +41 -0
@@ -0,0 +1,53 @@
+From 0aa68f7681a74f6ff80a80c5843bc35e5effffb9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 22 May 2015 12:43:39 -0700
+Subject: [PATCH] Define GCC_VERSION macro to cover upto gcc-5
+
+Current check is limited to gcc 4 with minor versions
+but when we use gcc 5.1, then minor version check fails
+with current setup and we end up with build errors like
+
+| In file included from bn_div.c:62:0:
+| bn_div.c: In function 'BN_div':
+| bn_lcl.h:311:9: error: impossible constraint in 'asm'
+|          asm ("dmultu    %2,%3"          \
+|          ^
+| bn_div.c:402:13: note: in expansion of macro 'BN_UMULT_LOHI'
+|              BN_UMULT_LOHI(t2l, t2h, d1, q);
+|              ^
+| <builtin>: recipe for target 'bn_div.o' failed
+| make[2]: *** [bn_div.o] Error 1
+
+Signed-off-by: Khem Raj <[email protected]>
+
+---
+Upstream-Status: [Submitted]
+ crypto/bn/bn_lcl.h | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/crypto/bn/bn_lcl.h b/crypto/bn/bn_lcl.h
+index 196df7e..e801ba7 100644
+--- a/crypto/bn/bn_lcl.h
++++ b/crypto/bn/bn_lcl.h
+@@ -118,6 +118,9 @@
+ extern "C" {
+ #endif
+
++#define GCC_VERSION (__GNUC__ * 10000 \
++                     + __GNUC_MINOR__ * 100 \
++                     + __GNUC_PATCHLEVEL__)
+ /*-
+  * Bignum consistency macros
+  * There is one "API" macro, bn_fix_top(), for stripping leading

zeroes from
+@@ -443,7 +446,7 @@ unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b,

Quoted 8 lines
Quoted 6 lines

+ # endif
+ # elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG))
+ # if defined(__GNUC__) && __GNUC__>=2

+-#    if __GNUC__>=4 && __GNUC_MINOR__>=4
++#    if GCC_VERSION > 40400

Not that it would really matter nowadays, but this should likely be >=

you are right, I have sent another patch which actually is a backport of what was applied upstream

author
#3 lore raw

Re: [PATCH 2/3] glibc: ignore for musl/uclibc but only for target recipes

In reply to Khem Raj

any issues with this patch, why was it dropped from last pull request ?

Quoted 46 lines · Khem Raj

we still need nativesdk or native recipes for libc to come from glibc, but only be ignored for target recipes types

Change-Id Ibaf8114f2aef63f1eadf493b264e78cd928535a0
---
 meta/recipes-core/glibc/glibc-collateral.inc | 3 +++
 meta/recipes-core/glibc/glibc_2.21.bb        | 9 +++------
 2 files changed, 6 insertions(+), 6 deletions(-)
meta/recipes-core/glibc/glibc-collateral.inc +3 -0
index f82db06..60655eb 100644
@@ -17,3 +17,6 @@ do_compile[noexec] = "1"
 
 do_install[depends] += "virtual/${MLPREFIX}libc:do_populate_sysroot"
 
+COMPATIBLE_HOST_libc-musl_class-target = "null"
+COMPATIBLE_HOST_libc-uclibc_class-target = "null"
+
meta/recipes-core/glibc/glibc_2.21.bb +3 -7
index 0c28814..4b94cba 100644
@@ -69,14 +69,11 @@ TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}"
 GLIBC_BROKEN_LOCALES = " _ER _ET so_ET yn_ER sid_ET tr_TR mn_MN gez_ET gez_ER bn_BD te_IN es_CR.ISO-8859-1"
 
 #
-# We will skip parsing glibc when system C library selection is not glibc
+# We will skip parsing glibc when target system C library selection is not glibc
 # this helps in easing out parsing for non-glibc system libraries
 #
-python __anonymous () {
-    if d.getVar('TCLIBC', True) != "glibc":
-        raise bb.parse.SkipPackage("incompatible with %s C library" %
-                                   d.getVar('TCLIBC', True))
-}
+COMPATIBLE_HOST_libc-musl_class-target = "null"
+COMPATIBLE_HOST_libc-uclibc_class-target = "null"
 
 EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
                 --without-cvs --disable-profile \
--

2.1.4