All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Fixes found with master versions of clang/gcc
@ 2020-01-23 20:00 Khem Raj
  2020-01-23 20:00 ` [PATCH 1/4] perf: Pass LDSHARED and CCLD via EXTRA_OEMAKE Khem Raj
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Khem Raj @ 2020-01-23 20:00 UTC (permalink / raw)
  To: openembedded-core

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

-- 
2.25.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] perf: Pass LDSHARED and CCLD via EXTRA_OEMAKE
  2020-01-23 20:00 [PATCH 0/4] Fixes found with master versions of clang/gcc Khem Raj
@ 2020-01-23 20:00 ` Khem Raj
  2020-01-23 20:00 ` [PATCH 2/4] ruby: Remove __has_include and __has_include_next from preprocessed header file Khem Raj
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Khem Raj @ 2020-01-23 20:00 UTC (permalink / raw)
  To: openembedded-core

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

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-kernel/perf/perf.bb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
index 840f3008b5..6d1b06693d 100644
--- a/meta/recipes-kernel/perf/perf.bb
+++ b/meta/recipes-kernel/perf/perf.bb
@@ -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" \
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] ruby: Remove __has_include and __has_include_next from preprocessed header file
  2020-01-23 20:00 [PATCH 0/4] Fixes found with master versions of clang/gcc Khem Raj
  2020-01-23 20:00 ` [PATCH 1/4] perf: Pass LDSHARED and CCLD via EXTRA_OEMAKE Khem Raj
@ 2020-01-23 20:00 ` Khem Raj
  2020-01-23 20:00 ` [PATCH 3/4] nss: Pass NSS_USE_ARM_HW_CRYPTO as define in CFLAGS Khem Raj
  2020-01-23 20:00 ` [PATCH 4/4] libucontext: Add recipe Khem Raj
  3 siblings, 0 replies; 6+ messages in thread
From: Khem Raj @ 2020-01-23 20:00 UTC (permalink / raw)
  To: openembedded-core

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

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/ruby/ruby.inc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/meta/recipes-devtools/ruby/ruby.inc b/meta/recipes-devtools/ruby/ruby.inc
index ce1b02f012..d5cd329e65 100644
--- a/meta/recipes-devtools/ruby/ruby.inc
+++ b/meta/recipes-devtools/ruby/ruby.inc
@@ -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
+}
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] nss: Pass NSS_USE_ARM_HW_CRYPTO as define in CFLAGS
  2020-01-23 20:00 [PATCH 0/4] Fixes found with master versions of clang/gcc Khem Raj
  2020-01-23 20:00 ` [PATCH 1/4] perf: Pass LDSHARED and CCLD via EXTRA_OEMAKE Khem Raj
  2020-01-23 20:00 ` [PATCH 2/4] ruby: Remove __has_include and __has_include_next from preprocessed header file Khem Raj
@ 2020-01-23 20:00 ` Khem Raj
  2020-01-26  9:36   ` Martin Jansa
  2020-01-23 20:00 ` [PATCH 4/4] libucontext: Add recipe Khem Raj
  3 siblings, 1 reply; 6+ messages in thread
From: Khem Raj @ 2020-01-23 20:00 UTC (permalink / raw)
  To: openembedded-core

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'

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...figure-option-to-disable-ARM-HW-cryp.patch | 25 ++++++++++++++++---
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch b/meta/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch
index fe29d19882..803c06b218 100644
--- a/meta/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch
+++ b/meta/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch
@@ -12,20 +12,19 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
  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);
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] libucontext: Add recipe
  2020-01-23 20:00 [PATCH 0/4] Fixes found with master versions of clang/gcc Khem Raj
                   ` (2 preceding siblings ...)
  2020-01-23 20:00 ` [PATCH 3/4] nss: Pass NSS_USE_ARM_HW_CRYPTO as define in CFLAGS Khem Raj
@ 2020-01-23 20:00 ` Khem Raj
  3 siblings, 0 replies; 6+ messages in thread
From: Khem Raj @ 2020-01-23 20:00 UTC (permalink / raw)
  To: openembedded-core

Help musl based systems provide ucontext APIs

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../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

diff --git a/meta/recipes-core/musl/libucontext/0001-pass-LDFLAGS-to-link-step.patch b/meta/recipes-core/musl/libucontext/0001-pass-LDFLAGS-to-link-step.patch
new file mode 100644
index 0000000000..0ab8caf3e6
--- /dev/null
+++ b/meta/recipes-core/musl/libucontext/0001-pass-LDFLAGS-to-link-step.patch
@@ -0,0 +1,31 @@
+From 12d45d250d08e96e889e38e77273c3ef73e6fc97 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+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 <raj.khem@gmail.com>
+---
+ 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
+
diff --git a/meta/recipes-core/musl/libucontext_git.bb b/meta/recipes-core/musl/libucontext_git.bb
new file mode 100644
index 0000000000..72e15aa9a4
--- /dev/null
+++ b/meta/recipes-core/musl/libucontext_git.bb
@@ -0,0 +1,62 @@
+# Copyright (C) 2019 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "ucontext implementation featuring glibc-compatible ABI"
+HOMEPAGE = "https://github.com/kaniini/libucontext"
+LICENSE = "ISC"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=864cc1445419406b7093e8e531c9515e"
+SECTION = "libs"
+DEPENDS = ""
+
+PV = "0.1.3+${SRCPV}"
+SRCREV = "e6b4d7516dae9b200e94fcfcb9ebc9331389655f"
+SRC_URI = "git://code.foxkit.us/adelie/libucontext.git;protocol=https \
+           file://0001-pass-LDFLAGS-to-link-step.patch \
+"
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_HOST = ".*-musl.*"
+
+valid_archs = "\
+i386 x86 \
+ppc powerpc powerpc64 ppc64  \
+arm aarch64 \
+s390 \
+"
+
+def map_kernel_arch(a, d):
+    import re
+
+    valid_archs = d.getVar('valid_archs').split()
+
+    if   re.match('(i.86|athlon)$', a):         return 'x86'
+    elif re.match('x86.64$', a):                return 'x86_64'
+    elif re.match('armeb$', a):                 return 'arm'
+    elif re.match('aarch64$', a):               return 'aarch64'
+    elif re.match('aarch64_be$', a):            return 'aarch64'
+    elif re.match('aarch64_ilp32$', a):         return 'aarch64'
+    elif re.match('aarch64_be_ilp32$', a):      return 'aarch64'
+    elif re.match('mips(isa|)(32|64|)(r6|)(el|)$', a):      return 'mips'
+    elif re.match('p(pc|owerpc)', a):           return 'ppc'
+    elif re.match('p(pc64|owerpc64)', a):       return 'ppc64'
+    elif re.match('riscv64$', a):               return 'riscv64'
+    elif a in valid_archs:                      return a
+    else:
+        if not d.getVar("TARGET_OS").startswith("linux"):
+            return a
+        bb.error("cannot map '%s' to a linux kernel architecture" % a)
+
+export ARCH = "${@map_kernel_arch(d.getVar('TARGET_ARCH'), d)}"
+
+CFLAGS += "-Iarch/${ARCH}"
+
+EXTRA_OEMAKE = "CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'"
+
+do_compile() {
+    oe_runmake ARCH=${ARCH}
+}
+
+do_install() {
+    oe_runmake ARCH="${ARCH}" DESTDIR="${D}" install
+}
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/4] nss: Pass NSS_USE_ARM_HW_CRYPTO as define in CFLAGS
  2020-01-23 20:00 ` [PATCH 3/4] nss: Pass NSS_USE_ARM_HW_CRYPTO as define in CFLAGS Khem Raj
@ 2020-01-26  9:36   ` Martin Jansa
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Jansa @ 2020-01-26  9:36 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 2929 bytes --]

On Thu, Jan 23, 2020 at 12:00:40PM -0800, Khem Raj wrote:
> 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!

Acked-by: Martin Jansa <Martin.Jansa@gmail.com>

> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  ...figure-option-to-disable-ARM-HW-cryp.patch | 25 ++++++++++++++++---
>  1 file changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch b/meta/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch
> index fe29d19882..803c06b218 100644
> --- a/meta/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch
> +++ b/meta/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch
> @@ -12,20 +12,19 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
>   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);
> -- 
> 2.25.0
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 201 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-01-26  9:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-23 20:00 [PATCH 0/4] Fixes found with master versions of clang/gcc Khem Raj
2020-01-23 20:00 ` [PATCH 1/4] perf: Pass LDSHARED and CCLD via EXTRA_OEMAKE Khem Raj
2020-01-23 20:00 ` [PATCH 2/4] ruby: Remove __has_include and __has_include_next from preprocessed header file Khem Raj
2020-01-23 20:00 ` [PATCH 3/4] nss: Pass NSS_USE_ARM_HW_CRYPTO as define in CFLAGS Khem Raj
2020-01-26  9:36   ` Martin Jansa
2020-01-23 20:00 ` [PATCH 4/4] libucontext: Add recipe Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.