Skip to contentSkip to conversation

Fixes found with master versions of clang/gcc

PATCH In review Khem Raj 2 participants 6 messages Jan 23, 2020 – Jan 26, 2020

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

cover Fixes found with master versions of clang/gcc

libucontext is library implementation for ucontext APIs which in case of glibc are bundled into C library but not for musl, this helps compiling apps needing these APIs on musl, e.g. chromium

The following changes since commit ca3993cc4b13d4e661228cee6fb9448adfd0a4ba:

bitbake: tests/fetch: Allow wget upgrade tests to run against a local server (2020-01-22 15:56:39 +0000)

are available in the Git repository at:

git://git.yoctoproject.org/poky-contrib kraj/pu
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=kraj/pu

Khem Raj (4):
perf: Pass LDSHARED and CCLD via EXTRA_OEMAKE
ruby: Remove __has_include and __has_include_next from preprocessed
header file
nss: Pass NSS_USE_ARM_HW_CRYPTO as define in CFLAGS
libucontext: Add recipe

 .../0001-pass-LDFLAGS-to-link-step.patch      | 31 ++++++++++
 meta/recipes-core/musl/libucontext_git.bb     | 62 +++++++++++++++++++
 meta/recipes-devtools/ruby/ruby.inc           |  7 +++
 meta/recipes-kernel/perf/perf.bb              |  2 +
 ...figure-option-to-disable-ARM-HW-cryp.patch | 25 ++++++--
 5 files changed, 123 insertions(+), 4 deletions(-)
 create mode 100644 meta/recipes-core/musl/libucontext/0001-pass-LDFLAGS-to-link-step.patch
 create mode 100644 meta/recipes-core/musl/libucontext_git.bb
Signature · 1 line
2.25.0
author
#1 lore raw

PATCH 1/4 perf: Pass LDSHARED and CCLD via EXTRA_OEMAKE

python code underneath is smart and pokes at python installation in sysroot for compile environment, the overrides from EXTRA_OEMAKE are ofcourse preferred but it falls back to python3's distutils/sysconfig for rest of them, and it does use CCLD and LDSHARED for linking, when we use clang to compile python3 then it encodes these variables to be clang however, when building perf we inherit kernel which forces gcc to be used for compiling perf, which then mixes both compilers due to CCLD and LDSHARED demands. Therefore override CCLD and LDSHARED in make environment helps python/distutils to use right linker

---
 meta/recipes-kernel/perf/perf.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-kernel/perf/perf.bb +2 -0
index 840f3008b5..6d1b06693d 100644
@@ -73,6 +73,8 @@ EXTRA_OEMAKE = '\
     CROSS_COMPILE=${TARGET_PREFIX} \
     ARCH=${ARCH} \
     CC="${CC}" \
+    CCLD="${CC}" \
+    LDSHARED="${CC} -shared" \
     AR="${AR}" \
     LD="${LD}" \
     EXTRA_CFLAGS="-ldw" \
Signature · 1 line
2.25.0
author
#2 lore raw

PATCH 2/4 ruby: Remove __has_include and __has_include_next from preprocessed header file

In reply to Khem Raj

one of the build steps ruby has is that it generated rb_mjit_header.h during configure using gcc preprocessor using -dD which emits built-in defines as well, problem happens when this header is later included in subsequent compiles, where compiler errors out stating that an existing internal define is redefined

| /tmp/20200123-2021083-2c601q.h:13849:9: error: "__has_include" cannot be used as a macro name
| 13849 | #define __has_include __has_include
|       |         ^~~~~~~~~~~~~
| compilation terminated due to -Wfatal-errors.

Since compiler already will take care of it internally we can edit it out from this header file

---
 meta/recipes-devtools/ruby/ruby.inc | 7 +++++++
 1 file changed, 7 insertions(+)
meta/recipes-devtools/ruby/ruby.inc +7 -0
index ce1b02f012..d5cd329e65 100644
@@ -38,3 +38,10 @@ do_configure_prepend() {
     sed -i "s#%%TARGET_CFLAGS%%#$CFLAGS#; s#%%TARGET_LDFLAGS%%#$LDFLAGS#" ${S}/common.mk
     rm -rf ${S}/ruby/
 }
+
+do_compile_prepend() {
+    if [ -e ${B}/rb_mjit_header.h ]; then
+        sed -i -e "/#define __has_include __has_include/d" ${B}/rb_mjit_header.h
+        sed -i -e "/#define __has_include_next __has_include_next/d" ${B}/rb_mjit_header.h
+    fi
+}
Signature · 1 line
2.25.0
author
#3 lore raw

PATCH 3/4 nss: Pass NSS_USE_ARM_HW_CRYPTO as define in CFLAGS

In reply to Khem Raj

Use NSS_USE_ARM_HW_CRYPTO to detect USE_ARM_GCM, since there are dependent, without this we control the crypto code function inclusion in build but do not control the call sites, which can result in undefined symbols e.g.

Linux_SINGLE_SHLIB/gcm.o: in function `gcmHash_InitContext':
/usr/src/debug/nss/3.49.1-r0/nss-3.49.1/nss/lib/freebl/gcm.c:112: undefined reference to `gcm_HashInit_hw'

---
 ...figure-option-to-disable-ARM-HW-cryp.patch | 25 ++++++++++++++++---
 1 file changed, 21 insertions(+), 4 deletions(-)
meta/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch +21 -4
index fe29d19882..803c06b218 100644
@@ -12,20 +12,19 @@ Signed-off-by: Alexander Kanavin <[email protected]>
  nss/lib/freebl/Makefile | 3 +++
  1 file changed, 3 insertions(+)
 
-diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
-index 06506f0..a8b015d 100644
 --- a/nss/lib/freebl/Makefile
 +++ b/nss/lib/freebl/Makefile
-@@ -125,6 +125,8 @@ else
+@@ -125,6 +125,9 @@ else
          DEFINES += -DNSS_X86
  endif
  endif
 +
 +ifdef NSS_USE_ARM_HW_CRYPTO
++    DEFINES += -DNSS_USE_ARM_HW_CRYPTO
  ifeq ($(CPU_ARCH),aarch64)
      DEFINES += -DUSE_HW_AES
      EXTRA_SRCS += aes-armv8.c gcm-aarch64.c
-@@ -145,6 +147,7 @@ ifeq ($(CPU_ARCH),arm)
+@@ -146,6 +149,7 @@ ifeq ($(CPU_ARCH),arm)
          endif
      endif
  endif
@@ -33,3 +32,21 @@ index 06506f0..a8b015d 100644
  
  ifeq ($(OS_TARGET),OSF1)
      DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_NO_MP_WORD
+--- a/nss/lib/freebl/gcm.c
++++ b/nss/lib/freebl/gcm.c
+@@ -17,6 +17,7 @@
+ 
+ #include <limits.h>
+ 
++#ifdef NSS_USE_ARM_HW_CRYPTO
+ /* old gcc doesn't support some poly64x2_t intrinsic */
+ #if defined(__aarch64__) && defined(IS_LITTLE_ENDIAN) && \
+     (defined(__clang__) || defined(__GNUC__) && __GNUC__ > 6)
+@@ -28,6 +29,7 @@
+  * that compiler uses -mfpu=neon only. */
+ #define USE_ARM_GCM
+ #endif
++#endif
+ 
+ /* Forward declarations */
+ SECStatus gcm_HashInit_hw(gcmHashContext *ghash);
Signature · 1 line
2.25.0
author
#5 lore raw

PATCH 4/4 libucontext: Add recipe

In reply to Khem Raj

Help musl based systems provide ucontext APIs

---
 .../0001-pass-LDFLAGS-to-link-step.patch      | 31 ++++++++++
 meta/recipes-core/musl/libucontext_git.bb     | 62 +++++++++++++++++++
 2 files changed, 93 insertions(+)
 create mode 100644 meta/recipes-core/musl/libucontext/0001-pass-LDFLAGS-to-link-step.patch
 create mode 100644 meta/recipes-core/musl/libucontext_git.bb
meta/recipes-core/musl/libucontext/0001-pass-LDFLAGS-to-link-step.patch new file +31 -0
new file mode 100644
index 0000000000..0ab8caf3e6
@@ -0,0 +1,31 @@
+From 12d45d250d08e96e889e38e77273c3ef73e6fc97 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 25 Nov 2019 15:07:35 -0800
+Subject: [PATCH] pass LDFLAGS to link step
+
+This helps to use OE specific linker flags and fixes
+
+do_package_qa: QA Issue: No GNU_HASH in the ELF binary
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 8a605fd..d1c9637 100644
+--- a/Makefile
++++ b/Makefile
+@@ -20,7 +20,7 @@ ${LIBUCONTEXT_STATIC_NAME}: ${LIBUCONTEXT_OBJ}
+ 
+ ${LIBUCONTEXT_NAME}: ${LIBUCONTEXT_OBJ}
+ 	$(CC) -o ${LIBUCONTEXT_NAME} -Wl,-soname,${LIBUCONTEXT_SONAME} \
+-		-shared ${LIBUCONTEXT_OBJ}
++		-shared ${LIBUCONTEXT_OBJ} ${LDFLAGS}
+ 
+ ${LIBUCONTEXT_SONAME}: ${LIBUCONTEXT_NAME}
+ 	ln -sf ${LIBUCONTEXT_NAME} ${LIBUCONTEXT_SONAME}
+-- 
+2.24.0
+
meta/recipes-core/musl/libucontext_git.bb new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
2.25.0
Acked-by on v1 3/4
#4 lore raw

Re: [PATCH 3/4] nss: Pass NSS_USE_ARM_HW_CRYPTO as define in CFLAGS

In reply to Khem Raj
Quoted 7 lines · Khem Raj

Use NSS_USE_ARM_HW_CRYPTO to detect USE_ARM_GCM, since there are dependent, without this we control the crypto code function inclusion in build but do not control the call sites, which can result in undefined symbols e.g.

Linux_SINGLE_SHLIB/gcm.o: in function `gcmHash_InitContext':
/usr/src/debug/nss/3.49.1-r0/nss-3.49.1/nss/lib/freebl/gcm.c:112: undefined reference to `gcm_HashInit_hw'

Fixes the errors I'm seeing since nss upgrade, thanks!

Quoted 64 lines
---
 ...figure-option-to-disable-ARM-HW-cryp.patch | 25 ++++++++++++++++---
 1 file changed, 21 insertions(+), 4 deletions(-)
meta/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch +21 -4
index fe29d19882..803c06b218 100644
@@ -12,20 +12,19 @@ Signed-off-by: Alexander Kanavin <[email protected]>
  nss/lib/freebl/Makefile | 3 +++
  1 file changed, 3 insertions(+)
 
-diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
-index 06506f0..a8b015d 100644
 --- a/nss/lib/freebl/Makefile
 +++ b/nss/lib/freebl/Makefile
-@@ -125,6 +125,8 @@ else
+@@ -125,6 +125,9 @@ else
          DEFINES += -DNSS_X86
  endif
  endif
 +
 +ifdef NSS_USE_ARM_HW_CRYPTO
++    DEFINES += -DNSS_USE_ARM_HW_CRYPTO
  ifeq ($(CPU_ARCH),aarch64)
      DEFINES += -DUSE_HW_AES
      EXTRA_SRCS += aes-armv8.c gcm-aarch64.c
-@@ -145,6 +147,7 @@ ifeq ($(CPU_ARCH),arm)
+@@ -146,6 +149,7 @@ ifeq ($(CPU_ARCH),arm)
          endif
      endif
  endif
@@ -33,3 +32,21 @@ index 06506f0..a8b015d 100644
 
  ifeq ($(OS_TARGET),OSF1)
      DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_NO_MP_WORD
+--- a/nss/lib/freebl/gcm.c
++++ b/nss/lib/freebl/gcm.c
+@@ -17,6 +17,7 @@
+ 
+ #include <limits.h>
+ 
++#ifdef NSS_USE_ARM_HW_CRYPTO
+ /* old gcc doesn't support some poly64x2_t intrinsic */
+ #if defined(__aarch64__) && defined(IS_LITTLE_ENDIAN) && \
+     (defined(__clang__) || defined(__GNUC__) && __GNUC__ > 6)
+@@ -28,6 +29,7 @@
+  * that compiler uses -mfpu=neon only. */
+ #define USE_ARM_GCM
+ #endif
++#endif
+ 
+ /* Forward declarations */
+ SECStatus gcm_HashInit_hw(gcmHashContext *ghash);
Signature · 7 lines
2.25.0

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