From b71f4eb08935fd1a8af2286a26b92dceba26e0c7 Mon Sep 17 00:00:00 2001 From: Andrei Gherzan <andrei.gherzan@huawei.com> Date: Thu, 21 Jul 2022 00:53:30 +0200 Subject: [PATCH] musl: Fix patch fuzz on the version used in openharmony An upstream patch (oe-core) doesn't apply cleanly on the musl version openharmony is using. Refresh to fix the associated build warnings. Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com> --- ...ir-and-libdir-as-default-pathes-to-l.patch | 63 +++++++++++++++++++ recipes-core/musl/musl_%.bbappend | 2 +- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 recipes-core/musl/musl-1.2.0/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch diff --git a/recipes-core/musl/musl-1.2.0/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch b/recipes-core/musl/musl-1.2.0/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch new file mode 100644 index 00000000..991a68c1 --- /dev/null +++ b/recipes-core/musl/musl-1.2.0/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch @@ -0,0 +1,63 @@ +From b4af7acc95c6060d258cac8f3489ec950c6ed87d Mon Sep 17 00:00:00 2001 +From: Andrei Gherzan <andrei.gherzan@huawei.com> +Date: Thu, 21 Jul 2022 00:46:34 +0200 +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> +Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com> +--- + Makefile | 3 ++- + ldso/dynlink.c | 4 +++- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index d93a1a0a..9fdc7659 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 afec985a..d9f3f94d 100644 +--- a/ldso/dynlink.c ++++ b/ldso/dynlink.c +@@ -25,6 +25,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))) +@@ -1074,7 +1076,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.25.1 + diff --git a/recipes-core/musl/musl_%.bbappend b/recipes-core/musl/musl_%.bbappend index 4bbbd3fd..13634559 100644 --- a/recipes-core/musl/musl_%.bbappend +++ b/recipes-core/musl/musl_%.bbappend @@ -5,7 +5,7 @@ BASEVER:df-openharmony = "1.2.0" SRCREV:df-openharmony = "040c1d16b468c50c04fc94edff521f1637708328" LIC_FILES_CHKSUM:df-openharmony = "file://COPYRIGHT;md5=f95ee848a08ad253c04723da00cedb01" -FILESEXTRAPATHS:prepend:df-openharmony := "${THISDIR}/openharmony-${OPENHARMONY_VERSION}:" +FILESEXTRAPATHS:prepend:df-openharmony := "${THISDIR}/openharmony-${OPENHARMONY_VERSION}:${THISDIR}/musl-${BASEVER}:" SRC_URI:append:df-openharmony = " file://openharmony-common.patch" SRC_URI:append:df-openharmony = " file://openharmony-linux-user.patch" # This conflicts with libcap, so we have to go with libcap instead -- GitLab