From: Serhey Popovych <serhe.popovych@gmail.com>
To: Khem Raj <raj.khem@gmail.com>
Cc: Patches and discussions about the oe-core layer
<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 06/13] musl: Create default library search path based on configuration
Date: Mon, 17 Dec 2018 11:37:53 +0200 [thread overview]
Message-ID: <55ac3f82-15bb-b4d3-1729-2a320dba6f6d@gmail.com> (raw)
In-Reply-To: <CAMKF1sq67e22RCV4jasQsvaUcyzA9DR+oz9UgRPqMwFi48-thg@mail.gmail.com>
[-- 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 --]
next prev parent reply other threads:[~2018-12-17 9:37 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55ac3f82-15bb-b4d3-1729-2a320dba6f6d@gmail.com \
--to=serhe.popovych@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=raj.khem@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox