All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc
@ 2018-12-14 17:54 Serhey Popovych
  2018-12-14 17:54 ` [PATCH 01/13] lib/oe/elf.py: Add powerpc64 architecture definition for musl Serhey Popovych
                   ` (13 more replies)
  0 siblings, 14 replies; 28+ messages in thread
From: Serhey Popovych @ 2018-12-14 17:54 UTC (permalink / raw)
  To: openembedded-core

Musl has support for ppc (32bit) and ppc64 (64bit). OE still missing
several tricks in configuration to make builds possible:

  1) Most important part is that musl implements elfv2 ABI only for
     64bit PowerPC. That ABI is default for little-endian but supports
     big-endian too. Historically elfv1 ABI is used for big-endian
     PowerPC.

  2) Using uncommon elfv2 ABI for big-endian requires to disable all
     assembler optimizations in openssl: unfortunately I can't find more
     smart way at the moment.

  3) LDSO path need to be adjusted to support /lib64 path which is
     default for powerpc64 (see bitbake.conf) instead of $baselibdir.

  4) Default library search path is hardcoded to
     "/lib:/usr/local/lib:/usr/lib": pass -DSYSLIBDIR and -DLIBDIR and
     use them to set path.

  5) Need to add more tweaks to patch that adds --with-ldbl-128 knob
     to gcc configure: there is a set of functions that use TFtype in
     ppc64-fp.c in libgcc. This should be compatible with glibc.

  6) Disable qemu-userspace for powerpc64 bit: there is no support.
     While there change qemuwrapper to exit explicitly to fix infinite
     execution in do_rootfs() task when building on IBM POWER8 machine.

  7) Misc fixes that map powerpc-linux-musl python3 triplet to
     powerpc-linux-gnu, remove conflicting sed in do_configure() vs
     patch settings in gcc and fix DEFAULTTUNE settings for various
     IBM POWER platforms.

Build is done on IBM POWER8 machine running RHEL7:

Images:
-------
    core-image-sato
    core-image-full-cmdline

For powerpc64:
--------------
              glibc                musl
         systemd sysvinit    systemd sysvinit
  gcc-7.3   y       y           y       y
  gcc-8.2   y       y           y       y

For powerpc:
------------
              glibc                musl
         systemd sysvinit    systemd sysvinit
  gcc-7.3   n       x           x       x      (*)
  gcc-8.2   y       y           y       y

Note that gcc-7.3 builds for 32bit powerpc fail due to:
  https://bugzilla.yoctoproject.org/show_bug.cgi?id=11754

Kernel/images are boot tested using KVM-HV on IBM POWER8.

Serhey Popovych (13):
  lib/oe/elf.py: Add powerpc64 architecture definition for musl
  tune-power[5-7].inc: Fix DEFAULTTUNE values
  tune-power[5-7].inc: Disable QEMU usermode usage
  qemuwrapper: Explicitly exit in case of no qemu supported for target
  arch-powerpc64.inc: Use elfv2 ABI when building with musl
  musl: Create default library search path based on configuration
  musl: Ensure GLIBC_LDSO symlink target does not exist on reinstall
  openssl: Skip assembler optimized code for powerpc64 with musl
  python3: Fix do_configure check platform triplet error (2)
  gcc: Fix preprocessor redefines for header pathes
  gcc: More places to patch to disable ldbl 128 for musl on PPC
  gcc: Enable secureplt for powerpc64 target too
  gcc-7.3,gcc-8.2: Use variable SYSTEMLIBS_DIR instead of hardcoding it
    for ppc64

 .../machine/include/powerpc/arch-powerpc64.inc     |   3 +
 meta/conf/machine/include/tune-power5.inc          |   5 +-
 meta/conf/machine/include/tune-power6.inc          |   5 +-
 meta/conf/machine/include/tune-power7.inc          |   5 +-
 meta/lib/oe/elf.py                                 |   1 +
 .../openssl/openssl10_1.0.2q.bb                    |   1 +
 .../recipes-connectivity/openssl/openssl_1.1.1a.bb |   1 +
 ...slibdir-and-libdir-as-default-pathes-to-l.patch |  61 ++++
 meta/recipes-core/musl/musl_git.bb                 |   3 +-
 meta/recipes-devtools/gcc/gcc-7.3.inc              |   1 +
 ...Ensure-target-gcc-headers-can-be-included.patch |  36 --
 ...44-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch | 391 ++++++++++++++++++++-
 ...werpc-powerpc64-Add-support-for-musl-ldso.patch |  31 ++
 meta/recipes-devtools/gcc/gcc-8.2.inc              |   1 +
 ...Ensure-target-gcc-headers-can-be-included.patch |  36 --
 ...34-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch | 342 +++++++++++++++++-
 ...werpc-powerpc64-Add-support-for-musl-ldso.patch |  31 ++
 meta/recipes-devtools/gcc/gcc-common.inc           |   2 +-
 .../tweak-MULTIARCH-for-powerpc-linux-musl.patch   |  40 +++
 meta/recipes-devtools/python/python3_3.5.6.bb      |   1 +
 .../recipes-devtools/qemu/qemuwrapper-cross_1.0.bb |   3 +-
 21 files changed, 920 insertions(+), 80 deletions(-)
 create mode 100644 meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-7.3/0050-powerpc-powerpc64-Add-support-for-musl-ldso.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-8.2/0042-powerpc-powerpc64-Add-support-for-musl-ldso.patch
 create mode 100644 meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-musl.patch

-- 
2.7.4



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

* [PATCH 01/13] lib/oe/elf.py: Add powerpc64 architecture definition for musl
  2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
@ 2018-12-14 17:54 ` Serhey Popovych
  2018-12-14 17:54 ` [PATCH 02/13] tune-power[5-7].inc: Fix DEFAULTTUNE values Serhey Popovych
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Serhey Popovych @ 2018-12-14 17:54 UTC (permalink / raw)
  To: openembedded-core

Add the ELF definition for the powerpc64 architecture when building
with musl as libc.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 meta/lib/oe/elf.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/lib/oe/elf.py b/meta/lib/oe/elf.py
index 0ed59ae..4cc9a9a 100644
--- a/meta/lib/oe/elf.py
+++ b/meta/lib/oe/elf.py
@@ -63,6 +63,7 @@ def machine_dict(d):
                         "arm" :       (  40,    97,    0,          True,          32),
                         "armeb":      (  40,    97,    0,          False,         32),
                         "powerpc":    (  20,     0,    0,          False,         32),
+                        "powerpc64":  (  21,     0,    0,          False,         64),
                         "i386":       (   3,     0,    0,          True,          32),
                         "i486":       (   3,     0,    0,          True,          32),
                         "i586":       (   3,     0,    0,          True,          32),
-- 
2.7.4



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

* [PATCH 02/13] tune-power[5-7].inc: Fix DEFAULTTUNE values
  2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
  2018-12-14 17:54 ` [PATCH 01/13] lib/oe/elf.py: Add powerpc64 architecture definition for musl Serhey Popovych
@ 2018-12-14 17:54 ` Serhey Popovych
  2018-12-14 17:54 ` [PATCH 03/13] tune-power[5-7].inc: Disable QEMU usermode usage Serhey Popovych
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Serhey Popovych @ 2018-12-14 17:54 UTC (permalink / raw)
  To: openembedded-core

It is ppcpX, not ppcprX, where X is 6 or 7. While there select 32bit
tune for P5 machine to bring it inline with P6 and P7.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 meta/conf/machine/include/tune-power5.inc | 2 +-
 meta/conf/machine/include/tune-power6.inc | 2 +-
 meta/conf/machine/include/tune-power7.inc | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/conf/machine/include/tune-power5.inc b/meta/conf/machine/include/tune-power5.inc
index a346c30..ab7aa6f 100644
--- a/meta/conf/machine/include/tune-power5.inc
+++ b/meta/conf/machine/include/tune-power5.inc
@@ -1,4 +1,4 @@
-DEFAULTTUNE ?= "ppc64p5"
+DEFAULTTUNE ?= "ppcp5"
 
 require conf/machine/include/powerpc/arch-powerpc64.inc
 
diff --git a/meta/conf/machine/include/tune-power6.inc b/meta/conf/machine/include/tune-power6.inc
index ee200f9..7075157 100644
--- a/meta/conf/machine/include/tune-power6.inc
+++ b/meta/conf/machine/include/tune-power6.inc
@@ -1,4 +1,4 @@
-DEFAULTTUNE ?= "ppcpr6"
+DEFAULTTUNE ?= "ppcp6"
 
 require conf/machine/include/powerpc/arch-powerpc64.inc
 
diff --git a/meta/conf/machine/include/tune-power7.inc b/meta/conf/machine/include/tune-power7.inc
index 3a27719..8189317 100644
--- a/meta/conf/machine/include/tune-power7.inc
+++ b/meta/conf/machine/include/tune-power7.inc
@@ -1,4 +1,4 @@
-DEFAULTTUNE ?= "ppcpr7"
+DEFAULTTUNE ?= "ppcp7"
 
 require conf/machine/include/powerpc/arch-powerpc64.inc
 
-- 
2.7.4



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

* [PATCH 03/13] tune-power[5-7].inc: Disable QEMU usermode usage
  2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
  2018-12-14 17:54 ` [PATCH 01/13] lib/oe/elf.py: Add powerpc64 architecture definition for musl Serhey Popovych
  2018-12-14 17:54 ` [PATCH 02/13] tune-power[5-7].inc: Fix DEFAULTTUNE values Serhey Popovych
@ 2018-12-14 17:54 ` Serhey Popovych
  2018-12-14 17:54 ` [PATCH 04/13] qemuwrapper: Explicitly exit in case of no qemu supported for target Serhey Popovych
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Serhey Popovych @ 2018-12-14 17:54 UTC (permalink / raw)
  To: openembedded-core

The QEMU usermode fails with invalid instruction error when
used with those tunes.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 meta/conf/machine/include/tune-power5.inc | 3 +++
 meta/conf/machine/include/tune-power6.inc | 3 +++
 meta/conf/machine/include/tune-power7.inc | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/meta/conf/machine/include/tune-power5.inc b/meta/conf/machine/include/tune-power5.inc
index ab7aa6f..39501bd 100644
--- a/meta/conf/machine/include/tune-power5.inc
+++ b/meta/conf/machine/include/tune-power5.inc
@@ -19,3 +19,6 @@ PACKAGE_EXTRA_ARCHS_tune-ppc64p5 = "${PACKAGE_EXTRA_ARCHS_tune-powerpc64} ppc64p
 # glibc configure options to get power5 specific library
 GLIBC_EXTRA_OECONF_powerpc64 += "${@bb.utils.contains('TUNE_FEATURES', 'power5', '--with-cpu=power5', '', d)}"
 GLIBC_EXTRA_OECONF_powerpc += "${@bb.utils.contains('TUNE_FEATURES', 'power5', '--with-cpu=power5', '', d)}"
+
+# QEMU usermode fails with invalid instruction error
+MACHINE_FEATURES_BACKFILL_CONSIDERED_append = "${@bb.utils.contains('TUNE_FEATURES', 'power5', ' qemu-usermode', '', d)}"
diff --git a/meta/conf/machine/include/tune-power6.inc b/meta/conf/machine/include/tune-power6.inc
index 7075157..1d5e8ec 100644
--- a/meta/conf/machine/include/tune-power6.inc
+++ b/meta/conf/machine/include/tune-power6.inc
@@ -19,3 +19,6 @@ PACKAGE_EXTRA_ARCHS_tune-ppc64p6 = "${PACKAGE_EXTRA_ARCHS_tune-powerpc64} ppc64p
 # glibc configure options to get power6 specific library
 GLIBC_EXTRA_OECONF_powerpc64 += "${@bb.utils.contains('TUNE_FEATURES', 'power6', '--with-cpu=power6', '', d)}"
 GLIBC_EXTRA_OECONF_powerpc += "${@bb.utils.contains('TUNE_FEATURES', 'power6', '--with-cpu=power6', '', d)}"
+
+# QEMU usermode fails with invalid instruction error
+MACHINE_FEATURES_BACKFILL_CONSIDERED_append = "${@bb.utils.contains('TUNE_FEATURES', 'power6', ' qemu-usermode', '', d)}"
diff --git a/meta/conf/machine/include/tune-power7.inc b/meta/conf/machine/include/tune-power7.inc
index 8189317..8f3f037 100644
--- a/meta/conf/machine/include/tune-power7.inc
+++ b/meta/conf/machine/include/tune-power7.inc
@@ -19,3 +19,6 @@ PACKAGE_EXTRA_ARCHS_tune-ppc64p7 = "${PACKAGE_EXTRA_ARCHS_tune-powerpc64} ppc64p
 # glibc configure options to get power7 specific library
 GLIBC_EXTRA_OECONF_powerpc64 += "${@bb.utils.contains('TUNE_FEATURES', 'power7', '--with-cpu=power7', '', d)}"
 GLIBC_EXTRA_OECONF_powerpc += "${@bb.utils.contains('TUNE_FEATURES', 'power7', '--with-cpu=power7', '', d)}"
+
+# QEMU usermode fails with invalid instruction error
+MACHINE_FEATURES_BACKFILL_CONSIDERED_append = "${@bb.utils.contains('TUNE_FEATURES', 'power7', ' qemu-usermode', '', d)}"
-- 
2.7.4



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

* [PATCH 04/13] qemuwrapper: Explicitly exit in case of no qemu supported for target
  2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
                   ` (2 preceding siblings ...)
  2018-12-14 17:54 ` [PATCH 03/13] tune-power[5-7].inc: Disable QEMU usermode usage Serhey Popovych
@ 2018-12-14 17:54 ` Serhey Popovych
  2018-12-14 17:54 ` [PATCH 05/13] arch-powerpc64.inc: Use elfv2 ABI when building with musl Serhey Popovych
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Serhey Popovych @ 2018-12-14 17:54 UTC (permalink / raw)
  To: openembedded-core

Running qemu for userspace code on unsupported target binaries might
be bad idea because qemu could say running in endless loop instead
of crashing due to illegal instruction or unsupported binary format.

While this is qemu bug we should avoid hitting it by explicitly exiting
from the wrapper when qemu backfill considered for machine.

Behaviour was observed in do_rootfs stage when building on IBM Power 8
host for PowerPC e7400 target.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb b/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb
index 4aada52..06f1561 100644
--- a/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb
+++ b/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb
@@ -21,7 +21,8 @@ do_install () {
 set -x
 
 if [ ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d)} = False ]; then
-        echo "qemuwrapper: qemu usermode is not supported"
+	echo "qemuwrapper: qemu usermode is not supported"
+	exit 1
 fi
 
 
-- 
2.7.4



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

* [PATCH 05/13] arch-powerpc64.inc: Use elfv2 ABI when building with musl
  2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
                   ` (3 preceding siblings ...)
  2018-12-14 17:54 ` [PATCH 04/13] qemuwrapper: Explicitly exit in case of no qemu supported for target Serhey Popovych
@ 2018-12-14 17:54 ` Serhey Popovych
  2018-12-14 23:36   ` Khem Raj
  2018-12-14 17:54 ` [PATCH 06/13] musl: Create default library search path based on configuration Serhey Popovych
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Serhey Popovych @ 2018-12-14 17:54 UTC (permalink / raw)
  To: openembedded-core

Historically first PowerPC ABI was big-endian only (elfv1 currently). It
is standard ABI for both 32-bit ppc and 64-bit ppc64 architectures.

With PowerPC little-endian support new ABI was introduced (elfv2) and it
is used primarily with ppc64le target only. While it has support for
big-endian it is not commonly used and elfv1 still preferred.

Musl does support only elfv2 ABI for both LE and BE and does not have
any plans to support elfv1.

Since then to build for powerpc64 with musl new ABI should be used. As
expected it is not compatible with elfv1 but that isn't problem as long
as there is no binary distributed software or assembly code written for
elfv1 ABI.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 meta/conf/machine/include/powerpc/arch-powerpc64.inc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/conf/machine/include/powerpc/arch-powerpc64.inc b/meta/conf/machine/include/powerpc/arch-powerpc64.inc
index f751c6b..d9916d4 100644
--- a/meta/conf/machine/include/powerpc/arch-powerpc64.inc
+++ b/meta/conf/machine/include/powerpc/arch-powerpc64.inc
@@ -7,6 +7,9 @@ TUNECONFLICTS[m64] = "m32 nf"
 TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'm64', ' -m64', '', d)}"
 TUNE_ARCH .= "${@bb.utils.contains('TUNE_FEATURES', [ 'm64' ], 'powerpc64', '', d)}"
 
+# musl only supports elfv2 ABI for ppc64
+TUNE_CCARGS .= "${@['', ' -mabi=elfv2']['libc-musl' in d.getVar('OVERRIDES').split(':')]}"
+
 # user mode qemu doesn't support ppc64
 MACHINE_FEATURES_BACKFILL_CONSIDERED_append = " ${@bb.utils.contains('TUNE_FEATURES', 'm64', 'qemu-usermode', '', d)}"
 
-- 
2.7.4



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

* [PATCH 06/13] musl: Create default library search path based on configuration
  2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
                   ` (4 preceding siblings ...)
  2018-12-14 17:54 ` [PATCH 05/13] arch-powerpc64.inc: Use elfv2 ABI when building with musl Serhey Popovych
@ 2018-12-14 17:54 ` Serhey Popovych
  2018-12-14 23:40   ` Khem Raj
  2018-12-14 17:54 ` [PATCH 07/13] musl: Ensure GLIBC_LDSO symlink target does not exist on reinstall Serhey Popovych
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Serhey Popovych @ 2018-12-14 17:54 UTC (permalink / raw)
  To: openembedded-core

In absence of /etc/ld-musl-$(ARCH).path file musl uses hardcoded default
search path "/lib:/usr/local/lib:/usr/lib". This works for cases when
system libraries installed in one of these pathes.

However if lib64 or libx32 used as system library directories and no
usr merge functionality enabled for distro musl dynamic loader cannot
find libraries and finally execute binaries.

Found while working on support for musl on powerpc64 builds where
lib64 variant is used regardless of multilib being on or off.

Fix by creating default search path based on configuration time values
for syslibdir and libdir.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 ...slibdir-and-libdir-as-default-pathes-to-l.patch | 61 ++++++++++++++++++++++
 meta/recipes-core/musl/musl_git.bb                 |  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch

diff --git a/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch b/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
new file mode 100644
index 0000000..6a875a7
--- /dev/null
+++ b/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
@@ -0,0 +1,61 @@
+From 5a2886f81dbca3f2ed28eebe7d27d471da278db8 Mon Sep 17 00:00:00 2001
+From: Serhey Popovych <serhe.popovych@gmail.com>
+Date: Tue, 11 Dec 2018 05:44:20 -0500
+Subject: [PATCH] ldso: Use syslibdir and libdir as default pathes to libdirs
+
+In absence of /etc/ld-musl-$(ARCH).path ldso uses default path to search
+libraries /lib:/usr/local/lib:/usr/lib.
+
+However this path isn't relevant in case when library is put in dirs
+like lib64 or libx32.
+
+Adjust CFLAGS_ALL to pass syslibdir as SYSLIBDIR and libdir as LIBDIR
+preprocessor macroses to construct default ldso library search path
+in ldso/dynlink.c::SYS_PATH_DFLT.
+
+Upstream-Status: Pending
+Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
+---
+ Makefile       | 3 ++-
+ ldso/dynlink.c | 4 +++-
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index b46f8ca4..c07e4ae8 100644
+--- a/Makefile
++++ b/Makefile
+@@ -46,7 +46,8 @@ CFLAGS_AUTO = -Os -pipe
+ CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc 
+ 
+ CFLAGS_ALL = $(CFLAGS_C99FSE)
+-CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/include -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include
++CFLAGS_ALL += -D_XOPEN_SOURCE=700 -DSYSLIBDIR='"$(syslibdir)"' -DLIBDIR='"$(libdir)"'
++CFLAGS_ALL += -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/include -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include
+ CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS)
+ 
+ LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS)
+diff --git a/ldso/dynlink.c b/ldso/dynlink.c
+index ec921dfd..7c119c55 100644
+--- a/ldso/dynlink.c
++++ b/ldso/dynlink.c
+@@ -22,6 +22,8 @@
+ #include "dynlink.h"
+ #include "malloc_impl.h"
+ 
++#define SYS_PATH_DFLT SYSLIBDIR ":" LIBDIR
++
+ static void error(const char *, ...);
+ 
+ #define MAXP2(a,b) (-(-(a)&-(b)))
+@@ -1038,7 +1040,7 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
+ 					sys_path = "";
+ 				}
+ 			}
+-			if (!sys_path) sys_path = "/lib:/usr/local/lib:/usr/lib";
++			if (!sys_path) sys_path = SYS_PATH_DFLT;
+ 			fd = path_open(name, sys_path, buf, sizeof buf);
+ 		}
+ 		pathname = buf;
+-- 
+2.7.4
+
diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
index b416ec4..9cc875c 100644
--- a/meta/recipes-core/musl/musl_git.bb
+++ b/meta/recipes-core/musl/musl_git.bb
@@ -12,6 +12,7 @@ PV = "1.1.20+git${SRCPV}"
 
 SRC_URI = "git://git.musl-libc.org/musl \
            file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \
+           file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \
           "
 
 S = "${WORKDIR}/git"
-- 
2.7.4



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

* [PATCH 07/13] musl: Ensure GLIBC_LDSO symlink target does not exist on reinstall
  2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
                   ` (5 preceding siblings ...)
  2018-12-14 17:54 ` [PATCH 06/13] musl: Create default library search path based on configuration Serhey Popovych
@ 2018-12-14 17:54 ` Serhey Popovych
  2018-12-14 19:09   ` Andre McCurdy
  2018-12-14 17:54 ` [PATCH 08/13] openssl: Skip assembler optimized code for powerpc64 with musl Serhey Popovych
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Serhey Popovych @ 2018-12-14 17:54 UTC (permalink / raw)
  To: openembedded-core

Otherwise do_install task will fail on rebuild.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 meta/recipes-core/musl/musl_git.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
index 9cc875c..4593cde 100644
--- a/meta/recipes-core/musl/musl_git.bb
+++ b/meta/recipes-core/musl/musl_git.bb
@@ -61,7 +61,7 @@ do_install() {
 	oe_runmake install DESTDIR='${D}'
 
 	install -d ${D}${bindir}
-	rm -f ${D}${bindir}/ldd
+	rm -f ${D}${bindir}/ldd ${D}${GLIBC_LDSO}
 	lnr ${D}${libdir}/libc.so ${D}${bindir}/ldd
 	lnr ${D}${libdir}/libc.so ${D}${GLIBC_LDSO}
 	for l in crypt dl m pthread resolv rt util xnet
-- 
2.7.4



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

* [PATCH 08/13] openssl: Skip assembler optimized code for powerpc64 with musl
  2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
                   ` (6 preceding siblings ...)
  2018-12-14 17:54 ` [PATCH 07/13] musl: Ensure GLIBC_LDSO symlink target does not exist on reinstall Serhey Popovych
@ 2018-12-14 17:54 ` Serhey Popovych
  2018-12-14 17:54 ` [PATCH 09/13] python3: Fix do_configure check platform triplet error (2) Serhey Popovych
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Serhey Popovych @ 2018-12-14 17:54 UTC (permalink / raw)
  To: openembedded-core

This code is written for elfv1 ABI in mind and linked as such: disable
all optimizations at the moment when building for powerpc64 with musl.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 meta/recipes-connectivity/openssl/openssl10_1.0.2q.bb | 1 +
 meta/recipes-connectivity/openssl/openssl_1.1.1a.bb   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/meta/recipes-connectivity/openssl/openssl10_1.0.2q.bb b/meta/recipes-connectivity/openssl/openssl10_1.0.2q.bb
index 6518dac..9d67053 100644
--- a/meta/recipes-connectivity/openssl/openssl10_1.0.2q.bb
+++ b/meta/recipes-connectivity/openssl/openssl10_1.0.2q.bb
@@ -81,6 +81,7 @@ CCACHE = ""
 
 TERMIO ?= "-DTERMIO"
 TERMIO_libc-musl = "-DTERMIOS"
+EXTRA_OECONF_append_libc-musl_powerpc64 = " no-asm"
 
 CFLAG = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \
          ${TERMIO} ${CFLAGS} -Wall"
diff --git a/meta/recipes-connectivity/openssl/openssl_1.1.1a.bb b/meta/recipes-connectivity/openssl/openssl_1.1.1a.bb
index 042e023..5c4e69c 100644
--- a/meta/recipes-connectivity/openssl/openssl_1.1.1a.bb
+++ b/meta/recipes-connectivity/openssl/openssl_1.1.1a.bb
@@ -35,6 +35,7 @@ do_configure[cleandirs] = "${B}"
 #| ./libcrypto.so: undefined reference to `setcontext'
 #| ./libcrypto.so: undefined reference to `makecontext'
 EXTRA_OECONF_append_libc-musl = " no-async"
+EXTRA_OECONF_append_libc-musl_powerpc64 = " no-asm"
 
 # This prevents openssl from using getrandom() which is not available on older glibc versions
 # (native versions can be built with newer glibc, but then relocated onto a system with older glibc)
-- 
2.7.4



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

* [PATCH 09/13] python3: Fix do_configure check platform triplet error (2)
  2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
                   ` (7 preceding siblings ...)
  2018-12-14 17:54 ` [PATCH 08/13] openssl: Skip assembler optimized code for powerpc64 with musl Serhey Popovych
@ 2018-12-14 17:54 ` Serhey Popovych
  2018-12-14 17:54 ` [PATCH 10/13] gcc: Fix preprocessor redefines for header pathes Serhey Popovych
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Serhey Popovych @ 2018-12-14 17:54 UTC (permalink / raw)
  To: openembedded-core

When building for powerpc 32bit with musl following error triggered
from do_configure:

checking for the platform triplet based on compiler characteristics... powerpc-linux-gnu
configure: error: internal configure error for the platform triplet, please file a bug report

This is caused by PLATFORM_TRIPLET != MULTIARCH mismatch since MULTIARCH
in case of musl is powerpc-linux-musl. Since triplet is used as part
module name as described in PEP-3149 to make fix less intrusive alias
powerpc-linux-musl to powerpc-linux-gnu to avoid possible runtime
(e.g. tests) incompatibilities later.

Fix was inspired by commit cda0ef61d373 ("python3: fix do_configure
check platform triplet error").

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 .../tweak-MULTIARCH-for-powerpc-linux-musl.patch   | 40 ++++++++++++++++++++++
 meta/recipes-devtools/python/python3_3.5.6.bb      |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-musl.patch

diff --git a/meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-musl.patch b/meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-musl.patch
new file mode 100644
index 0000000..34c9175
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-musl.patch
@@ -0,0 +1,40 @@
+From 7362464383bbd54f8e6be4389f2c74c0717bc6e1 Mon Sep 17 00:00:00 2001
+From: Serhey Popovych <serhe.popovych@gmail.com>
+Date: Sat, 8 Dec 2018 11:24:06 -0500
+Subject: [PATCH] configure.ac: tweak MULTIARCH for powerpc-linux-musl
+
+For musl builds, the MULTIARCH is powerpc-linux-musl and configure.ac
+does not have lines to recognize it causing configure error for the
+platform triplet when building for powerpc 32bit.
+
+This is feature described in PEP-3149 and to prevent possible runtime
+compatibility issues we map powerpc-linux-musl to powerpc-linux-gnu.
+
+Look at similar change by Hongxu Jia <hongxu.jia@> presended in
+tweak-MULTIARCH-for-powerpc-linux-gnuspe.patch to handle p1022ds BSP
+builds.
+
+Upstream-Status: Pending
+Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
+---
+ configure.ac | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 95c98d1..1a4d8aa 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -752,6 +752,10 @@ if test x$MULTIARCH = xpowerpc-linux-gnuspev1
+ then
+ 	MULTIARCH="powerpc-linux-gnuspe"
+ fi
++if test x$MULTIARCH = xpowerpc-linux-musl
++then
++	MULTIARCH="powerpc-linux-gnu"
++fi
+ 
+ AC_SUBST(MULTIARCH)
+ 
+-- 
+2.7.4
+
diff --git a/meta/recipes-devtools/python/python3_3.5.6.bb b/meta/recipes-devtools/python/python3_3.5.6.bb
index cd7991e..b4f6e55 100644
--- a/meta/recipes-devtools/python/python3_3.5.6.bb
+++ b/meta/recipes-devtools/python/python3_3.5.6.bb
@@ -13,6 +13,7 @@ file://130-readline-setup.patch \
 file://150-fix-setupterm.patch \
 file://0001-h2py-Fix-issue-13032-where-it-fails-with-UnicodeDeco.patch \
 file://tweak-MULTIARCH-for-powerpc-linux-gnuspe.patch \
+file://tweak-MULTIARCH-for-powerpc-linux-musl.patch \
 file://support_SOURCE_DATE_EPOCH_in_py_compile.patch \
 ${DISTRO_SRC_URI} \
 "
-- 
2.7.4



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

* [PATCH 10/13] gcc: Fix preprocessor redefines for header pathes
  2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
                   ` (8 preceding siblings ...)
  2018-12-14 17:54 ` [PATCH 09/13] python3: Fix do_configure check platform triplet error (2) Serhey Popovych
@ 2018-12-14 17:54 ` Serhey Popovych
  2018-12-14 17:54 ` [PATCH 11/13] gcc: More places to patch to disable ldbl 128 for musl on PPC Serhey Popovych
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Serhey Popovych @ 2018-12-14 17:54 UTC (permalink / raw)
  To: openembedded-core

When building for powerpc64 using musl as C library we get preprocessor
macro redefinition errors since gcc-configure-common.inc adds #define
of STANDARD_STARTFILE_PREFIX_1 and STANDARD_STARTFILE_PREFIX_2 to
gcc/defaults.h after ones added by a patch that ensures target gcc
headers included.

Since gcc-configure-common.inc included in every gcc recipe either
directly or indirectly, do_configure task is not disabled/deleted for
any of them (except gcc-source.inc) and there is no precondition that
skips gcc/defaults.h patching in
gcc-configure-common.inc::do_configure_prepend() we can just remove
conflicting parts of mentioned above patch to have single place where
start files prefixes defined in do_configure() task.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 ...Ensure-target-gcc-headers-can-be-included.patch | 36 ----------------------
 ...Ensure-target-gcc-headers-can-be-included.patch | 36 ----------------------
 2 files changed, 72 deletions(-)

diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0030-Ensure-target-gcc-headers-can-be-included.patch b/meta/recipes-devtools/gcc/gcc-7.3/0030-Ensure-target-gcc-headers-can-be-included.patch
index 568ba95..c6ecce9 100644
--- a/meta/recipes-devtools/gcc/gcc-7.3/0030-Ensure-target-gcc-headers-can-be-included.patch
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0030-Ensure-target-gcc-headers-can-be-included.patch
@@ -57,42 +57,6 @@ index 10b96eca0a7..c8da0884872 100644
  #ifdef LOCAL_INCLUDE_DIR
      /* /usr/local/include comes before the fixincluded header files.  */
      { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
-diff --git a/gcc/defaults.h b/gcc/defaults.h
-index 7ad92d920f8..39848cc9c0e 100644
---- a/gcc/defaults.h
-+++ b/gcc/defaults.h
-@@ -1475,4 +1475,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
- #define DWARF_GNAT_ENCODINGS_DEFAULT DWARF_GNAT_ENCODINGS_GDB
- #endif
- 
-+/* Default prefixes to attach to command names.  */
-+
-+#ifndef STANDARD_STARTFILE_PREFIX_1
-+#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
-+#endif
-+#ifndef STANDARD_STARTFILE_PREFIX_2
-+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
-+#endif
-+
- #endif  /* ! GCC_DEFAULTS_H */
-diff --git a/gcc/gcc.c b/gcc/gcc.c
-index c73d4023987..b27245dbf77 100644
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -1472,13 +1472,6 @@ static const char *gcc_libexec_prefix;
- 
- /* Default prefixes to attach to command names.  */
- 
--#ifndef STANDARD_STARTFILE_PREFIX_1
--#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
--#endif
--#ifndef STANDARD_STARTFILE_PREFIX_2
--#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
--#endif
--
- #ifdef CROSS_DIRECTORY_STRUCTURE  /* Don't use these prefixes for a cross compiler.  */
- #undef MD_EXEC_PREFIX
- #undef MD_STARTFILE_PREFIX
 -- 
 2.12.2
 
diff --git a/meta/recipes-devtools/gcc/gcc-8.2/0023-Ensure-target-gcc-headers-can-be-included.patch b/meta/recipes-devtools/gcc/gcc-8.2/0023-Ensure-target-gcc-headers-can-be-included.patch
index 4d4da1a..73db3e6 100644
--- a/meta/recipes-devtools/gcc/gcc-8.2/0023-Ensure-target-gcc-headers-can-be-included.patch
+++ b/meta/recipes-devtools/gcc/gcc-8.2/0023-Ensure-target-gcc-headers-can-be-included.patch
@@ -57,42 +57,6 @@ index b36a979d5ba..e2e187dedaf 100644
  #ifdef LOCAL_INCLUDE_DIR
      /* /usr/local/include comes before the fixincluded header files.  */
      { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
-diff --git a/gcc/defaults.h b/gcc/defaults.h
-index 78a08a33f12..c8851277674 100644
---- a/gcc/defaults.h
-+++ b/gcc/defaults.h
-@@ -1451,4 +1451,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
- #define DWARF_GNAT_ENCODINGS_DEFAULT DWARF_GNAT_ENCODINGS_GDB
- #endif
- 
-+/* Default prefixes to attach to command names.  */
-+
-+#ifndef STANDARD_STARTFILE_PREFIX_1
-+#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
-+#endif
-+#ifndef STANDARD_STARTFILE_PREFIX_2
-+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
-+#endif
-+
- #endif  /* ! GCC_DEFAULTS_H */
-diff --git a/gcc/gcc.c b/gcc/gcc.c
-index 570cdc00034..3fb64d453f1 100644
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -1464,13 +1464,6 @@ static const char *gcc_libexec_prefix;
- 
- /* Default prefixes to attach to command names.  */
- 
--#ifndef STANDARD_STARTFILE_PREFIX_1
--#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
--#endif
--#ifndef STANDARD_STARTFILE_PREFIX_2
--#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
--#endif
--
- #ifdef CROSS_DIRECTORY_STRUCTURE  /* Don't use these prefixes for a cross compiler.  */
- #undef MD_EXEC_PREFIX
- #undef MD_STARTFILE_PREFIX
 -- 
 2.17.0
 
-- 
2.7.4



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

* [PATCH 11/13] gcc: More places to patch to disable ldbl 128 for musl on PPC
  2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
                   ` (9 preceding siblings ...)
  2018-12-14 17:54 ` [PATCH 10/13] gcc: Fix preprocessor redefines for header pathes Serhey Popovych
@ 2018-12-14 17:54 ` Serhey Popovych
  2018-12-14 23:44   ` Khem Raj
  2018-12-14 17:54 ` [PATCH 12/13] gcc: Enable secureplt for powerpc64 target too Serhey Popovych
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Serhey Popovych @ 2018-12-14 17:54 UTC (permalink / raw)
  To: openembedded-core

There are four functions using TFmode type (128bit) that isn't
available when building with musl. Move each of them from common
ppc64-fp.c to individual files referenced from t-float128 that used
when ldbl 128 enabled at configure time.

For gcc-7.3 if -mfloat128 is given -mfloat128-type must be given too.

Exclude ibm-ldouble.c when ldbl 128 isn't enabled at config time.

Build and boot tested with musl (no float128) and glibc (float128
and ibm128 on PowerPC64).

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 ...44-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch | 391 ++++++++++++++++++++-
 ...34-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch | 342 +++++++++++++++++-
 2 files changed, 731 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch b/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
index e39af9b..f4dd891 100644
--- a/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
@@ -36,14 +36,385 @@ diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux
 index 4f6d4c4a4d2..c50dd94a2da 100644
 --- a/libgcc/config/rs6000/t-linux
 +++ b/libgcc/config/rs6000/t-linux
-@@ -1,3 +1,6 @@
+@@ -1,3 +1,9 @@
  SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
  
 -HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc
 +ifeq ($(with_ldbl128),yes)
 +HOST_LIBGCC2_CFLAGS += -mlong-double-128
++else
++# We do not want to build ibm-ldouble.c.
++LIB2ADD := $(filter-out %ibm-ldouble.c, $(LIB2ADD))
 +endif
 +HOST_LIBGCC2_CFLAGS += -mno-minimal-toc
+diff --git a/libgcc/config/rs6000/fixtfdi.c b/libgcc/config/rs6000/fixtfdi.c
+new file mode 100644
+index 0000000..9b979d0
+--- /dev/null
++++ b/libgcc/config/rs6000/fixtfdi.c
+@@ -0,0 +1,42 @@
++/* Software floating-point emulation.
++   Convert a to 64bit signed integer
++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++   Contributed by Richard Henderson (rth@cygnus.com) and
++		  Jakub Jelinek (jj@ultra.linux.cz).
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   In addition to the permissions in the GNU Lesser General Public
++   License, the Free Software Foundation gives you unlimited
++   permission to link the compiled version of this file into
++   combinations with other programs, and to distribute those
++   combinations without any restriction coming from the use of this
++   file.  (The Lesser General Public License restrictions do apply in
++   other respects; for example, they cover modification of the file,
++   and distribution when not linked into a combine executable.)
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifdef _ARCH_PPC64
++#include "soft-fp.h"
++#include "quad-float128.h"
++
++DItype
++__fixtfdi (TFtype a)
++{
++  if (a < 0)
++    return - __fixunstfdi (-a);
++  return __fixunstfdi (a);
++}
++#endif
+diff --git a/libgcc/config/rs6000/fixunstfdi.c b/libgcc/config/rs6000/fixunstfdi.c
+new file mode 100644
+index 0000000..65e9590
+--- /dev/null
++++ b/libgcc/config/rs6000/fixunstfdi.c
+@@ -0,0 +1,58 @@
++/* Software floating-point emulation.
++   Convert a to 64bit unsigned integer
++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++   Contributed by Richard Henderson (rth@cygnus.com) and
++		  Jakub Jelinek (jj@ultra.linux.cz).
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   In addition to the permissions in the GNU Lesser General Public
++   License, the Free Software Foundation gives you unlimited
++   permission to link the compiled version of this file into
++   combinations with other programs, and to distribute those
++   combinations without any restriction coming from the use of this
++   file.  (The Lesser General Public License restrictions do apply in
++   other respects; for example, they cover modification of the file,
++   and distribution when not linked into a combine executable.)
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifdef _ARCH_PPC64
++#include "soft-fp.h"
++#include "quad-float128.h"
++
++DItype
++__fixunstfdi (TFtype a)
++{
++  if (a < 0)
++    return 0;
++
++  /* Compute high word of result, as a flonum.  */
++  const TFtype b = (a / (((UDItype) 1) << (sizeof (SItype) * 8)));
++  /* Convert that to fixed (but not to DItype!),
++     and shift it into the high word.  */
++  UDItype v = (USItype) b;
++  v <<= (sizeof (SItype) * 8);
++  /* Remove high part from the TFtype, leaving the low part as flonum.  */
++  a -= (TFtype) v;
++  /* Convert that to fixed (but not to DItype!) and add it in.
++     Sometimes A comes out negative.  This is significant, since
++     A has more bits than a long int does.  */
++  if (a < 0)
++    v -= (USItype) (-a);
++  else
++    v += (USItype) a;
++  return v;
++}
++#endif
+diff --git a/libgcc/config/rs6000/floatditf.c b/libgcc/config/rs6000/floatditf.c
+new file mode 100644
+index 0000000..20ad4c6
+--- /dev/null
++++ b/libgcc/config/rs6000/floatditf.c
+@@ -0,0 +1,47 @@
++/* Software floating-point emulation.
++   Convert a 64bit signed integer to IEEE quad
++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++   Contributed by Richard Henderson (rth@cygnus.com) and
++		  Jakub Jelinek (jj@ultra.linux.cz).
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   In addition to the permissions in the GNU Lesser General Public
++   License, the Free Software Foundation gives you unlimited
++   permission to link the compiled version of this file into
++   combinations with other programs, and to distribute those
++   combinations without any restriction coming from the use of this
++   file.  (The Lesser General Public License restrictions do apply in
++   other respects; for example, they cover modification of the file,
++   and distribution when not linked into a combine executable.)
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifdef _ARCH_PPC64
++#include "soft-fp.h"
++#include "double.h"
++#include "quad-float128.h"
++
++TFtype
++__floatditf (DItype u)
++{
++  DFtype dh, dl;
++
++  dh = (SItype) (u >> (sizeof (SItype) * 8));
++  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
++  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
++
++  return (TFtype) dh + (TFtype) dl;
++}
++#endif
+diff --git a/libgcc/config/rs6000/floatunditf.c b/libgcc/config/rs6000/floatunditf.c
+new file mode 100644
+index 0000000..23dbde2
+--- /dev/null
++++ b/libgcc/config/rs6000/floatunditf.c
+@@ -0,0 +1,47 @@
++/* Software floating-point emulation.
++   Convert a 64bit unsigned integer to IEEE quad
++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++   Contributed by Richard Henderson (rth@cygnus.com) and
++		  Jakub Jelinek (jj@ultra.linux.cz).
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   In addition to the permissions in the GNU Lesser General Public
++   License, the Free Software Foundation gives you unlimited
++   permission to link the compiled version of this file into
++   combinations with other programs, and to distribute those
++   combinations without any restriction coming from the use of this
++   file.  (The Lesser General Public License restrictions do apply in
++   other respects; for example, they cover modification of the file,
++   and distribution when not linked into a combine executable.)
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifdef _ARCH_PPC64
++#include "soft-fp.h"
++#include "double.h"
++#include "quad-float128.h"
++
++TFtype
++__floatunditf (UDItype u)
++{
++  DFtype dh, dl;
++
++  dh = (USItype) (u >> (sizeof (SItype) * 8));
++  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
++  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
++
++  return (TFtype) dh + (TFtype) dl;
++}
++#endif
+diff --git a/libgcc/config/rs6000/ppc64-fp.c b/libgcc/config/rs6000/ppc64-fp.c
+index 5e1cbdd..70ad3c9 100644
+--- a/libgcc/config/rs6000/ppc64-fp.c
++++ b/libgcc/config/rs6000/ppc64-fp.c
+@@ -25,33 +25,20 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #if defined(__powerpc64__) || defined (__64BIT__) || defined(__ppc64__)
+-#define TMODES
+ #include "fp-bit.h"
+ 
+-extern DItype __fixtfdi (TFtype);
+ extern DItype __fixdfdi (DFtype);
+ extern DItype __fixsfdi (SFtype);
+ extern USItype __fixunsdfsi (DFtype);
+ extern USItype __fixunssfsi (SFtype);
+-extern TFtype __floatditf (DItype);
+-extern TFtype __floatunditf (UDItype);
+ extern DFtype __floatdidf (DItype);
+ extern DFtype __floatundidf (UDItype);
+ extern SFtype __floatdisf (DItype);
+ extern SFtype __floatundisf (UDItype);
+-extern DItype __fixunstfdi (TFtype);
+ 
+ static DItype local_fixunssfdi (SFtype);
+ static DItype local_fixunsdfdi (DFtype);
+ 
+-DItype
+-__fixtfdi (TFtype a)
+-{
+-  if (a < 0)
+-    return - __fixunstfdi (-a);
+-  return __fixunstfdi (a);
+-}
+-
+ DItype
+ __fixdfdi (DFtype a)
+ {
+@@ -86,30 +73,6 @@ __fixunssfsi (SFtype a)
+   return (SItype) a;
+ }
+ 
+-TFtype
+-__floatditf (DItype u)
+-{
+-  DFtype dh, dl;
+-
+-  dh = (SItype) (u >> (sizeof (SItype) * 8));
+-  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
+-  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
+-
+-  return (TFtype) dh + (TFtype) dl;
+-}
+-
+-TFtype
+-__floatunditf (UDItype u)
+-{
+-  DFtype dh, dl;
+-
+-  dh = (USItype) (u >> (sizeof (SItype) * 8));
+-  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
+-  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
+-
+-  return (TFtype) dh + (TFtype) dl;
+-}
+-
+ DFtype
+ __floatdidf (DItype u)
+ {
+@@ -183,30 +146,6 @@ __floatundisf (UDItype u)
+   return (SFtype) f;
+ }
+ 
+-DItype
+-__fixunstfdi (TFtype a)
+-{
+-  if (a < 0)
+-    return 0;
+-
+-  /* Compute high word of result, as a flonum.  */
+-  const TFtype b = (a / (((UDItype) 1) << (sizeof (SItype) * 8)));
+-  /* Convert that to fixed (but not to DItype!),
+-     and shift it into the high word.  */
+-  UDItype v = (USItype) b;
+-  v <<= (sizeof (SItype) * 8);
+-  /* Remove high part from the TFtype, leaving the low part as flonum.  */
+-  a -= (TFtype) v;
+-  /* Convert that to fixed (but not to DItype!) and add it in.
+-     Sometimes A comes out negative.  This is significant, since
+-     A has more bits than a long int does.  */
+-  if (a < 0)
+-    v -= (USItype) (-a);
+-  else
+-    v += (USItype) a;
+-  return v;
+-}
+-
+ /* This version is needed to prevent recursion; fixunsdfdi in libgcc
+    calls fixdfdi, which in turn calls calls fixunsdfdi.  */
+ 
+diff --git a/libgcc/config/rs6000/quad-float128.h b/libgcc/config/rs6000/quad-float128.h
+index 7d69c87..a0c2664 100644
+--- a/libgcc/config/rs6000/quad-float128.h
++++ b/libgcc/config/rs6000/quad-float128.h
+@@ -99,6 +99,11 @@ extern TItype_ppc __fixkfti (TFtype);
+ extern UTItype_ppc __fixunskfti (TFtype);
+ extern TFtype __floattikf (TItype_ppc);
+ extern TFtype __floatuntikf (UTItype_ppc);
++
++extern DItype_ppc __fixtfdi (TFtype);
++extern DItype_ppc __fixunstfdi (TFtype);
++extern TFtype __floatditf (DItype_ppc);
++extern TFtype __floatunditf (UDItype_ppc);
+ #endif
+ 
+ /* Functions using the ISA 3.0 hardware support.  If the code is compiled with
+diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128
+index 2c52ca6..3a241aa 100644
+--- a/libgcc/config/rs6000/t-float128
++++ b/libgcc/config/rs6000/t-float128
+@@ -24,6 +24,7 @@ fp128_softfp_obj	= $(fp128_softfp_static_obj) $(fp128_softfp_shared_obj)
+ 
+ # New functions for software emulation
+ fp128_ppc_funcs		= floattikf floatuntikf fixkfti fixunskfti \
++			  floatditf floatunditf fixtfdi fixunstfdi \
+ 			  extendkftf2-sw trunctfkf2-sw \
+ 			  sfp-exceptions _mulkc3 _divkc3
+ 
+@@ -58,7 +59,7 @@ fp128_includes		= $(srcdir)/soft-fp/double.h \
+ 			  $(srcdir)/soft-fp/soft-fp.h
+ 
+ # Build the emulator without ISA 3.0 hardware support.
+-FP128_CFLAGS_SW		 = -Wno-type-limits -mvsx -mfloat128 \
++FP128_CFLAGS_SW		 = -Wno-type-limits -mvsx -mfloat128 -mfloat128-type \
+ 			   -mno-float128-hardware \
+ 			   -I$(srcdir)/soft-fp \
+ 			   -I$(srcdir)/config/rs6000 \
+diff --git a/libgcc/config/rs6000/t-float128-hw b/libgcc/config/rs6000/t-float128-hw
+index 161062f..0476874 100644
+--- a/libgcc/config/rs6000/t-float128-hw
++++ b/libgcc/config/rs6000/t-float128-hw
+@@ -21,7 +21,7 @@ fp128_ifunc_obj		= $(fp128_ifunc_static_obj) $(fp128_ifunc_shared_obj)
+ fp128_sed_hw		= -hw
+ 
+ # Build the hardware support functions with appropriate hardware support
+-FP128_CFLAGS_HW		 = -Wno-type-limits -mvsx -mfloat128 \
++FP128_CFLAGS_HW		 = -Wno-type-limits -mvsx -mfloat128 -mfloat128-type \
+ 			   -mpower8-vector -mpower9-vector \
+ 			   -mfloat128-hardware \
+ 			   -I$(srcdir)/soft-fp \
 diff --git a/libgcc/configure b/libgcc/configure
 old mode 100644
 new mode 100755
@@ -96,6 +467,15 @@ index 45c459788c3..e2d19b144b8
  # Check whether --with-aix-soname was given.
  if test "${with_aix_soname+set}" = set; then :
    withval=$with_aix_soname; case "${host}:${enable_shared}" in
+@@ -4999,7 +4999,7 @@ case ${host} in
+ # for hardware support.
+ powerpc*-*-linux*)
+   saved_CFLAGS="$CFLAGS"
+-  CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
++  CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128 -mfloat128-type"
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC ISA 2.06 to build __float128 libraries" >&5
+ $as_echo_n "checking for PowerPC ISA 2.06 to build __float128 libraries... " >&6; }
+ if test "${libgcc_cv_powerpc_float128+set}" = set; then :
 diff --git a/libgcc/configure.ac b/libgcc/configure.ac
 index af151473709..dada52416da 100644
 --- a/libgcc/configure.ac
@@ -119,6 +499,15 @@ index af151473709..dada52416da 100644
  AC_ARG_WITH(aix-soname,
  [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
      [shared library versioning (aka "SONAME") variant to provide on AIX])],
+@@ -394,7 +394,7 @@ case ${host} in
+ # for hardware support.
+ powerpc*-*-linux*)
+   saved_CFLAGS="$CFLAGS"
+-  CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
++  CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128 -mfloat128-type"
+   AC_CACHE_CHECK([for PowerPC ISA 2.06 to build __float128 libraries],
+ 		 [libgcc_cv_powerpc_float128],
+ 		 [AC_COMPILE_IFELSE(
 -- 
 2.12.2
 
diff --git a/meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch b/meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
index 7a69ea2..391cda7 100644
--- a/meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
+++ b/meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
@@ -37,14 +37,354 @@ diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux
 index 4f6d4c4a4d2..c50dd94a2da 100644
 --- a/libgcc/config/rs6000/t-linux
 +++ b/libgcc/config/rs6000/t-linux
-@@ -1,3 +1,6 @@
+@@ -1,3 +1,9 @@
  SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
  
 -HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc
 +ifeq ($(with_ldbl128),yes)
 +HOST_LIBGCC2_CFLAGS += -mlong-double-128
++else
++# We do not want to build ibm-ldouble.c.
++LIB2ADD := $(filter-out %ibm-ldouble.c, $(LIB2ADD))
 +endif
 +HOST_LIBGCC2_CFLAGS += -mno-minimal-toc
+diff --git a/libgcc/config/rs6000/fixtfdi.c b/libgcc/config/rs6000/fixtfdi.c
+--- a/libgcc/config/rs6000/fixtfdi.c	1969-12-31 19:00:00.000000000 -0500
++++ b/libgcc/config/rs6000/fixtfdi.c	2018-12-12 17:54:50.110755540 -0500
+@@ -0,0 +1,42 @@
++/* Software floating-point emulation.
++   Convert a to 64bit signed integer
++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++   Contributed by Richard Henderson (rth@cygnus.com) and
++		  Jakub Jelinek (jj@ultra.linux.cz).
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   In addition to the permissions in the GNU Lesser General Public
++   License, the Free Software Foundation gives you unlimited
++   permission to link the compiled version of this file into
++   combinations with other programs, and to distribute those
++   combinations without any restriction coming from the use of this
++   file.  (The Lesser General Public License restrictions do apply in
++   other respects; for example, they cover modification of the file,
++   and distribution when not linked into a combine executable.)
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifdef _ARCH_PPC64
++#include "soft-fp.h"
++#include "quad-float128.h"
++
++DItype
++__fixtfdi (TFtype a)
++{
++  if (a < 0)
++    return - __fixunstfdi (-a);
++  return __fixunstfdi (a);
++}
++#endif
+diff --git a/libgcc/config/rs6000/fixunstfdi.c b/libgcc/config/rs6000/fixunstfdi.c
+--- a/libgcc/config/rs6000/fixunstfdi.c	1969-12-31 19:00:00.000000000 -0500
++++ b/libgcc/config/rs6000/fixunstfdi.c	2018-12-12 17:56:06.141654537 -0500
+@@ -0,0 +1,58 @@
++/* Software floating-point emulation.
++   Convert a to 64bit unsigned integer
++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++   Contributed by Richard Henderson (rth@cygnus.com) and
++		  Jakub Jelinek (jj@ultra.linux.cz).
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   In addition to the permissions in the GNU Lesser General Public
++   License, the Free Software Foundation gives you unlimited
++   permission to link the compiled version of this file into
++   combinations with other programs, and to distribute those
++   combinations without any restriction coming from the use of this
++   file.  (The Lesser General Public License restrictions do apply in
++   other respects; for example, they cover modification of the file,
++   and distribution when not linked into a combine executable.)
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifdef _ARCH_PPC64
++#include "soft-fp.h"
++#include "quad-float128.h"
++
++DItype
++__fixunstfdi (TFtype a)
++{
++  if (a < 0)
++    return 0;
++
++  /* Compute high word of result, as a flonum.  */
++  const TFtype b = (a / (((UDItype) 1) << (sizeof (SItype) * 8)));
++  /* Convert that to fixed (but not to DItype!),
++     and shift it into the high word.  */
++  UDItype v = (USItype) b;
++  v <<= (sizeof (SItype) * 8);
++  /* Remove high part from the TFtype, leaving the low part as flonum.  */
++  a -= (TFtype) v;
++  /* Convert that to fixed (but not to DItype!) and add it in.
++     Sometimes A comes out negative.  This is significant, since
++     A has more bits than a long int does.  */
++  if (a < 0)
++    v -= (USItype) (-a);
++  else
++    v += (USItype) a;
++  return v;
++}
++#endif
+diff --git a/libgcc/config/rs6000/floatditf.c b/libgcc/config/rs6000/floatditf.c
+--- a/libgcc/config/rs6000/floatditf.c	1969-12-31 19:00:00.000000000 -0500
++++ b/libgcc/config/rs6000/floatditf.c	2018-12-12 17:57:55.852953553 -0500
+@@ -0,0 +1,47 @@
++/* Software floating-point emulation.
++   Convert a 64bit signed integer to IEEE quad
++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++   Contributed by Richard Henderson (rth@cygnus.com) and
++		  Jakub Jelinek (jj@ultra.linux.cz).
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   In addition to the permissions in the GNU Lesser General Public
++   License, the Free Software Foundation gives you unlimited
++   permission to link the compiled version of this file into
++   combinations with other programs, and to distribute those
++   combinations without any restriction coming from the use of this
++   file.  (The Lesser General Public License restrictions do apply in
++   other respects; for example, they cover modification of the file,
++   and distribution when not linked into a combine executable.)
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifdef _ARCH_PPC64
++#include "soft-fp.h"
++#include "double.h"
++#include "quad-float128.h"
++
++TFtype
++__floatditf (DItype u)
++{
++  DFtype dh, dl;
++
++  dh = (SItype) (u >> (sizeof (SItype) * 8));
++  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
++  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
++
++  return (TFtype) dh + (TFtype) dl;
++}
++#endif
+diff --git a/libgcc/config/rs6000/floatunditf.c b/libgcc/config/rs6000/floatunditf.c
+--- a/libgcc/config/rs6000/floatunditf.c	1969-12-31 19:00:00.000000000 -0500
++++ b/libgcc/config/rs6000/floatunditf.c	2018-12-12 17:57:15.262473574 -0500
+@@ -0,0 +1,47 @@
++/* Software floating-point emulation.
++   Convert a 64bit unsigned integer to IEEE quad
++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++   Contributed by Richard Henderson (rth@cygnus.com) and
++		  Jakub Jelinek (jj@ultra.linux.cz).
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   In addition to the permissions in the GNU Lesser General Public
++   License, the Free Software Foundation gives you unlimited
++   permission to link the compiled version of this file into
++   combinations with other programs, and to distribute those
++   combinations without any restriction coming from the use of this
++   file.  (The Lesser General Public License restrictions do apply in
++   other respects; for example, they cover modification of the file,
++   and distribution when not linked into a combine executable.)
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifdef _ARCH_PPC64
++#include "soft-fp.h"
++#include "double.h"
++#include "quad-float128.h"
++
++TFtype
++__floatunditf (UDItype u)
++{
++  DFtype dh, dl;
++
++  dh = (USItype) (u >> (sizeof (SItype) * 8));
++  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
++  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
++
++  return (TFtype) dh + (TFtype) dl;
++}
++#endif
+diff --git a/libgcc/config/rs6000/ppc64-fp.c b/libgcc/config/rs6000/ppc64-fp.c
+--- a/libgcc/config/rs6000/ppc64-fp.c	2018-12-12 17:53:49.540038500 -0500
++++ b/libgcc/config/rs6000/ppc64-fp.c	2018-12-12 17:49:51.897235314 -0500
+@@ -25,34 +25,21 @@
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #if defined(__powerpc64__) || defined (__64BIT__) || defined(__ppc64__)
+-#define TMODES
+ #include "fp-bit.h"
+ 
+-extern DItype __fixtfdi (TFtype);
+ extern DItype __fixdfdi (DFtype);
+ extern DItype __fixsfdi (SFtype);
+ extern USItype __fixunsdfsi (DFtype);
+ extern USItype __fixunssfsi (SFtype);
+-extern TFtype __floatditf (DItype);
+-extern TFtype __floatunditf (UDItype);
+ extern DFtype __floatdidf (DItype);
+ extern DFtype __floatundidf (UDItype);
+ extern SFtype __floatdisf (DItype);
+ extern SFtype __floatundisf (UDItype);
+-extern DItype __fixunstfdi (TFtype);
+ 
+ static DItype local_fixunssfdi (SFtype);
+ static DItype local_fixunsdfdi (DFtype);
+ 
+ DItype
+-__fixtfdi (TFtype a)
+-{
+-  if (a < 0)
+-    return - __fixunstfdi (-a);
+-  return __fixunstfdi (a);
+-}
+-
+-DItype
+ __fixdfdi (DFtype a)
+ {
+   if (a < 0)
+@@ -86,30 +73,6 @@
+   return (SItype) a;
+ }
+ 
+-TFtype
+-__floatditf (DItype u)
+-{
+-  DFtype dh, dl;
+-
+-  dh = (SItype) (u >> (sizeof (SItype) * 8));
+-  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
+-  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
+-
+-  return (TFtype) dh + (TFtype) dl;
+-}
+-
+-TFtype
+-__floatunditf (UDItype u)
+-{
+-  DFtype dh, dl;
+-
+-  dh = (USItype) (u >> (sizeof (SItype) * 8));
+-  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
+-  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
+-
+-  return (TFtype) dh + (TFtype) dl;
+-}
+-
+ DFtype
+ __floatdidf (DItype u)
+ {
+@@ -183,30 +146,6 @@
+   return (SFtype) f;
+ }
+ 
+-DItype
+-__fixunstfdi (TFtype a)
+-{
+-  if (a < 0)
+-    return 0;
+-
+-  /* Compute high word of result, as a flonum.  */
+-  const TFtype b = (a / (((UDItype) 1) << (sizeof (SItype) * 8)));
+-  /* Convert that to fixed (but not to DItype!),
+-     and shift it into the high word.  */
+-  UDItype v = (USItype) b;
+-  v <<= (sizeof (SItype) * 8);
+-  /* Remove high part from the TFtype, leaving the low part as flonum.  */
+-  a -= (TFtype) v;
+-  /* Convert that to fixed (but not to DItype!) and add it in.
+-     Sometimes A comes out negative.  This is significant, since
+-     A has more bits than a long int does.  */
+-  if (a < 0)
+-    v -= (USItype) (-a);
+-  else
+-    v += (USItype) a;
+-  return v;
+-}
+-
+ /* This version is needed to prevent recursion; fixunsdfdi in libgcc
+    calls fixdfdi, which in turn calls calls fixunsdfdi.  */
+ 
+diff --git a/libgcc/config/rs6000/quad-float128.h b/libgcc/config/rs6000/quad-float128.h
+--- a/libgcc/config/rs6000/quad-float128.h	2018-12-12 17:53:49.540038500 -0500
++++ b/libgcc/config/rs6000/quad-float128.h	2018-12-12 17:30:19.423468244 -0500
+@@ -104,6 +104,11 @@
+ extern UTItype_ppc __fixunskfti (TFtype);
+ extern TFtype __floattikf (TItype_ppc);
+ extern TFtype __floatuntikf (UTItype_ppc);
++
++extern DItype_ppc __fixtfdi (TFtype);
++extern DItype_ppc __fixunstfdi (TFtype);
++extern TFtype __floatditf (DItype_ppc);
++extern TFtype __floatunditf (UDItype_ppc);
+ #endif
+ 
+ /* Functions using the ISA 3.0 hardware support.  If the code is compiled with
+diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128
+--- a/libgcc/config/rs6000/t-float128	2018-12-12 17:53:49.540038500 -0500
++++ b/libgcc/config/rs6000/t-float128	2018-12-12 17:45:12.233937136 -0500
+@@ -24,6 +24,7 @@
+ 
+ # New functions for software emulation
+ fp128_ppc_funcs		= floattikf floatuntikf fixkfti fixunskfti \
++			  floatditf floatunditf fixtfdi fixunstfdi \
+ 			  extendkftf2-sw trunctfkf2-sw \
+ 			  sfp-exceptions _mulkc3 _divkc3 _powikf2
+ 
+
 diff --git a/libgcc/configure b/libgcc/configure
 old mode 100644
 new mode 100755
-- 
2.7.4



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

* [PATCH 12/13] gcc: Enable secureplt for powerpc64 target too
  2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
                   ` (10 preceding siblings ...)
  2018-12-14 17:54 ` [PATCH 11/13] gcc: More places to patch to disable ldbl 128 for musl on PPC Serhey Popovych
@ 2018-12-14 17:54 ` Serhey Popovych
  2018-12-14 17:54 ` [PATCH 13/13] gcc-7.3, gcc-8.2: Use variable SYSTEMLIBS_DIR instead of hardcoding it for ppc64 Serhey Popovych
  2018-12-14 23:46 ` [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Khem Raj
  13 siblings, 0 replies; 28+ messages in thread
From: Serhey Popovych @ 2018-12-14 17:54 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 meta/recipes-devtools/gcc/gcc-common.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
index 00fec0b..06c9033 100644
--- a/meta/recipes-devtools/gcc/gcc-common.inc
+++ b/meta/recipes-devtools/gcc/gcc-common.inc
@@ -38,7 +38,7 @@ def get_gcc_mips_plt_setting(bb, d):
     return ""
 
 def get_gcc_ppc_plt_settings(bb, d):
-    if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc' ] and not bb.utils.contains('DISTRO_FEATURES', 'bssplt', True, False, d):
+    if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc', 'powerpc64' ] and not bb.utils.contains('DISTRO_FEATURES', 'bssplt', True, False, d):
         return "--enable-secureplt"
     return ""
 
-- 
2.7.4



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

* [PATCH 13/13] gcc-7.3, gcc-8.2: Use variable SYSTEMLIBS_DIR instead of hardcoding it for ppc64
  2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
                   ` (11 preceding siblings ...)
  2018-12-14 17:54 ` [PATCH 12/13] gcc: Enable secureplt for powerpc64 target too Serhey Popovych
@ 2018-12-14 17:54 ` Serhey Popovych
  2018-12-14 23:46 ` [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Khem Raj
  13 siblings, 0 replies; 28+ messages in thread
From: Serhey Popovych @ 2018-12-14 17:54 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 meta/recipes-devtools/gcc/gcc-7.3.inc              |  1 +
 ...werpc-powerpc64-Add-support-for-musl-ldso.patch | 31 ++++++++++++++++++++++
 meta/recipes-devtools/gcc/gcc-8.2.inc              |  1 +
 ...werpc-powerpc64-Add-support-for-musl-ldso.patch | 31 ++++++++++++++++++++++
 4 files changed, 64 insertions(+)
 create mode 100644 meta/recipes-devtools/gcc/gcc-7.3/0050-powerpc-powerpc64-Add-support-for-musl-ldso.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-8.2/0042-powerpc-powerpc64-Add-support-for-musl-ldso.patch

diff --git a/meta/recipes-devtools/gcc/gcc-7.3.inc b/meta/recipes-devtools/gcc/gcc-7.3.inc
index c7c88f1..e16d03f 100644
--- a/meta/recipes-devtools/gcc/gcc-7.3.inc
+++ b/meta/recipes-devtools/gcc/gcc-7.3.inc
@@ -72,6 +72,7 @@ SRC_URI = "\
            file://0047-sync-gcc-stddef.h-with-musl.patch \
            file://0048-gcc-Enable-static-PIE.patch \
            file://0049-gcc-override-TARGET_LIBC_PROVIDES_SSP.patch \
+           file://0050-powerpc-powerpc64-Add-support-for-musl-ldso.patch \
            file://fix-segmentation-fault-precompiled-hdr.patch \
            file://no-sse-fix-test-case-failures.patch \
            ${BACKPORTS} \
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0050-powerpc-powerpc64-Add-support-for-musl-ldso.patch b/meta/recipes-devtools/gcc/gcc-7.3/0050-powerpc-powerpc64-Add-support-for-musl-ldso.patch
new file mode 100644
index 0000000..b0c735b
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0050-powerpc-powerpc64-Add-support-for-musl-ldso.patch
@@ -0,0 +1,31 @@
+From 3f5f5da776be86b408a15f38c9782f2185f97073 Mon Sep 17 00:00:00 2001
+From: Serhey Popovych <serhe.popovych@gmail.com>
+Date: Tue, 11 Dec 2018 02:30:50 -0500
+Subject: [PATCH] powerpc/powerpc64: Add support for musl ldso
+
+Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
+---
+Upstream-Status: Inappropriate [OE-Specific]
+
+ gcc/config/rs6000/linux64.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
+index 619e113..ee8b44f 100644
+--- a/gcc/config/rs6000/linux64.h
++++ b/gcc/config/rs6000/linux64.h
+@@ -421,9 +421,9 @@ extern int dot_symbols;
+ #endif
+ 
+ #define MUSL_DYNAMIC_LINKER32 \
+-  "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
++  SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ #define MUSL_DYNAMIC_LINKER64 \
+-  "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
++  SYSTEMLIBS_DIR "ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ 
+ #define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
+ #define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
+-- 
+2.7.4
+
diff --git a/meta/recipes-devtools/gcc/gcc-8.2.inc b/meta/recipes-devtools/gcc/gcc-8.2.inc
index 866a775..206e157 100644
--- a/meta/recipes-devtools/gcc/gcc-8.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-8.2.inc
@@ -70,6 +70,7 @@ SRC_URI = "\
            file://0039-Fix-for-testsuite-failure.patch \
            file://0040-Re-introduce-spe-commandline-options.patch \
            file://0041-ARC-fix-spec-gen.patch \
+           file://0042-powerpc-powerpc64-Add-support-for-musl-ldso.patch \
            ${BACKPORTS} \
 "
 BACKPORTS = "\
diff --git a/meta/recipes-devtools/gcc/gcc-8.2/0042-powerpc-powerpc64-Add-support-for-musl-ldso.patch b/meta/recipes-devtools/gcc/gcc-8.2/0042-powerpc-powerpc64-Add-support-for-musl-ldso.patch
new file mode 100644
index 0000000..b0c735b
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-8.2/0042-powerpc-powerpc64-Add-support-for-musl-ldso.patch
@@ -0,0 +1,31 @@
+From 3f5f5da776be86b408a15f38c9782f2185f97073 Mon Sep 17 00:00:00 2001
+From: Serhey Popovych <serhe.popovych@gmail.com>
+Date: Tue, 11 Dec 2018 02:30:50 -0500
+Subject: [PATCH] powerpc/powerpc64: Add support for musl ldso
+
+Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
+---
+Upstream-Status: Inappropriate [OE-Specific]
+
+ gcc/config/rs6000/linux64.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
+index 619e113..ee8b44f 100644
+--- a/gcc/config/rs6000/linux64.h
++++ b/gcc/config/rs6000/linux64.h
+@@ -421,9 +421,9 @@ extern int dot_symbols;
+ #endif
+ 
+ #define MUSL_DYNAMIC_LINKER32 \
+-  "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
++  SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ #define MUSL_DYNAMIC_LINKER64 \
+-  "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
++  SYSTEMLIBS_DIR "ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ 
+ #define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
+ #define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
+-- 
+2.7.4
+
-- 
2.7.4



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

* Re: [PATCH 07/13] musl: Ensure GLIBC_LDSO symlink target does not exist on reinstall
  2018-12-14 17:54 ` [PATCH 07/13] musl: Ensure GLIBC_LDSO symlink target does not exist on reinstall Serhey Popovych
@ 2018-12-14 19:09   ` Andre McCurdy
  2018-12-15 11:00     ` Richard Purdie
  0 siblings, 1 reply; 28+ messages in thread
From: Andre McCurdy @ 2018-12-14 19:09 UTC (permalink / raw)
  To: serhe.popovych; +Cc: OE Core mailing list

On Fri, Dec 14, 2018 at 9:57 AM Serhey Popovych
<serhe.popovych@gmail.com> wrote:
>
> Otherwise do_install task will fail on rebuild.
>
> Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
> ---
>  meta/recipes-core/musl/musl_git.bb | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
> index 9cc875c..4593cde 100644
> --- a/meta/recipes-core/musl/musl_git.bb
> +++ b/meta/recipes-core/musl/musl_git.bb
> @@ -61,7 +61,7 @@ do_install() {
>         oe_runmake install DESTDIR='${D}'
>
>         install -d ${D}${bindir}
> -       rm -f ${D}${bindir}/ldd
> +       rm -f ${D}${bindir}/ldd ${D}${GLIBC_LDSO}

The correct fix here is actually to remove this line entirely. The
official ruling is that there should be no expectation that re-running
do_install should work and patches to make it work are not acceptable.

  http://lists.openembedded.org/pipermail/openembedded-core/2018-September/273723.html

>         lnr ${D}${libdir}/libc.so ${D}${bindir}/ldd
>         lnr ${D}${libdir}/libc.so ${D}${GLIBC_LDSO}
>         for l in crypt dl m pthread resolv rt util xnet
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [PATCH 05/13] arch-powerpc64.inc: Use elfv2 ABI when building with musl
  2018-12-14 17:54 ` [PATCH 05/13] arch-powerpc64.inc: Use elfv2 ABI when building with musl Serhey Popovych
@ 2018-12-14 23:36   ` Khem Raj
  2018-12-17  9:36     ` Serhey Popovych
  0 siblings, 1 reply; 28+ messages in thread
From: Khem Raj @ 2018-12-14 23:36 UTC (permalink / raw)
  To: Serhey Popovych; +Cc: Patches and discussions about the oe-core layer

On Fri, Dec 14, 2018 at 9:56 AM Serhey Popovych
<serhe.popovych@gmail.com> wrote:
>
> Historically first PowerPC ABI was big-endian only (elfv1 currently). It
> is standard ABI for both 32-bit ppc and 64-bit ppc64 architectures.
>
> With PowerPC little-endian support new ABI was introduced (elfv2) and it
> is used primarily with ppc64le target only. While it has support for
> big-endian it is not commonly used and elfv1 still preferred.
>
> Musl does support only elfv2 ABI for both LE and BE and does not have
> any plans to support elfv1.
>
> Since then to build for powerpc64 with musl new ABI should be used. As
> expected it is not compatible with elfv1 but that isn't problem as long
> as there is no binary distributed software or assembly code written for
> elfv1 ABI.
>
> Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
> ---
>  meta/conf/machine/include/powerpc/arch-powerpc64.inc | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/meta/conf/machine/include/powerpc/arch-powerpc64.inc b/meta/conf/machine/include/powerpc/arch-powerpc64.inc
> index f751c6b..d9916d4 100644
> --- a/meta/conf/machine/include/powerpc/arch-powerpc64.inc
> +++ b/meta/conf/machine/include/powerpc/arch-powerpc64.inc
> @@ -7,6 +7,9 @@ TUNECONFLICTS[m64] = "m32 nf"
>  TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'm64', ' -m64', '', d)}"
>  TUNE_ARCH .= "${@bb.utils.contains('TUNE_FEATURES', [ 'm64' ], 'powerpc64', '', d)}"
>
> +# musl only supports elfv2 ABI for ppc64
> +TUNE_CCARGS .= "${@['', ' -mabi=elfv2']['libc-musl' in d.getVar('OVERRIDES').split(':')]}"
> +

I wonder if we should change gcc to use this ABI by default when
configured for ppc64/musl ?
This would avoid us adding compiler options here, in bad cases it may
be that other compilers
call it out differently.

>  # user mode qemu doesn't support ppc64
>  MACHINE_FEATURES_BACKFILL_CONSIDERED_append = " ${@bb.utils.contains('TUNE_FEATURES', 'm64', 'qemu-usermode', '', d)}"
>
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [PATCH 06/13] musl: Create default library search path based on configuration
  2018-12-14 17:54 ` [PATCH 06/13] musl: Create default library search path based on configuration Serhey Popovych
@ 2018-12-14 23:40   ` Khem Raj
  2018-12-17  9:37     ` Serhey Popovych
  0 siblings, 1 reply; 28+ messages in thread
From: Khem Raj @ 2018-12-14 23:40 UTC (permalink / raw)
  To: Serhey Popovych; +Cc: Patches and discussions about the oe-core layer

On Fri, Dec 14, 2018 at 9:57 AM Serhey Popovych
<serhe.popovych@gmail.com> wrote:
>
> In absence of /etc/ld-musl-$(ARCH).path file musl uses hardcoded default
> search path "/lib:/usr/local/lib:/usr/lib". This works for cases when
> system libraries installed in one of these pathes.
>
> However if lib64 or libx32 used as system library directories and no
> usr merge functionality enabled for distro musl dynamic loader cannot
> find libraries and finally execute binaries.
>
> Found while working on support for musl on powerpc64 builds where
> lib64 variant is used regardless of multilib being on or off.
>
> Fix by creating default search path based on configuration time values
> for syslibdir and libdir.

Lets take this fix to musl upstream at the same time. I think it does
have some value
but if upstream does not agree then we are in for supporting this
forever, and I would like
us to have upstream review on it first.

>
> Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
> ---
>  ...slibdir-and-libdir-as-default-pathes-to-l.patch | 61 ++++++++++++++++++++++
>  meta/recipes-core/musl/musl_git.bb                 |  1 +
>  2 files changed, 62 insertions(+)
>  create mode 100644 meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
>
> diff --git a/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch b/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
> new file mode 100644
> index 0000000..6a875a7
> --- /dev/null
> +++ b/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
> @@ -0,0 +1,61 @@
> +From 5a2886f81dbca3f2ed28eebe7d27d471da278db8 Mon Sep 17 00:00:00 2001
> +From: Serhey Popovych <serhe.popovych@gmail.com>
> +Date: Tue, 11 Dec 2018 05:44:20 -0500
> +Subject: [PATCH] ldso: Use syslibdir and libdir as default pathes to libdirs
> +
> +In absence of /etc/ld-musl-$(ARCH).path ldso uses default path to search
> +libraries /lib:/usr/local/lib:/usr/lib.
> +
> +However this path isn't relevant in case when library is put in dirs
> +like lib64 or libx32.
> +
> +Adjust CFLAGS_ALL to pass syslibdir as SYSLIBDIR and libdir as LIBDIR
> +preprocessor macroses to construct default ldso library search path
> +in ldso/dynlink.c::SYS_PATH_DFLT.
> +
> +Upstream-Status: Pending
> +Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
> +---
> + Makefile       | 3 ++-
> + ldso/dynlink.c | 4 +++-
> + 2 files changed, 5 insertions(+), 2 deletions(-)
> +
> +diff --git a/Makefile b/Makefile
> +index b46f8ca4..c07e4ae8 100644
> +--- a/Makefile
> ++++ b/Makefile
> +@@ -46,7 +46,8 @@ CFLAGS_AUTO = -Os -pipe
> + CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc
> +
> + CFLAGS_ALL = $(CFLAGS_C99FSE)
> +-CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/include -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include
> ++CFLAGS_ALL += -D_XOPEN_SOURCE=700 -DSYSLIBDIR='"$(syslibdir)"' -DLIBDIR='"$(libdir)"'
> ++CFLAGS_ALL += -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/include -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include
> + CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS)
> +
> + LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS)
> +diff --git a/ldso/dynlink.c b/ldso/dynlink.c
> +index ec921dfd..7c119c55 100644
> +--- a/ldso/dynlink.c
> ++++ b/ldso/dynlink.c
> +@@ -22,6 +22,8 @@
> + #include "dynlink.h"
> + #include "malloc_impl.h"
> +
> ++#define SYS_PATH_DFLT SYSLIBDIR ":" LIBDIR
> ++
> + static void error(const char *, ...);
> +
> + #define MAXP2(a,b) (-(-(a)&-(b)))
> +@@ -1038,7 +1040,7 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
> +                                       sys_path = "";
> +                               }
> +                       }
> +-                      if (!sys_path) sys_path = "/lib:/usr/local/lib:/usr/lib";
> ++                      if (!sys_path) sys_path = SYS_PATH_DFLT;
> +                       fd = path_open(name, sys_path, buf, sizeof buf);
> +               }
> +               pathname = buf;
> +--
> +2.7.4
> +
> diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
> index b416ec4..9cc875c 100644
> --- a/meta/recipes-core/musl/musl_git.bb
> +++ b/meta/recipes-core/musl/musl_git.bb
> @@ -12,6 +12,7 @@ PV = "1.1.20+git${SRCPV}"
>
>  SRC_URI = "git://git.musl-libc.org/musl \
>             file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \
> +           file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \
>            "
>
>  S = "${WORKDIR}/git"
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [PATCH 11/13] gcc: More places to patch to disable ldbl 128 for musl on PPC
  2018-12-14 17:54 ` [PATCH 11/13] gcc: More places to patch to disable ldbl 128 for musl on PPC Serhey Popovych
@ 2018-12-14 23:44   ` Khem Raj
  2018-12-15 12:06     ` Richard Purdie
  0 siblings, 1 reply; 28+ messages in thread
From: Khem Raj @ 2018-12-14 23:44 UTC (permalink / raw)
  To: Serhey Popovych; +Cc: Patches and discussions about the oe-core layer

On Fri, Dec 14, 2018 at 9:58 AM Serhey Popovych
<serhe.popovych@gmail.com> wrote:
>
> There are four functions using TFmode type (128bit) that isn't
> available when building with musl. Move each of them from common
> ppc64-fp.c to individual files referenced from t-float128 that used
> when ldbl 128 enabled at configure time.
>
> For gcc-7.3 if -mfloat128 is given -mfloat128-type must be given too.
>
> Exclude ibm-ldouble.c when ldbl 128 isn't enabled at config time.
>
> Build and boot tested with musl (no float128) and glibc (float128
> and ibm128 on PowerPC64).
>

We should be dropping gcc 7 support in master for next release. Gcc 8 one is ok
probably worth submitting it to gcc upstream as well.

> Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
> ---
>  ...44-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch | 391 ++++++++++++++++++++-
>  ...34-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch | 342 +++++++++++++++++-
>  2 files changed, 731 insertions(+), 2 deletions(-)
>
> diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch b/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
> index e39af9b..f4dd891 100644
> --- a/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
> +++ b/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
> @@ -36,14 +36,385 @@ diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux
>  index 4f6d4c4a4d2..c50dd94a2da 100644
>  --- a/libgcc/config/rs6000/t-linux
>  +++ b/libgcc/config/rs6000/t-linux
> -@@ -1,3 +1,6 @@
> +@@ -1,3 +1,9 @@
>   SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
>
>  -HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc
>  +ifeq ($(with_ldbl128),yes)
>  +HOST_LIBGCC2_CFLAGS += -mlong-double-128
> ++else
> ++# We do not want to build ibm-ldouble.c.
> ++LIB2ADD := $(filter-out %ibm-ldouble.c, $(LIB2ADD))
>  +endif
>  +HOST_LIBGCC2_CFLAGS += -mno-minimal-toc
> +diff --git a/libgcc/config/rs6000/fixtfdi.c b/libgcc/config/rs6000/fixtfdi.c
> +new file mode 100644
> +index 0000000..9b979d0
> +--- /dev/null
> ++++ b/libgcc/config/rs6000/fixtfdi.c
> +@@ -0,0 +1,42 @@
> ++/* Software floating-point emulation.
> ++   Convert a to 64bit signed integer
> ++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
> ++   This file is part of the GNU C Library.
> ++   Contributed by Richard Henderson (rth@cygnus.com) and
> ++                Jakub Jelinek (jj@ultra.linux.cz).
> ++
> ++   The GNU C Library is free software; you can redistribute it and/or
> ++   modify it under the terms of the GNU Lesser General Public
> ++   License as published by the Free Software Foundation; either
> ++   version 2.1 of the License, or (at your option) any later version.
> ++
> ++   In addition to the permissions in the GNU Lesser General Public
> ++   License, the Free Software Foundation gives you unlimited
> ++   permission to link the compiled version of this file into
> ++   combinations with other programs, and to distribute those
> ++   combinations without any restriction coming from the use of this
> ++   file.  (The Lesser General Public License restrictions do apply in
> ++   other respects; for example, they cover modification of the file,
> ++   and distribution when not linked into a combine executable.)
> ++
> ++   The GNU C Library is distributed in the hope that it will be useful,
> ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
> ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> ++   Lesser General Public License for more details.
> ++
> ++   You should have received a copy of the GNU Lesser General Public
> ++   License along with the GNU C Library; if not, see
> ++   <http://www.gnu.org/licenses/>.  */
> ++
> ++#ifdef _ARCH_PPC64
> ++#include "soft-fp.h"
> ++#include "quad-float128.h"
> ++
> ++DItype
> ++__fixtfdi (TFtype a)
> ++{
> ++  if (a < 0)
> ++    return - __fixunstfdi (-a);
> ++  return __fixunstfdi (a);
> ++}
> ++#endif
> +diff --git a/libgcc/config/rs6000/fixunstfdi.c b/libgcc/config/rs6000/fixunstfdi.c
> +new file mode 100644
> +index 0000000..65e9590
> +--- /dev/null
> ++++ b/libgcc/config/rs6000/fixunstfdi.c
> +@@ -0,0 +1,58 @@
> ++/* Software floating-point emulation.
> ++   Convert a to 64bit unsigned integer
> ++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
> ++   This file is part of the GNU C Library.
> ++   Contributed by Richard Henderson (rth@cygnus.com) and
> ++                Jakub Jelinek (jj@ultra.linux.cz).
> ++
> ++   The GNU C Library is free software; you can redistribute it and/or
> ++   modify it under the terms of the GNU Lesser General Public
> ++   License as published by the Free Software Foundation; either
> ++   version 2.1 of the License, or (at your option) any later version.
> ++
> ++   In addition to the permissions in the GNU Lesser General Public
> ++   License, the Free Software Foundation gives you unlimited
> ++   permission to link the compiled version of this file into
> ++   combinations with other programs, and to distribute those
> ++   combinations without any restriction coming from the use of this
> ++   file.  (The Lesser General Public License restrictions do apply in
> ++   other respects; for example, they cover modification of the file,
> ++   and distribution when not linked into a combine executable.)
> ++
> ++   The GNU C Library is distributed in the hope that it will be useful,
> ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
> ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> ++   Lesser General Public License for more details.
> ++
> ++   You should have received a copy of the GNU Lesser General Public
> ++   License along with the GNU C Library; if not, see
> ++   <http://www.gnu.org/licenses/>.  */
> ++
> ++#ifdef _ARCH_PPC64
> ++#include "soft-fp.h"
> ++#include "quad-float128.h"
> ++
> ++DItype
> ++__fixunstfdi (TFtype a)
> ++{
> ++  if (a < 0)
> ++    return 0;
> ++
> ++  /* Compute high word of result, as a flonum.  */
> ++  const TFtype b = (a / (((UDItype) 1) << (sizeof (SItype) * 8)));
> ++  /* Convert that to fixed (but not to DItype!),
> ++     and shift it into the high word.  */
> ++  UDItype v = (USItype) b;
> ++  v <<= (sizeof (SItype) * 8);
> ++  /* Remove high part from the TFtype, leaving the low part as flonum.  */
> ++  a -= (TFtype) v;
> ++  /* Convert that to fixed (but not to DItype!) and add it in.
> ++     Sometimes A comes out negative.  This is significant, since
> ++     A has more bits than a long int does.  */
> ++  if (a < 0)
> ++    v -= (USItype) (-a);
> ++  else
> ++    v += (USItype) a;
> ++  return v;
> ++}
> ++#endif
> +diff --git a/libgcc/config/rs6000/floatditf.c b/libgcc/config/rs6000/floatditf.c
> +new file mode 100644
> +index 0000000..20ad4c6
> +--- /dev/null
> ++++ b/libgcc/config/rs6000/floatditf.c
> +@@ -0,0 +1,47 @@
> ++/* Software floating-point emulation.
> ++   Convert a 64bit signed integer to IEEE quad
> ++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
> ++   This file is part of the GNU C Library.
> ++   Contributed by Richard Henderson (rth@cygnus.com) and
> ++                Jakub Jelinek (jj@ultra.linux.cz).
> ++
> ++   The GNU C Library is free software; you can redistribute it and/or
> ++   modify it under the terms of the GNU Lesser General Public
> ++   License as published by the Free Software Foundation; either
> ++   version 2.1 of the License, or (at your option) any later version.
> ++
> ++   In addition to the permissions in the GNU Lesser General Public
> ++   License, the Free Software Foundation gives you unlimited
> ++   permission to link the compiled version of this file into
> ++   combinations with other programs, and to distribute those
> ++   combinations without any restriction coming from the use of this
> ++   file.  (The Lesser General Public License restrictions do apply in
> ++   other respects; for example, they cover modification of the file,
> ++   and distribution when not linked into a combine executable.)
> ++
> ++   The GNU C Library is distributed in the hope that it will be useful,
> ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
> ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> ++   Lesser General Public License for more details.
> ++
> ++   You should have received a copy of the GNU Lesser General Public
> ++   License along with the GNU C Library; if not, see
> ++   <http://www.gnu.org/licenses/>.  */
> ++
> ++#ifdef _ARCH_PPC64
> ++#include "soft-fp.h"
> ++#include "double.h"
> ++#include "quad-float128.h"
> ++
> ++TFtype
> ++__floatditf (DItype u)
> ++{
> ++  DFtype dh, dl;
> ++
> ++  dh = (SItype) (u >> (sizeof (SItype) * 8));
> ++  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
> ++  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
> ++
> ++  return (TFtype) dh + (TFtype) dl;
> ++}
> ++#endif
> +diff --git a/libgcc/config/rs6000/floatunditf.c b/libgcc/config/rs6000/floatunditf.c
> +new file mode 100644
> +index 0000000..23dbde2
> +--- /dev/null
> ++++ b/libgcc/config/rs6000/floatunditf.c
> +@@ -0,0 +1,47 @@
> ++/* Software floating-point emulation.
> ++   Convert a 64bit unsigned integer to IEEE quad
> ++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
> ++   This file is part of the GNU C Library.
> ++   Contributed by Richard Henderson (rth@cygnus.com) and
> ++                Jakub Jelinek (jj@ultra.linux.cz).
> ++
> ++   The GNU C Library is free software; you can redistribute it and/or
> ++   modify it under the terms of the GNU Lesser General Public
> ++   License as published by the Free Software Foundation; either
> ++   version 2.1 of the License, or (at your option) any later version.
> ++
> ++   In addition to the permissions in the GNU Lesser General Public
> ++   License, the Free Software Foundation gives you unlimited
> ++   permission to link the compiled version of this file into
> ++   combinations with other programs, and to distribute those
> ++   combinations without any restriction coming from the use of this
> ++   file.  (The Lesser General Public License restrictions do apply in
> ++   other respects; for example, they cover modification of the file,
> ++   and distribution when not linked into a combine executable.)
> ++
> ++   The GNU C Library is distributed in the hope that it will be useful,
> ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
> ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> ++   Lesser General Public License for more details.
> ++
> ++   You should have received a copy of the GNU Lesser General Public
> ++   License along with the GNU C Library; if not, see
> ++   <http://www.gnu.org/licenses/>.  */
> ++
> ++#ifdef _ARCH_PPC64
> ++#include "soft-fp.h"
> ++#include "double.h"
> ++#include "quad-float128.h"
> ++
> ++TFtype
> ++__floatunditf (UDItype u)
> ++{
> ++  DFtype dh, dl;
> ++
> ++  dh = (USItype) (u >> (sizeof (SItype) * 8));
> ++  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
> ++  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
> ++
> ++  return (TFtype) dh + (TFtype) dl;
> ++}
> ++#endif
> +diff --git a/libgcc/config/rs6000/ppc64-fp.c b/libgcc/config/rs6000/ppc64-fp.c
> +index 5e1cbdd..70ad3c9 100644
> +--- a/libgcc/config/rs6000/ppc64-fp.c
> ++++ b/libgcc/config/rs6000/ppc64-fp.c
> +@@ -25,33 +25,20 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
> + <http://www.gnu.org/licenses/>.  */
> +
> + #if defined(__powerpc64__) || defined (__64BIT__) || defined(__ppc64__)
> +-#define TMODES
> + #include "fp-bit.h"
> +
> +-extern DItype __fixtfdi (TFtype);
> + extern DItype __fixdfdi (DFtype);
> + extern DItype __fixsfdi (SFtype);
> + extern USItype __fixunsdfsi (DFtype);
> + extern USItype __fixunssfsi (SFtype);
> +-extern TFtype __floatditf (DItype);
> +-extern TFtype __floatunditf (UDItype);
> + extern DFtype __floatdidf (DItype);
> + extern DFtype __floatundidf (UDItype);
> + extern SFtype __floatdisf (DItype);
> + extern SFtype __floatundisf (UDItype);
> +-extern DItype __fixunstfdi (TFtype);
> +
> + static DItype local_fixunssfdi (SFtype);
> + static DItype local_fixunsdfdi (DFtype);
> +
> +-DItype
> +-__fixtfdi (TFtype a)
> +-{
> +-  if (a < 0)
> +-    return - __fixunstfdi (-a);
> +-  return __fixunstfdi (a);
> +-}
> +-
> + DItype
> + __fixdfdi (DFtype a)
> + {
> +@@ -86,30 +73,6 @@ __fixunssfsi (SFtype a)
> +   return (SItype) a;
> + }
> +
> +-TFtype
> +-__floatditf (DItype u)
> +-{
> +-  DFtype dh, dl;
> +-
> +-  dh = (SItype) (u >> (sizeof (SItype) * 8));
> +-  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
> +-  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
> +-
> +-  return (TFtype) dh + (TFtype) dl;
> +-}
> +-
> +-TFtype
> +-__floatunditf (UDItype u)
> +-{
> +-  DFtype dh, dl;
> +-
> +-  dh = (USItype) (u >> (sizeof (SItype) * 8));
> +-  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
> +-  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
> +-
> +-  return (TFtype) dh + (TFtype) dl;
> +-}
> +-
> + DFtype
> + __floatdidf (DItype u)
> + {
> +@@ -183,30 +146,6 @@ __floatundisf (UDItype u)
> +   return (SFtype) f;
> + }
> +
> +-DItype
> +-__fixunstfdi (TFtype a)
> +-{
> +-  if (a < 0)
> +-    return 0;
> +-
> +-  /* Compute high word of result, as a flonum.  */
> +-  const TFtype b = (a / (((UDItype) 1) << (sizeof (SItype) * 8)));
> +-  /* Convert that to fixed (but not to DItype!),
> +-     and shift it into the high word.  */
> +-  UDItype v = (USItype) b;
> +-  v <<= (sizeof (SItype) * 8);
> +-  /* Remove high part from the TFtype, leaving the low part as flonum.  */
> +-  a -= (TFtype) v;
> +-  /* Convert that to fixed (but not to DItype!) and add it in.
> +-     Sometimes A comes out negative.  This is significant, since
> +-     A has more bits than a long int does.  */
> +-  if (a < 0)
> +-    v -= (USItype) (-a);
> +-  else
> +-    v += (USItype) a;
> +-  return v;
> +-}
> +-
> + /* This version is needed to prevent recursion; fixunsdfdi in libgcc
> +    calls fixdfdi, which in turn calls calls fixunsdfdi.  */
> +
> +diff --git a/libgcc/config/rs6000/quad-float128.h b/libgcc/config/rs6000/quad-float128.h
> +index 7d69c87..a0c2664 100644
> +--- a/libgcc/config/rs6000/quad-float128.h
> ++++ b/libgcc/config/rs6000/quad-float128.h
> +@@ -99,6 +99,11 @@ extern TItype_ppc __fixkfti (TFtype);
> + extern UTItype_ppc __fixunskfti (TFtype);
> + extern TFtype __floattikf (TItype_ppc);
> + extern TFtype __floatuntikf (UTItype_ppc);
> ++
> ++extern DItype_ppc __fixtfdi (TFtype);
> ++extern DItype_ppc __fixunstfdi (TFtype);
> ++extern TFtype __floatditf (DItype_ppc);
> ++extern TFtype __floatunditf (UDItype_ppc);
> + #endif
> +
> + /* Functions using the ISA 3.0 hardware support.  If the code is compiled with
> +diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128
> +index 2c52ca6..3a241aa 100644
> +--- a/libgcc/config/rs6000/t-float128
> ++++ b/libgcc/config/rs6000/t-float128
> +@@ -24,6 +24,7 @@ fp128_softfp_obj     = $(fp128_softfp_static_obj) $(fp128_softfp_shared_obj)
> +
> + # New functions for software emulation
> + fp128_ppc_funcs               = floattikf floatuntikf fixkfti fixunskfti \
> ++                        floatditf floatunditf fixtfdi fixunstfdi \
> +                         extendkftf2-sw trunctfkf2-sw \
> +                         sfp-exceptions _mulkc3 _divkc3
> +
> +@@ -58,7 +59,7 @@ fp128_includes               = $(srcdir)/soft-fp/double.h \
> +                         $(srcdir)/soft-fp/soft-fp.h
> +
> + # Build the emulator without ISA 3.0 hardware support.
> +-FP128_CFLAGS_SW                = -Wno-type-limits -mvsx -mfloat128 \
> ++FP128_CFLAGS_SW                = -Wno-type-limits -mvsx -mfloat128 -mfloat128-type \
> +                          -mno-float128-hardware \
> +                          -I$(srcdir)/soft-fp \
> +                          -I$(srcdir)/config/rs6000 \
> +diff --git a/libgcc/config/rs6000/t-float128-hw b/libgcc/config/rs6000/t-float128-hw
> +index 161062f..0476874 100644
> +--- a/libgcc/config/rs6000/t-float128-hw
> ++++ b/libgcc/config/rs6000/t-float128-hw
> +@@ -21,7 +21,7 @@ fp128_ifunc_obj              = $(fp128_ifunc_static_obj) $(fp128_ifunc_shared_obj)
> + fp128_sed_hw          = -hw
> +
> + # Build the hardware support functions with appropriate hardware support
> +-FP128_CFLAGS_HW                = -Wno-type-limits -mvsx -mfloat128 \
> ++FP128_CFLAGS_HW                = -Wno-type-limits -mvsx -mfloat128 -mfloat128-type \
> +                          -mpower8-vector -mpower9-vector \
> +                          -mfloat128-hardware \
> +                          -I$(srcdir)/soft-fp \
>  diff --git a/libgcc/configure b/libgcc/configure
>  old mode 100644
>  new mode 100755
> @@ -96,6 +467,15 @@ index 45c459788c3..e2d19b144b8
>   # Check whether --with-aix-soname was given.
>   if test "${with_aix_soname+set}" = set; then :
>     withval=$with_aix_soname; case "${host}:${enable_shared}" in
> +@@ -4999,7 +4999,7 @@ case ${host} in
> + # for hardware support.
> + powerpc*-*-linux*)
> +   saved_CFLAGS="$CFLAGS"
> +-  CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
> ++  CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128 -mfloat128-type"
> +   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC ISA 2.06 to build __float128 libraries" >&5
> + $as_echo_n "checking for PowerPC ISA 2.06 to build __float128 libraries... " >&6; }
> + if test "${libgcc_cv_powerpc_float128+set}" = set; then :
>  diff --git a/libgcc/configure.ac b/libgcc/configure.ac
>  index af151473709..dada52416da 100644
>  --- a/libgcc/configure.ac
> @@ -119,6 +499,15 @@ index af151473709..dada52416da 100644
>   AC_ARG_WITH(aix-soname,
>   [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
>       [shared library versioning (aka "SONAME") variant to provide on AIX])],
> +@@ -394,7 +394,7 @@ case ${host} in
> + # for hardware support.
> + powerpc*-*-linux*)
> +   saved_CFLAGS="$CFLAGS"
> +-  CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
> ++  CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128 -mfloat128-type"
> +   AC_CACHE_CHECK([for PowerPC ISA 2.06 to build __float128 libraries],
> +                [libgcc_cv_powerpc_float128],
> +                [AC_COMPILE_IFELSE(
>  --
>  2.12.2
>
> diff --git a/meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch b/meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
> index 7a69ea2..391cda7 100644
> --- a/meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
> +++ b/meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
> @@ -37,14 +37,354 @@ diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux
>  index 4f6d4c4a4d2..c50dd94a2da 100644
>  --- a/libgcc/config/rs6000/t-linux
>  +++ b/libgcc/config/rs6000/t-linux
> -@@ -1,3 +1,6 @@
> +@@ -1,3 +1,9 @@
>   SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
>
>  -HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc
>  +ifeq ($(with_ldbl128),yes)
>  +HOST_LIBGCC2_CFLAGS += -mlong-double-128
> ++else
> ++# We do not want to build ibm-ldouble.c.
> ++LIB2ADD := $(filter-out %ibm-ldouble.c, $(LIB2ADD))
>  +endif
>  +HOST_LIBGCC2_CFLAGS += -mno-minimal-toc
> +diff --git a/libgcc/config/rs6000/fixtfdi.c b/libgcc/config/rs6000/fixtfdi.c
> +--- a/libgcc/config/rs6000/fixtfdi.c   1969-12-31 19:00:00.000000000 -0500
> ++++ b/libgcc/config/rs6000/fixtfdi.c   2018-12-12 17:54:50.110755540 -0500
> +@@ -0,0 +1,42 @@
> ++/* Software floating-point emulation.
> ++   Convert a to 64bit signed integer
> ++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
> ++   This file is part of the GNU C Library.
> ++   Contributed by Richard Henderson (rth@cygnus.com) and
> ++                Jakub Jelinek (jj@ultra.linux.cz).
> ++
> ++   The GNU C Library is free software; you can redistribute it and/or
> ++   modify it under the terms of the GNU Lesser General Public
> ++   License as published by the Free Software Foundation; either
> ++   version 2.1 of the License, or (at your option) any later version.
> ++
> ++   In addition to the permissions in the GNU Lesser General Public
> ++   License, the Free Software Foundation gives you unlimited
> ++   permission to link the compiled version of this file into
> ++   combinations with other programs, and to distribute those
> ++   combinations without any restriction coming from the use of this
> ++   file.  (The Lesser General Public License restrictions do apply in
> ++   other respects; for example, they cover modification of the file,
> ++   and distribution when not linked into a combine executable.)
> ++
> ++   The GNU C Library is distributed in the hope that it will be useful,
> ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
> ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> ++   Lesser General Public License for more details.
> ++
> ++   You should have received a copy of the GNU Lesser General Public
> ++   License along with the GNU C Library; if not, see
> ++   <http://www.gnu.org/licenses/>.  */
> ++
> ++#ifdef _ARCH_PPC64
> ++#include "soft-fp.h"
> ++#include "quad-float128.h"
> ++
> ++DItype
> ++__fixtfdi (TFtype a)
> ++{
> ++  if (a < 0)
> ++    return - __fixunstfdi (-a);
> ++  return __fixunstfdi (a);
> ++}
> ++#endif
> +diff --git a/libgcc/config/rs6000/fixunstfdi.c b/libgcc/config/rs6000/fixunstfdi.c
> +--- a/libgcc/config/rs6000/fixunstfdi.c        1969-12-31 19:00:00.000000000 -0500
> ++++ b/libgcc/config/rs6000/fixunstfdi.c        2018-12-12 17:56:06.141654537 -0500
> +@@ -0,0 +1,58 @@
> ++/* Software floating-point emulation.
> ++   Convert a to 64bit unsigned integer
> ++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
> ++   This file is part of the GNU C Library.
> ++   Contributed by Richard Henderson (rth@cygnus.com) and
> ++                Jakub Jelinek (jj@ultra.linux.cz).
> ++
> ++   The GNU C Library is free software; you can redistribute it and/or
> ++   modify it under the terms of the GNU Lesser General Public
> ++   License as published by the Free Software Foundation; either
> ++   version 2.1 of the License, or (at your option) any later version.
> ++
> ++   In addition to the permissions in the GNU Lesser General Public
> ++   License, the Free Software Foundation gives you unlimited
> ++   permission to link the compiled version of this file into
> ++   combinations with other programs, and to distribute those
> ++   combinations without any restriction coming from the use of this
> ++   file.  (The Lesser General Public License restrictions do apply in
> ++   other respects; for example, they cover modification of the file,
> ++   and distribution when not linked into a combine executable.)
> ++
> ++   The GNU C Library is distributed in the hope that it will be useful,
> ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
> ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> ++   Lesser General Public License for more details.
> ++
> ++   You should have received a copy of the GNU Lesser General Public
> ++   License along with the GNU C Library; if not, see
> ++   <http://www.gnu.org/licenses/>.  */
> ++
> ++#ifdef _ARCH_PPC64
> ++#include "soft-fp.h"
> ++#include "quad-float128.h"
> ++
> ++DItype
> ++__fixunstfdi (TFtype a)
> ++{
> ++  if (a < 0)
> ++    return 0;
> ++
> ++  /* Compute high word of result, as a flonum.  */
> ++  const TFtype b = (a / (((UDItype) 1) << (sizeof (SItype) * 8)));
> ++  /* Convert that to fixed (but not to DItype!),
> ++     and shift it into the high word.  */
> ++  UDItype v = (USItype) b;
> ++  v <<= (sizeof (SItype) * 8);
> ++  /* Remove high part from the TFtype, leaving the low part as flonum.  */
> ++  a -= (TFtype) v;
> ++  /* Convert that to fixed (but not to DItype!) and add it in.
> ++     Sometimes A comes out negative.  This is significant, since
> ++     A has more bits than a long int does.  */
> ++  if (a < 0)
> ++    v -= (USItype) (-a);
> ++  else
> ++    v += (USItype) a;
> ++  return v;
> ++}
> ++#endif
> +diff --git a/libgcc/config/rs6000/floatditf.c b/libgcc/config/rs6000/floatditf.c
> +--- a/libgcc/config/rs6000/floatditf.c 1969-12-31 19:00:00.000000000 -0500
> ++++ b/libgcc/config/rs6000/floatditf.c 2018-12-12 17:57:55.852953553 -0500
> +@@ -0,0 +1,47 @@
> ++/* Software floating-point emulation.
> ++   Convert a 64bit signed integer to IEEE quad
> ++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
> ++   This file is part of the GNU C Library.
> ++   Contributed by Richard Henderson (rth@cygnus.com) and
> ++                Jakub Jelinek (jj@ultra.linux.cz).
> ++
> ++   The GNU C Library is free software; you can redistribute it and/or
> ++   modify it under the terms of the GNU Lesser General Public
> ++   License as published by the Free Software Foundation; either
> ++   version 2.1 of the License, or (at your option) any later version.
> ++
> ++   In addition to the permissions in the GNU Lesser General Public
> ++   License, the Free Software Foundation gives you unlimited
> ++   permission to link the compiled version of this file into
> ++   combinations with other programs, and to distribute those
> ++   combinations without any restriction coming from the use of this
> ++   file.  (The Lesser General Public License restrictions do apply in
> ++   other respects; for example, they cover modification of the file,
> ++   and distribution when not linked into a combine executable.)
> ++
> ++   The GNU C Library is distributed in the hope that it will be useful,
> ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
> ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> ++   Lesser General Public License for more details.
> ++
> ++   You should have received a copy of the GNU Lesser General Public
> ++   License along with the GNU C Library; if not, see
> ++   <http://www.gnu.org/licenses/>.  */
> ++
> ++#ifdef _ARCH_PPC64
> ++#include "soft-fp.h"
> ++#include "double.h"
> ++#include "quad-float128.h"
> ++
> ++TFtype
> ++__floatditf (DItype u)
> ++{
> ++  DFtype dh, dl;
> ++
> ++  dh = (SItype) (u >> (sizeof (SItype) * 8));
> ++  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
> ++  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
> ++
> ++  return (TFtype) dh + (TFtype) dl;
> ++}
> ++#endif
> +diff --git a/libgcc/config/rs6000/floatunditf.c b/libgcc/config/rs6000/floatunditf.c
> +--- a/libgcc/config/rs6000/floatunditf.c       1969-12-31 19:00:00.000000000 -0500
> ++++ b/libgcc/config/rs6000/floatunditf.c       2018-12-12 17:57:15.262473574 -0500
> +@@ -0,0 +1,47 @@
> ++/* Software floating-point emulation.
> ++   Convert a 64bit unsigned integer to IEEE quad
> ++   Copyright (C) 1997-2016 Free Software Foundation, Inc.
> ++   This file is part of the GNU C Library.
> ++   Contributed by Richard Henderson (rth@cygnus.com) and
> ++                Jakub Jelinek (jj@ultra.linux.cz).
> ++
> ++   The GNU C Library is free software; you can redistribute it and/or
> ++   modify it under the terms of the GNU Lesser General Public
> ++   License as published by the Free Software Foundation; either
> ++   version 2.1 of the License, or (at your option) any later version.
> ++
> ++   In addition to the permissions in the GNU Lesser General Public
> ++   License, the Free Software Foundation gives you unlimited
> ++   permission to link the compiled version of this file into
> ++   combinations with other programs, and to distribute those
> ++   combinations without any restriction coming from the use of this
> ++   file.  (The Lesser General Public License restrictions do apply in
> ++   other respects; for example, they cover modification of the file,
> ++   and distribution when not linked into a combine executable.)
> ++
> ++   The GNU C Library is distributed in the hope that it will be useful,
> ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
> ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> ++   Lesser General Public License for more details.
> ++
> ++   You should have received a copy of the GNU Lesser General Public
> ++   License along with the GNU C Library; if not, see
> ++   <http://www.gnu.org/licenses/>.  */
> ++
> ++#ifdef _ARCH_PPC64
> ++#include "soft-fp.h"
> ++#include "double.h"
> ++#include "quad-float128.h"
> ++
> ++TFtype
> ++__floatunditf (UDItype u)
> ++{
> ++  DFtype dh, dl;
> ++
> ++  dh = (USItype) (u >> (sizeof (SItype) * 8));
> ++  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
> ++  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
> ++
> ++  return (TFtype) dh + (TFtype) dl;
> ++}
> ++#endif
> +diff --git a/libgcc/config/rs6000/ppc64-fp.c b/libgcc/config/rs6000/ppc64-fp.c
> +--- a/libgcc/config/rs6000/ppc64-fp.c  2018-12-12 17:53:49.540038500 -0500
> ++++ b/libgcc/config/rs6000/ppc64-fp.c  2018-12-12 17:49:51.897235314 -0500
> +@@ -25,34 +25,21 @@
> + <http://www.gnu.org/licenses/>.  */
> +
> + #if defined(__powerpc64__) || defined (__64BIT__) || defined(__ppc64__)
> +-#define TMODES
> + #include "fp-bit.h"
> +
> +-extern DItype __fixtfdi (TFtype);
> + extern DItype __fixdfdi (DFtype);
> + extern DItype __fixsfdi (SFtype);
> + extern USItype __fixunsdfsi (DFtype);
> + extern USItype __fixunssfsi (SFtype);
> +-extern TFtype __floatditf (DItype);
> +-extern TFtype __floatunditf (UDItype);
> + extern DFtype __floatdidf (DItype);
> + extern DFtype __floatundidf (UDItype);
> + extern SFtype __floatdisf (DItype);
> + extern SFtype __floatundisf (UDItype);
> +-extern DItype __fixunstfdi (TFtype);
> +
> + static DItype local_fixunssfdi (SFtype);
> + static DItype local_fixunsdfdi (DFtype);
> +
> + DItype
> +-__fixtfdi (TFtype a)
> +-{
> +-  if (a < 0)
> +-    return - __fixunstfdi (-a);
> +-  return __fixunstfdi (a);
> +-}
> +-
> +-DItype
> + __fixdfdi (DFtype a)
> + {
> +   if (a < 0)
> +@@ -86,30 +73,6 @@
> +   return (SItype) a;
> + }
> +
> +-TFtype
> +-__floatditf (DItype u)
> +-{
> +-  DFtype dh, dl;
> +-
> +-  dh = (SItype) (u >> (sizeof (SItype) * 8));
> +-  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
> +-  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
> +-
> +-  return (TFtype) dh + (TFtype) dl;
> +-}
> +-
> +-TFtype
> +-__floatunditf (UDItype u)
> +-{
> +-  DFtype dh, dl;
> +-
> +-  dh = (USItype) (u >> (sizeof (SItype) * 8));
> +-  dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
> +-  dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
> +-
> +-  return (TFtype) dh + (TFtype) dl;
> +-}
> +-
> + DFtype
> + __floatdidf (DItype u)
> + {
> +@@ -183,30 +146,6 @@
> +   return (SFtype) f;
> + }
> +
> +-DItype
> +-__fixunstfdi (TFtype a)
> +-{
> +-  if (a < 0)
> +-    return 0;
> +-
> +-  /* Compute high word of result, as a flonum.  */
> +-  const TFtype b = (a / (((UDItype) 1) << (sizeof (SItype) * 8)));
> +-  /* Convert that to fixed (but not to DItype!),
> +-     and shift it into the high word.  */
> +-  UDItype v = (USItype) b;
> +-  v <<= (sizeof (SItype) * 8);
> +-  /* Remove high part from the TFtype, leaving the low part as flonum.  */
> +-  a -= (TFtype) v;
> +-  /* Convert that to fixed (but not to DItype!) and add it in.
> +-     Sometimes A comes out negative.  This is significant, since
> +-     A has more bits than a long int does.  */
> +-  if (a < 0)
> +-    v -= (USItype) (-a);
> +-  else
> +-    v += (USItype) a;
> +-  return v;
> +-}
> +-
> + /* This version is needed to prevent recursion; fixunsdfdi in libgcc
> +    calls fixdfdi, which in turn calls calls fixunsdfdi.  */
> +
> +diff --git a/libgcc/config/rs6000/quad-float128.h b/libgcc/config/rs6000/quad-float128.h
> +--- a/libgcc/config/rs6000/quad-float128.h     2018-12-12 17:53:49.540038500 -0500
> ++++ b/libgcc/config/rs6000/quad-float128.h     2018-12-12 17:30:19.423468244 -0500
> +@@ -104,6 +104,11 @@
> + extern UTItype_ppc __fixunskfti (TFtype);
> + extern TFtype __floattikf (TItype_ppc);
> + extern TFtype __floatuntikf (UTItype_ppc);
> ++
> ++extern DItype_ppc __fixtfdi (TFtype);
> ++extern DItype_ppc __fixunstfdi (TFtype);
> ++extern TFtype __floatditf (DItype_ppc);
> ++extern TFtype __floatunditf (UDItype_ppc);
> + #endif
> +
> + /* Functions using the ISA 3.0 hardware support.  If the code is compiled with
> +diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128
> +--- a/libgcc/config/rs6000/t-float128  2018-12-12 17:53:49.540038500 -0500
> ++++ b/libgcc/config/rs6000/t-float128  2018-12-12 17:45:12.233937136 -0500
> +@@ -24,6 +24,7 @@
> +
> + # New functions for software emulation
> + fp128_ppc_funcs               = floattikf floatuntikf fixkfti fixunskfti \
> ++                        floatditf floatunditf fixtfdi fixunstfdi \
> +                         extendkftf2-sw trunctfkf2-sw \
> +                         sfp-exceptions _mulkc3 _divkc3 _powikf2
> +
> +
>  diff --git a/libgcc/configure b/libgcc/configure
>  old mode 100644
>  new mode 100755
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc
  2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
                   ` (12 preceding siblings ...)
  2018-12-14 17:54 ` [PATCH 13/13] gcc-7.3, gcc-8.2: Use variable SYSTEMLIBS_DIR instead of hardcoding it for ppc64 Serhey Popovych
@ 2018-12-14 23:46 ` Khem Raj
  2018-12-17  9:56   ` Serhey Popovych
  13 siblings, 1 reply; 28+ messages in thread
From: Khem Raj @ 2018-12-14 23:46 UTC (permalink / raw)
  To: Serhey Popovych; +Cc: Patches and discussions about the oe-core layer

Serhey

Thanks for doing this work and really a clean pull request with good
explanation that I have seen lately. Good work, For most parts
everything is in order except few places where I have replied
specifically to the patches

On Fri, Dec 14, 2018 at 9:55 AM Serhey Popovych
<serhe.popovych@gmail.com> wrote:
>
> Musl has support for ppc (32bit) and ppc64 (64bit). OE still missing
> several tricks in configuration to make builds possible:
>
>   1) Most important part is that musl implements elfv2 ABI only for
>      64bit PowerPC. That ABI is default for little-endian but supports
>      big-endian too. Historically elfv1 ABI is used for big-endian
>      PowerPC.
>
>   2) Using uncommon elfv2 ABI for big-endian requires to disable all
>      assembler optimizations in openssl: unfortunately I can't find more
>      smart way at the moment.
>
>   3) LDSO path need to be adjusted to support /lib64 path which is
>      default for powerpc64 (see bitbake.conf) instead of $baselibdir.
>
>   4) Default library search path is hardcoded to
>      "/lib:/usr/local/lib:/usr/lib": pass -DSYSLIBDIR and -DLIBDIR and
>      use them to set path.
>
>   5) Need to add more tweaks to patch that adds --with-ldbl-128 knob
>      to gcc configure: there is a set of functions that use TFtype in
>      ppc64-fp.c in libgcc. This should be compatible with glibc.
>
>   6) Disable qemu-userspace for powerpc64 bit: there is no support.
>      While there change qemuwrapper to exit explicitly to fix infinite
>      execution in do_rootfs() task when building on IBM POWER8 machine.
>
>   7) Misc fixes that map powerpc-linux-musl python3 triplet to
>      powerpc-linux-gnu, remove conflicting sed in do_configure() vs
>      patch settings in gcc and fix DEFAULTTUNE settings for various
>      IBM POWER platforms.
>
> Build is done on IBM POWER8 machine running RHEL7:
>
> Images:
> -------
>     core-image-sato
>     core-image-full-cmdline
>
> For powerpc64:
> --------------
>               glibc                musl
>          systemd sysvinit    systemd sysvinit
>   gcc-7.3   y       y           y       y
>   gcc-8.2   y       y           y       y
>
> For powerpc:
> ------------
>               glibc                musl
>          systemd sysvinit    systemd sysvinit
>   gcc-7.3   n       x           x       x      (*)
>   gcc-8.2   y       y           y       y
>
> Note that gcc-7.3 builds for 32bit powerpc fail due to:
>   https://bugzilla.yoctoproject.org/show_bug.cgi?id=11754
>
> Kernel/images are boot tested using KVM-HV on IBM POWER8.
>
> Serhey Popovych (13):
>   lib/oe/elf.py: Add powerpc64 architecture definition for musl
>   tune-power[5-7].inc: Fix DEFAULTTUNE values
>   tune-power[5-7].inc: Disable QEMU usermode usage
>   qemuwrapper: Explicitly exit in case of no qemu supported for target
>   arch-powerpc64.inc: Use elfv2 ABI when building with musl
>   musl: Create default library search path based on configuration
>   musl: Ensure GLIBC_LDSO symlink target does not exist on reinstall
>   openssl: Skip assembler optimized code for powerpc64 with musl
>   python3: Fix do_configure check platform triplet error (2)
>   gcc: Fix preprocessor redefines for header pathes
>   gcc: More places to patch to disable ldbl 128 for musl on PPC
>   gcc: Enable secureplt for powerpc64 target too
>   gcc-7.3,gcc-8.2: Use variable SYSTEMLIBS_DIR instead of hardcoding it
>     for ppc64
>
>  .../machine/include/powerpc/arch-powerpc64.inc     |   3 +
>  meta/conf/machine/include/tune-power5.inc          |   5 +-
>  meta/conf/machine/include/tune-power6.inc          |   5 +-
>  meta/conf/machine/include/tune-power7.inc          |   5 +-
>  meta/lib/oe/elf.py                                 |   1 +
>  .../openssl/openssl10_1.0.2q.bb                    |   1 +
>  .../recipes-connectivity/openssl/openssl_1.1.1a.bb |   1 +
>  ...slibdir-and-libdir-as-default-pathes-to-l.patch |  61 ++++
>  meta/recipes-core/musl/musl_git.bb                 |   3 +-
>  meta/recipes-devtools/gcc/gcc-7.3.inc              |   1 +
>  ...Ensure-target-gcc-headers-can-be-included.patch |  36 --
>  ...44-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch | 391 ++++++++++++++++++++-
>  ...werpc-powerpc64-Add-support-for-musl-ldso.patch |  31 ++
>  meta/recipes-devtools/gcc/gcc-8.2.inc              |   1 +
>  ...Ensure-target-gcc-headers-can-be-included.patch |  36 --
>  ...34-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch | 342 +++++++++++++++++-
>  ...werpc-powerpc64-Add-support-for-musl-ldso.patch |  31 ++
>  meta/recipes-devtools/gcc/gcc-common.inc           |   2 +-
>  .../tweak-MULTIARCH-for-powerpc-linux-musl.patch   |  40 +++
>  meta/recipes-devtools/python/python3_3.5.6.bb      |   1 +
>  .../recipes-devtools/qemu/qemuwrapper-cross_1.0.bb |   3 +-
>  21 files changed, 920 insertions(+), 80 deletions(-)
>  create mode 100644 meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
>  create mode 100644 meta/recipes-devtools/gcc/gcc-7.3/0050-powerpc-powerpc64-Add-support-for-musl-ldso.patch
>  create mode 100644 meta/recipes-devtools/gcc/gcc-8.2/0042-powerpc-powerpc64-Add-support-for-musl-ldso.patch
>  create mode 100644 meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-musl.patch
>
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [PATCH 07/13] musl: Ensure GLIBC_LDSO symlink target does not exist on reinstall
  2018-12-14 19:09   ` Andre McCurdy
@ 2018-12-15 11:00     ` Richard Purdie
  2018-12-17  9:49       ` Serhey Popovych
  0 siblings, 1 reply; 28+ messages in thread
From: Richard Purdie @ 2018-12-15 11:00 UTC (permalink / raw)
  To: Andre McCurdy, serhe.popovych; +Cc: OE Core mailing list

On Fri, 2018-12-14 at 11:09 -0800, Andre McCurdy wrote:
> On Fri, Dec 14, 2018 at 9:57 AM Serhey Popovych
> <serhe.popovych@gmail.com> wrote:
> > Otherwise do_install task will fail on rebuild.
> > 
> > Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
> > ---
> >  meta/recipes-core/musl/musl_git.bb | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-
> > core/musl/musl_git.bb
> > index 9cc875c..4593cde 100644
> > --- a/meta/recipes-core/musl/musl_git.bb
> > +++ b/meta/recipes-core/musl/musl_git.bb
> > @@ -61,7 +61,7 @@ do_install() {
> >         oe_runmake install DESTDIR='${D}'
> > 
> >         install -d ${D}${bindir}
> > -       rm -f ${D}${bindir}/ldd
> > +       rm -f ${D}${bindir}/ldd ${D}${GLIBC_LDSO}
> 
> The correct fix here is actually to remove this line entirely. The
> official ruling is that there should be no expectation that re-
> running do_install should work and patches to make it work are not
> acceptable.
> 
>   
> http://lists.openembedded.org/pipermail/openembedded-core/2018-September/273723.html

Lets be clear, re-running the do_install task *is* supported and works
today. It is actually meant to work when re-run. do_install clears out
${D} at its start so we can assume in do_install functions that it is
empty at the start of the function.

The only problem may be if you're manually re-running the do_install
script in WORKDIR/temp. If you're doing that, you have other problems
like the missing fakeroot environment to handle so the non-empty
directory is only one minor issue, you're missing other setup pieces as
well.

Cheers,

Richard





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

* Re: [PATCH 11/13] gcc: More places to patch to disable ldbl 128 for musl on PPC
  2018-12-14 23:44   ` Khem Raj
@ 2018-12-15 12:06     ` Richard Purdie
  0 siblings, 0 replies; 28+ messages in thread
From: Richard Purdie @ 2018-12-15 12:06 UTC (permalink / raw)
  To: Khem Raj, Serhey Popovych; +Cc: Patches and discussions about the oe-core layer

On Fri, 2018-12-14 at 15:44 -0800, Khem Raj wrote:
> On Fri, Dec 14, 2018 at 9:58 AM Serhey Popovych
> <serhe.popovych@gmail.com> wrote:
> > There are four functions using TFmode type (128bit) that isn't
> > available when building with musl. Move each of them from common
> > ppc64-fp.c to individual files referenced from t-float128 that used
> > when ldbl 128 enabled at configure time.
> > 
> > For gcc-7.3 if -mfloat128 is given -mfloat128-type must be given
> > too.
> > 
> > Exclude ibm-ldouble.c when ldbl 128 isn't enabled at config time.
> > 
> > Build and boot tested with musl (no float128) and glibc (float128
> > and ibm128 on PowerPC64).
> > 
> 
> We should be dropping gcc 7 support in master for next release. Gcc 8
> one is ok
> probably worth submitting it to gcc upstream as well.

I'll probably merge the series and then remove gcc7...

Cheers,

Richard



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

* Re: [PATCH 05/13] arch-powerpc64.inc: Use elfv2 ABI when building with musl
  2018-12-14 23:36   ` Khem Raj
@ 2018-12-17  9:36     ` Serhey Popovych
  2018-12-17 10:26       ` Richard Purdie
  0 siblings, 1 reply; 28+ messages in thread
From: Serhey Popovych @ 2018-12-17  9:36 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer


[-- Attachment #1.1: Type: text/plain, Size: 2403 bytes --]

Khem Raj wrote:
> On Fri, Dec 14, 2018 at 9:56 AM Serhey Popovych
> <serhe.popovych@gmail.com> wrote:
>>
>> Historically first PowerPC ABI was big-endian only (elfv1 currently). It
>> is standard ABI for both 32-bit ppc and 64-bit ppc64 architectures.
>>
>> With PowerPC little-endian support new ABI was introduced (elfv2) and it
>> is used primarily with ppc64le target only. While it has support for
>> big-endian it is not commonly used and elfv1 still preferred.
>>
>> Musl does support only elfv2 ABI for both LE and BE and does not have
>> any plans to support elfv1.
>>
>> Since then to build for powerpc64 with musl new ABI should be used. As
>> expected it is not compatible with elfv1 but that isn't problem as long
>> as there is no binary distributed software or assembly code written for
>> elfv1 ABI.
>>
>> Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
>> ---
>>  meta/conf/machine/include/powerpc/arch-powerpc64.inc | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/meta/conf/machine/include/powerpc/arch-powerpc64.inc b/meta/conf/machine/include/powerpc/arch-powerpc64.inc
>> index f751c6b..d9916d4 100644
>> --- a/meta/conf/machine/include/powerpc/arch-powerpc64.inc
>> +++ b/meta/conf/machine/include/powerpc/arch-powerpc64.inc
>> @@ -7,6 +7,9 @@ TUNECONFLICTS[m64] = "m32 nf"
>>  TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'm64', ' -m64', '', d)}"
>>  TUNE_ARCH .= "${@bb.utils.contains('TUNE_FEATURES', [ 'm64' ], 'powerpc64', '', d)}"
>>
>> +# musl only supports elfv2 ABI for ppc64
>> +TUNE_CCARGS .= "${@['', ' -mabi=elfv2']['libc-musl' in d.getVar('OVERRIDES').split(':')]}"
>> +
> 
> I wonder if we should change gcc to use this ABI by default when
> configured for ppc64/musl ?
> This would avoid us adding compiler options here, in bad cases it may
> be that other compilers
> call it out differently.

Good point. This should be easy to do with patch applied for libc-musl
override.

> 
>>  # user mode qemu doesn't support ppc64
>>  MACHINE_FEATURES_BACKFILL_CONSIDERED_append = " ${@bb.utils.contains('TUNE_FEATURES', 'm64', 'qemu-usermode', '', d)}"
>>
>> --
>> 2.7.4
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 501 bytes --]

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

* Re: [PATCH 06/13] musl: Create default library search path based on configuration
  2018-12-14 23:40   ` Khem Raj
@ 2018-12-17  9:37     ` Serhey Popovych
  0 siblings, 0 replies; 28+ messages in thread
From: Serhey Popovych @ 2018-12-17  9:37 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer


[-- Attachment #1.1: Type: text/plain, Size: 5306 bytes --]

Khem Raj wrote:
> On Fri, Dec 14, 2018 at 9:57 AM Serhey Popovych
> <serhe.popovych@gmail.com> wrote:
>>
>> In absence of /etc/ld-musl-$(ARCH).path file musl uses hardcoded default
>> search path "/lib:/usr/local/lib:/usr/lib". This works for cases when
>> system libraries installed in one of these pathes.
>>
>> However if lib64 or libx32 used as system library directories and no
>> usr merge functionality enabled for distro musl dynamic loader cannot
>> find libraries and finally execute binaries.
>>
>> Found while working on support for musl on powerpc64 builds where
>> lib64 variant is used regardless of multilib being on or off.
>>
>> Fix by creating default search path based on configuration time values
>> for syslibdir and libdir.
> 
> Lets take this fix to musl upstream at the same time. I think it does
> have some value
> but if upstream does not agree then we are in for supporting this
> forever, and I would like
> us to have upstream review on it first.

Will do that. Passing defines in CFLAGS isn't best approach. Maybe
upstream suggests something better.

> 
>>
>> Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
>> ---
>>  ...slibdir-and-libdir-as-default-pathes-to-l.patch | 61 ++++++++++++++++++++++
>>  meta/recipes-core/musl/musl_git.bb                 |  1 +
>>  2 files changed, 62 insertions(+)
>>  create mode 100644 meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
>>
>> diff --git a/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch b/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
>> new file mode 100644
>> index 0000000..6a875a7
>> --- /dev/null
>> +++ b/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
>> @@ -0,0 +1,61 @@
>> +From 5a2886f81dbca3f2ed28eebe7d27d471da278db8 Mon Sep 17 00:00:00 2001
>> +From: Serhey Popovych <serhe.popovych@gmail.com>
>> +Date: Tue, 11 Dec 2018 05:44:20 -0500
>> +Subject: [PATCH] ldso: Use syslibdir and libdir as default pathes to libdirs
>> +
>> +In absence of /etc/ld-musl-$(ARCH).path ldso uses default path to search
>> +libraries /lib:/usr/local/lib:/usr/lib.
>> +
>> +However this path isn't relevant in case when library is put in dirs
>> +like lib64 or libx32.
>> +
>> +Adjust CFLAGS_ALL to pass syslibdir as SYSLIBDIR and libdir as LIBDIR
>> +preprocessor macroses to construct default ldso library search path
>> +in ldso/dynlink.c::SYS_PATH_DFLT.
>> +
>> +Upstream-Status: Pending
>> +Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
>> +---
>> + Makefile       | 3 ++-
>> + ldso/dynlink.c | 4 +++-
>> + 2 files changed, 5 insertions(+), 2 deletions(-)
>> +
>> +diff --git a/Makefile b/Makefile
>> +index b46f8ca4..c07e4ae8 100644
>> +--- a/Makefile
>> ++++ b/Makefile
>> +@@ -46,7 +46,8 @@ CFLAGS_AUTO = -Os -pipe
>> + CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc
>> +
>> + CFLAGS_ALL = $(CFLAGS_C99FSE)
>> +-CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/include -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include
>> ++CFLAGS_ALL += -D_XOPEN_SOURCE=700 -DSYSLIBDIR='"$(syslibdir)"' -DLIBDIR='"$(libdir)"'
>> ++CFLAGS_ALL += -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/include -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include
>> + CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS)
>> +
>> + LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS)
>> +diff --git a/ldso/dynlink.c b/ldso/dynlink.c
>> +index ec921dfd..7c119c55 100644
>> +--- a/ldso/dynlink.c
>> ++++ b/ldso/dynlink.c
>> +@@ -22,6 +22,8 @@
>> + #include "dynlink.h"
>> + #include "malloc_impl.h"
>> +
>> ++#define SYS_PATH_DFLT SYSLIBDIR ":" LIBDIR
>> ++
>> + static void error(const char *, ...);
>> +
>> + #define MAXP2(a,b) (-(-(a)&-(b)))
>> +@@ -1038,7 +1040,7 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
>> +                                       sys_path = "";
>> +                               }
>> +                       }
>> +-                      if (!sys_path) sys_path = "/lib:/usr/local/lib:/usr/lib";
>> ++                      if (!sys_path) sys_path = SYS_PATH_DFLT;
>> +                       fd = path_open(name, sys_path, buf, sizeof buf);
>> +               }
>> +               pathname = buf;
>> +--
>> +2.7.4
>> +
>> diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
>> index b416ec4..9cc875c 100644
>> --- a/meta/recipes-core/musl/musl_git.bb
>> +++ b/meta/recipes-core/musl/musl_git.bb
>> @@ -12,6 +12,7 @@ PV = "1.1.20+git${SRCPV}"
>>
>>  SRC_URI = "git://git.musl-libc.org/musl \
>>             file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \
>> +           file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \
>>            "
>>
>>  S = "${WORKDIR}/git"
>> --
>> 2.7.4
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 501 bytes --]

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

* Re: [PATCH 07/13] musl: Ensure GLIBC_LDSO symlink target does not exist on reinstall
  2018-12-15 11:00     ` Richard Purdie
@ 2018-12-17  9:49       ` Serhey Popovych
  2018-12-17 10:44         ` richard.purdie
  0 siblings, 1 reply; 28+ messages in thread
From: Serhey Popovych @ 2018-12-17  9:49 UTC (permalink / raw)
  To: Richard Purdie, Andre McCurdy; +Cc: OE Core mailing list


[-- Attachment #1.1: Type: text/plain, Size: 3591 bytes --]

Richard Purdie wrote:
> On Fri, 2018-12-14 at 11:09 -0800, Andre McCurdy wrote:
>> On Fri, Dec 14, 2018 at 9:57 AM Serhey Popovych
>> <serhe.popovych@gmail.com> wrote:
>>> Otherwise do_install task will fail on rebuild.
>>>
>>> Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
>>> ---
>>>  meta/recipes-core/musl/musl_git.bb | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-
>>> core/musl/musl_git.bb
>>> index 9cc875c..4593cde 100644
>>> --- a/meta/recipes-core/musl/musl_git.bb
>>> +++ b/meta/recipes-core/musl/musl_git.bb
>>> @@ -61,7 +61,7 @@ do_install() {
>>>         oe_runmake install DESTDIR='${D}'
>>>
>>>         install -d ${D}${bindir}
>>> -       rm -f ${D}${bindir}/ldd
>>> +       rm -f ${D}${bindir}/ldd ${D}${GLIBC_LDSO}
>>
>> The correct fix here is actually to remove this line entirely. The
>> official ruling is that there should be no expectation that re-
>> running do_install should work and patches to make it work are not
>> acceptable.
>>
>>   
>> http://lists.openembedded.org/pipermail/openembedded-core/2018-September/273723.html
> 
> Lets be clear, re-running the do_install task *is* supported and works
> today. It is actually meant to work when re-run. do_install clears out
> ${D} at its start so we can assume in do_install functions that it is
> empty at the start of the function.

It seems do_install does not clear ${D} or I do something wrong:

$ bitbake core-image-sato
<success>

<Adjust gcc/musl recipe and then run>

$ bitbake core-image-sato

...
/image/usr/lib64/libc.so
/home/serhe/devel/git/openembedded-core/build/tmp-musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-r0/image/lib64/ld-musl-powerpc64le.so.1
|| true
| Traceback (most recent call last):
|   File "/home/serhe/devel/git/openembedded-core/scripts/lnr", line 21,
in <module>
|     os.symlink(target, linkname)
| FileExistsError: [Errno 17] File exists: 'image/usr/lib64/libc.so' ->
'/home/serhe/devel/git/openembedded-core/build/tmp-musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-r0/imageNone'
| WARNING:
/home/serhe/devel/git/openembedded-core/build/tmp-musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-r0/temp/run.do_install.77856:1
exit 1 from 'lnr
/home/serhe/devel/git/openembedded-core/build/tmp-musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-r0/image/usr/lib64/libc.so
/home/serhe/devel/git/openembedded-core/build/tmp-musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-r0/imageNone'
| ERROR: Function failed: do_install (log file is located at
/home/serhe/devel/git/openembedded-core/build/tmp-musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-r0/temp/log.do_install.77856)
ERROR: Task
(/home/serhe/devel/git/openembedded-core/meta/recipes-core/musl/musl_git.bb:do_install)
failed with exit code '1'
NOTE: Tasks Summary: Attempted 2713 tasks of which 2703 didn't need to
be rerun and 1 failed.

...

> 
> The only problem may be if you're manually re-running the do_install
> script in WORKDIR/temp. If you're doing that, you have other problems
> like the missing fakeroot environment to handle so the non-empty
> directory is only one minor issue, you're missing other setup pieces as
> well.

I haven't play with do_install scripts in WORKDIR/temp. Only
do_configure and do_build. But anyway thank for pointing for potential
problems.

> 
> Cheers,
> 
> Richard
> 
> 
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 501 bytes --]

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

* Re: [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc
  2018-12-14 23:46 ` [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Khem Raj
@ 2018-12-17  9:56   ` Serhey Popovych
  0 siblings, 0 replies; 28+ messages in thread
From: Serhey Popovych @ 2018-12-17  9:56 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer


[-- Attachment #1.1: Type: text/plain, Size: 6276 bytes --]

Khem Raj wrote:
> Serhey
> 
> Thanks for doing this work and really a clean pull request with good
> explanation that I have seen lately. Good work, For most parts
> everything is in order except few places where I have replied
> specifically to the patches

Khem, thank you for quick review! I will try to address your comments
with upstream even after this series already merged.

But at the moment I'm working on series intended to improve situation
with ppc64le support (inluding musl).

There is more places to address. For example build w/o altivec support.
Currently tune actually does nothing to avoid Altivec/VSX instructions
in binary. This is however only may be a problem for some embedded stuff
or very old POWER machines (i.e. before POWER6 I guess).

> 
> On Fri, Dec 14, 2018 at 9:55 AM Serhey Popovych
> <serhe.popovych@gmail.com> wrote:
>>
>> Musl has support for ppc (32bit) and ppc64 (64bit). OE still missing
>> several tricks in configuration to make builds possible:
>>
>>   1) Most important part is that musl implements elfv2 ABI only for
>>      64bit PowerPC. That ABI is default for little-endian but supports
>>      big-endian too. Historically elfv1 ABI is used for big-endian
>>      PowerPC.
>>
>>   2) Using uncommon elfv2 ABI for big-endian requires to disable all
>>      assembler optimizations in openssl: unfortunately I can't find more
>>      smart way at the moment.
>>
>>   3) LDSO path need to be adjusted to support /lib64 path which is
>>      default for powerpc64 (see bitbake.conf) instead of $baselibdir.
>>
>>   4) Default library search path is hardcoded to
>>      "/lib:/usr/local/lib:/usr/lib": pass -DSYSLIBDIR and -DLIBDIR and
>>      use them to set path.
>>
>>   5) Need to add more tweaks to patch that adds --with-ldbl-128 knob
>>      to gcc configure: there is a set of functions that use TFtype in
>>      ppc64-fp.c in libgcc. This should be compatible with glibc.
>>
>>   6) Disable qemu-userspace for powerpc64 bit: there is no support.
>>      While there change qemuwrapper to exit explicitly to fix infinite
>>      execution in do_rootfs() task when building on IBM POWER8 machine.
>>
>>   7) Misc fixes that map powerpc-linux-musl python3 triplet to
>>      powerpc-linux-gnu, remove conflicting sed in do_configure() vs
>>      patch settings in gcc and fix DEFAULTTUNE settings for various
>>      IBM POWER platforms.
>>
>> Build is done on IBM POWER8 machine running RHEL7:
>>
>> Images:
>> -------
>>     core-image-sato
>>     core-image-full-cmdline
>>
>> For powerpc64:
>> --------------
>>               glibc                musl
>>          systemd sysvinit    systemd sysvinit
>>   gcc-7.3   y       y           y       y
>>   gcc-8.2   y       y           y       y
>>
>> For powerpc:
>> ------------
>>               glibc                musl
>>          systemd sysvinit    systemd sysvinit
>>   gcc-7.3   n       x           x       x      (*)
>>   gcc-8.2   y       y           y       y
>>
>> Note that gcc-7.3 builds for 32bit powerpc fail due to:
>>   https://bugzilla.yoctoproject.org/show_bug.cgi?id=11754
>>
>> Kernel/images are boot tested using KVM-HV on IBM POWER8.
>>
>> Serhey Popovych (13):
>>   lib/oe/elf.py: Add powerpc64 architecture definition for musl
>>   tune-power[5-7].inc: Fix DEFAULTTUNE values
>>   tune-power[5-7].inc: Disable QEMU usermode usage
>>   qemuwrapper: Explicitly exit in case of no qemu supported for target
>>   arch-powerpc64.inc: Use elfv2 ABI when building with musl
>>   musl: Create default library search path based on configuration
>>   musl: Ensure GLIBC_LDSO symlink target does not exist on reinstall
>>   openssl: Skip assembler optimized code for powerpc64 with musl
>>   python3: Fix do_configure check platform triplet error (2)
>>   gcc: Fix preprocessor redefines for header pathes
>>   gcc: More places to patch to disable ldbl 128 for musl on PPC
>>   gcc: Enable secureplt for powerpc64 target too
>>   gcc-7.3,gcc-8.2: Use variable SYSTEMLIBS_DIR instead of hardcoding it
>>     for ppc64
>>
>>  .../machine/include/powerpc/arch-powerpc64.inc     |   3 +
>>  meta/conf/machine/include/tune-power5.inc          |   5 +-
>>  meta/conf/machine/include/tune-power6.inc          |   5 +-
>>  meta/conf/machine/include/tune-power7.inc          |   5 +-
>>  meta/lib/oe/elf.py                                 |   1 +
>>  .../openssl/openssl10_1.0.2q.bb                    |   1 +
>>  .../recipes-connectivity/openssl/openssl_1.1.1a.bb |   1 +
>>  ...slibdir-and-libdir-as-default-pathes-to-l.patch |  61 ++++
>>  meta/recipes-core/musl/musl_git.bb                 |   3 +-
>>  meta/recipes-devtools/gcc/gcc-7.3.inc              |   1 +
>>  ...Ensure-target-gcc-headers-can-be-included.patch |  36 --
>>  ...44-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch | 391 ++++++++++++++++++++-
>>  ...werpc-powerpc64-Add-support-for-musl-ldso.patch |  31 ++
>>  meta/recipes-devtools/gcc/gcc-8.2.inc              |   1 +
>>  ...Ensure-target-gcc-headers-can-be-included.patch |  36 --
>>  ...34-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch | 342 +++++++++++++++++-
>>  ...werpc-powerpc64-Add-support-for-musl-ldso.patch |  31 ++
>>  meta/recipes-devtools/gcc/gcc-common.inc           |   2 +-
>>  .../tweak-MULTIARCH-for-powerpc-linux-musl.patch   |  40 +++
>>  meta/recipes-devtools/python/python3_3.5.6.bb      |   1 +
>>  .../recipes-devtools/qemu/qemuwrapper-cross_1.0.bb |   3 +-
>>  21 files changed, 920 insertions(+), 80 deletions(-)
>>  create mode 100644 meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
>>  create mode 100644 meta/recipes-devtools/gcc/gcc-7.3/0050-powerpc-powerpc64-Add-support-for-musl-ldso.patch
>>  create mode 100644 meta/recipes-devtools/gcc/gcc-8.2/0042-powerpc-powerpc64-Add-support-for-musl-ldso.patch
>>  create mode 100644 meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-musl.patch
>>
>> --
>> 2.7.4
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 501 bytes --]

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

* Re: [PATCH 05/13] arch-powerpc64.inc: Use elfv2 ABI when building with musl
  2018-12-17  9:36     ` Serhey Popovych
@ 2018-12-17 10:26       ` Richard Purdie
  0 siblings, 0 replies; 28+ messages in thread
From: Richard Purdie @ 2018-12-17 10:26 UTC (permalink / raw)
  To: Serhey Popovych, Khem Raj; +Cc: Patches and discussions about the oe-core layer

On Mon, 2018-12-17 at 11:36 +0200, Serhey Popovych wrote:
> Khem Raj wrote:
> > On Fri, Dec 14, 2018 at 9:56 AM Serhey Popovych
> > <serhe.popovych@gmail.com> wrote:
> > > Historically first PowerPC ABI was big-endian only (elfv1
> > > currently). It
> > > is standard ABI for both 32-bit ppc and 64-bit ppc64
> > > architectures.
> > > 
> > > With PowerPC little-endian support new ABI was introduced (elfv2)
> > > and it
> > > is used primarily with ppc64le target only. While it has support
> > > for
> > > big-endian it is not commonly used and elfv1 still preferred.
> > > 
> > > Musl does support only elfv2 ABI for both LE and BE and does not
> > > have
> > > any plans to support elfv1.
> > > 
> > > Since then to build for powerpc64 with musl new ABI should be
> > > used. As
> > > expected it is not compatible with elfv1 but that isn't problem
> > > as long
> > > as there is no binary distributed software or assembly code
> > > written for
> > > elfv1 ABI.
> > > 
> > > Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
> > > ---
> > >  meta/conf/machine/include/powerpc/arch-powerpc64.inc | 3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/meta/conf/machine/include/powerpc/arch-powerpc64.inc 
> > > b/meta/conf/machine/include/powerpc/arch-powerpc64.inc
> > > index f751c6b..d9916d4 100644
> > > --- a/meta/conf/machine/include/powerpc/arch-powerpc64.inc
> > > +++ b/meta/conf/machine/include/powerpc/arch-powerpc64.inc
> > > @@ -7,6 +7,9 @@ TUNECONFLICTS[m64] = "m32 nf"
> > >  TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'm64', '
> > > -m64', '', d)}"
> > >  TUNE_ARCH .= "${@bb.utils.contains('TUNE_FEATURES', [ 'm64' ],
> > > 'powerpc64', '', d)}"
> > > 
> > > +# musl only supports elfv2 ABI for ppc64
> > > +TUNE_CCARGS .= "${@['', ' -mabi=elfv2']['libc-musl' in
> > > d.getVar('OVERRIDES').split(':')]}"
> > > +
> > 
> > I wonder if we should change gcc to use this ABI by default when
> > configured for ppc64/musl ?
> > This would avoid us adding compiler options here, in bad cases it
> > may
> > be that other compilers
> > call it out differently.
> 
> Good point. This should be easy to do with patch applied for libc-
> musl
> override.

Given our gcc shared-workdir which is shared between musl and non-musl
builds, I'm not sure this will be quite that easy. It would need to be
build configuration time rather than source patching...

Cheers,

Richard



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

* Re: [PATCH 07/13] musl: Ensure GLIBC_LDSO symlink target does not exist on reinstall
  2018-12-17  9:49       ` Serhey Popovych
@ 2018-12-17 10:44         ` richard.purdie
  2018-12-17 15:13           ` Serhey Popovych
  0 siblings, 1 reply; 28+ messages in thread
From: richard.purdie @ 2018-12-17 10:44 UTC (permalink / raw)
  To: Serhey Popovych, Andre McCurdy; +Cc: OE Core mailing list

On Mon, 2018-12-17 at 11:49 +0200, Serhey Popovych wrote:
> Richard Purdie wrote:
> > On Fri, 2018-12-14 at 11:09 -0800, Andre McCurdy wrote:
> > > On Fri, Dec 14, 2018 at 9:57 AM Serhey Popovych
> > > <serhe.popovych@gmail.com> wrote:
> > > > Otherwise do_install task will fail on rebuild.
> > > > 
> > > > Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
> > > > ---
> > > >  meta/recipes-core/musl/musl_git.bb | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-
> > > > core/musl/musl_git.bb
> > > > index 9cc875c..4593cde 100644
> > > > --- a/meta/recipes-core/musl/musl_git.bb
> > > > +++ b/meta/recipes-core/musl/musl_git.bb
> > > > @@ -61,7 +61,7 @@ do_install() {
> > > >         oe_runmake install DESTDIR='${D}'
> > > > 
> > > >         install -d ${D}${bindir}
> > > > -       rm -f ${D}${bindir}/ldd
> > > > +       rm -f ${D}${bindir}/ldd ${D}${GLIBC_LDSO}
> > > 
> > > The correct fix here is actually to remove this line entirely.
> > > The
> > > official ruling is that there should be no expectation that re-
> > > running do_install should work and patches to make it work are
> > > not
> > > acceptable.
> > > 
> > >   
> > > http://lists.openembedded.org/pipermail/openembedded-core/2018-September/273723.html
> > 
> > Lets be clear, re-running the do_install task *is* supported and
> > works
> > today. It is actually meant to work when re-run. do_install clears
> > out
> > ${D} at its start so we can assume in do_install functions that it
> > is
> > empty at the start of the function.
> 
> It seems do_install does not clear ${D} or I do something wrong:
> 
> $ bitbake core-image-sato
> <success>
> 
> <Adjust gcc/musl recipe and then run>
> 
> $ bitbake core-image-sato
> 
> ...
> /image/usr/lib64/libc.so
> /home/serhe/devel/git/openembedded-core/build/tmp-
> musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-
> r0/image/lib64/ld-musl-powerpc64le.so.1
> > > true
> > Traceback (most recent call last):
> >   File "/home/serhe/devel/git/openembedded-core/scripts/lnr", line
> > 21,
> in <module>
> >     os.symlink(target, linkname)
> > FileExistsError: [Errno 17] File exists: 'image/usr/lib64/libc.so'
> > ->
> '/home/serhe/devel/git/openembedded-core/build/tmp-
> musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-
> r0/imageNone'
> > WARNING:
> /home/serhe/devel/git/openembedded-core/build/tmp-
> musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-
> r0/temp/run.do_install.77856:1
> exit 1 from 'lnr
> /home/serhe/devel/git/openembedded-core/build/tmp-
> musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-
> r0/image/usr/lib64/libc.so
> /home/serhe/devel/git/openembedded-core/build/tmp-
> musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-
> r0/imageNone'
> > ERROR: Function failed: do_install (log file is located at
> /home/serhe/devel/git/openembedded-core/build/tmp-
> musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-
> r0/temp/log.do_install.77856)
> ERROR: Task
> (/home/serhe/devel/git/openembedded-core/meta/recipes-
> core/musl/musl_git.bb:do_install)
> failed with exit code '1'
> NOTE: Tasks Summary: Attempted 2713 tasks of which 2703 didn't need
> to
> be rerun and 1 failed.
> 
> ...
> 
> > The only problem may be if you're manually re-running the
> > do_install
> > script in WORKDIR/temp. If you're doing that, you have other
> > problems
> > like the missing fakeroot environment to handle so the non-empty
> > directory is only one minor issue, you're missing other setup
> > pieces as
> > well.
> 
> I haven't play with do_install scripts in WORKDIR/temp. Only
> do_configure and do_build. But anyway thank for pointing for
> potential
> problems.

I just tried "bitbake musl", then "bitbake musl -c install -f" which
should have reproduced the above but it worked fine. Admittedly I was
using MACHINE=qemux86-64. Do those two steps break for you?

Something isn't adding up here and I'd like to get to the bottom of
it...

Cheers,

Richard






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

* Re: [PATCH 07/13] musl: Ensure GLIBC_LDSO symlink target does not exist on reinstall
  2018-12-17 10:44         ` richard.purdie
@ 2018-12-17 15:13           ` Serhey Popovych
  0 siblings, 0 replies; 28+ messages in thread
From: Serhey Popovych @ 2018-12-17 15:13 UTC (permalink / raw)
  To: richard.purdie, Andre McCurdy; +Cc: OE Core mailing list


[-- Attachment #1.1: Type: text/plain, Size: 4419 bytes --]

richard.purdie@linuxfoundation.org wrote:
> On Mon, 2018-12-17 at 11:49 +0200, Serhey Popovych wrote:
>> Richard Purdie wrote:
>>> On Fri, 2018-12-14 at 11:09 -0800, Andre McCurdy wrote:
>>>> On Fri, Dec 14, 2018 at 9:57 AM Serhey Popovych
>>>> <serhe.popovych@gmail.com> wrote:
>>>>> Otherwise do_install task will fail on rebuild.
>>>>>
>>>>> Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
>>>>> ---
>>>>>  meta/recipes-core/musl/musl_git.bb | 2 +-
>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-
>>>>> core/musl/musl_git.bb
>>>>> index 9cc875c..4593cde 100644
>>>>> --- a/meta/recipes-core/musl/musl_git.bb
>>>>> +++ b/meta/recipes-core/musl/musl_git.bb
>>>>> @@ -61,7 +61,7 @@ do_install() {
>>>>>         oe_runmake install DESTDIR='${D}'
>>>>>
>>>>>         install -d ${D}${bindir}
>>>>> -       rm -f ${D}${bindir}/ldd
>>>>> +       rm -f ${D}${bindir}/ldd ${D}${GLIBC_LDSO}
>>>>
>>>> The correct fix here is actually to remove this line entirely.
>>>> The
>>>> official ruling is that there should be no expectation that re-
>>>> running do_install should work and patches to make it work are
>>>> not
>>>> acceptable.
>>>>
>>>>   
>>>> http://lists.openembedded.org/pipermail/openembedded-core/2018-September/273723.html
>>>
>>> Lets be clear, re-running the do_install task *is* supported and
>>> works
>>> today. It is actually meant to work when re-run. do_install clears
>>> out
>>> ${D} at its start so we can assume in do_install functions that it
>>> is
>>> empty at the start of the function.
>>
>> It seems do_install does not clear ${D} or I do something wrong:
>>
>> $ bitbake core-image-sato
>> <success>
>>
>> <Adjust gcc/musl recipe and then run>
>>
>> $ bitbake core-image-sato
>>
>> ...
>> /image/usr/lib64/libc.so
>> /home/serhe/devel/git/openembedded-core/build/tmp-
>> musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-
>> r0/image/lib64/ld-musl-powerpc64le.so.1
>>>> true
>>> Traceback (most recent call last):
>>>   File "/home/serhe/devel/git/openembedded-core/scripts/lnr", line
>>> 21,
>> in <module>
>>>     os.symlink(target, linkname)
>>> FileExistsError: [Errno 17] File exists: 'image/usr/lib64/libc.so'
>>> ->
>> '/home/serhe/devel/git/openembedded-core/build/tmp-
>> musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-
>> r0/imageNone'
>>> WARNING:
>> /home/serhe/devel/git/openembedded-core/build/tmp-
>> musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-
>> r0/temp/run.do_install.77856:1
>> exit 1 from 'lnr
>> /home/serhe/devel/git/openembedded-core/build/tmp-
>> musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-
>> r0/image/usr/lib64/libc.so
>> /home/serhe/devel/git/openembedded-core/build/tmp-
>> musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-
>> r0/imageNone'
>>> ERROR: Function failed: do_install (log file is located at
>> /home/serhe/devel/git/openembedded-core/build/tmp-
>> musl/work/ppc64p8le-oe-linux-musl/musl/1.1.20+gitAUTOINC+39ef612aa1-
>> r0/temp/log.do_install.77856)
>> ERROR: Task
>> (/home/serhe/devel/git/openembedded-core/meta/recipes-
>> core/musl/musl_git.bb:do_install)
>> failed with exit code '1'
>> NOTE: Tasks Summary: Attempted 2713 tasks of which 2703 didn't need
>> to
>> be rerun and 1 failed.
>>
>> ...
>>
>>> The only problem may be if you're manually re-running the
>>> do_install
>>> script in WORKDIR/temp. If you're doing that, you have other
>>> problems
>>> like the missing fakeroot environment to handle so the non-empty
>>> directory is only one minor issue, you're missing other setup
>>> pieces as
>>> well.
>>
>> I haven't play with do_install scripts in WORKDIR/temp. Only
>> do_configure and do_build. But anyway thank for pointing for
>> potential
>> problems.
> 
> I just tried "bitbake musl", then "bitbake musl -c install -f" which
> should have reproduced the above but it worked fine. Admittedly I was
> using MACHINE=qemux86-64. Do those two steps break for you?

Tried for ppc: issue above not reproducible. It seems I ran into
unsupported configuration somehow. Sorry for noise.

> 
> Something isn't adding up here and I'd like to get to the bottom of
> it...
> 
> Cheers,
> 
> Richard
> 
> 
> 
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 501 bytes --]

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

end of thread, other threads:[~2018-12-17 15:13 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-14 17:54 [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Serhey Popovych
2018-12-14 17:54 ` [PATCH 01/13] lib/oe/elf.py: Add powerpc64 architecture definition for musl Serhey Popovych
2018-12-14 17:54 ` [PATCH 02/13] tune-power[5-7].inc: Fix DEFAULTTUNE values Serhey Popovych
2018-12-14 17:54 ` [PATCH 03/13] tune-power[5-7].inc: Disable QEMU usermode usage Serhey Popovych
2018-12-14 17:54 ` [PATCH 04/13] qemuwrapper: Explicitly exit in case of no qemu supported for target Serhey Popovych
2018-12-14 17:54 ` [PATCH 05/13] arch-powerpc64.inc: Use elfv2 ABI when building with musl Serhey Popovych
2018-12-14 23:36   ` Khem Raj
2018-12-17  9:36     ` Serhey Popovych
2018-12-17 10:26       ` Richard Purdie
2018-12-14 17:54 ` [PATCH 06/13] musl: Create default library search path based on configuration Serhey Popovych
2018-12-14 23:40   ` Khem Raj
2018-12-17  9:37     ` Serhey Popovych
2018-12-14 17:54 ` [PATCH 07/13] musl: Ensure GLIBC_LDSO symlink target does not exist on reinstall Serhey Popovych
2018-12-14 19:09   ` Andre McCurdy
2018-12-15 11:00     ` Richard Purdie
2018-12-17  9:49       ` Serhey Popovych
2018-12-17 10:44         ` richard.purdie
2018-12-17 15:13           ` Serhey Popovych
2018-12-14 17:54 ` [PATCH 08/13] openssl: Skip assembler optimized code for powerpc64 with musl Serhey Popovych
2018-12-14 17:54 ` [PATCH 09/13] python3: Fix do_configure check platform triplet error (2) Serhey Popovych
2018-12-14 17:54 ` [PATCH 10/13] gcc: Fix preprocessor redefines for header pathes Serhey Popovych
2018-12-14 17:54 ` [PATCH 11/13] gcc: More places to patch to disable ldbl 128 for musl on PPC Serhey Popovych
2018-12-14 23:44   ` Khem Raj
2018-12-15 12:06     ` Richard Purdie
2018-12-14 17:54 ` [PATCH 12/13] gcc: Enable secureplt for powerpc64 target too Serhey Popovych
2018-12-14 17:54 ` [PATCH 13/13] gcc-7.3, gcc-8.2: Use variable SYSTEMLIBS_DIR instead of hardcoding it for ppc64 Serhey Popovych
2018-12-14 23:46 ` [PATCH 00/13] powerpc/powerpc64: Support build with musl as libc Khem Raj
2018-12-17  9:56   ` Serhey Popovych

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.