* [PATCH] libselinux: Add EXTRA_LD_SONAME_FLAGS for musl+llvm builds
@ 2026-06-15 17:27 Stephen Smalley
2026-06-16 13:37 ` Petr Lautrbach
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Smalley @ 2026-06-15 17:27 UTC (permalink / raw)
To: selinux; +Cc: jwcart2, plautrba, omosnace, Stephen Smalley, Pepper Gray
Introduce an optionally defined EXTRA_LD_SONAME_FLAGS variable for use
by musl+llvm builds to pass --undefined-version. This enables such
builds to link despite the intentionally omitted
matchpathcon_filespec_add64 symbol.
Fixes: https://github.com/SELinuxProject/selinux/issues/512
Fixes: https://github.com/SELinuxProject/selinux/pull/513
Link: https://lore.kernel.org/selinux/871pe7n3w3.fsf@redhat.com/
Fixes: 9395cc03226a0 ("Always build for LFS mode on 32-bit archs.")
Reported-by: Pepper Gray <hello@peppergray.xyz>
Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
---
README.md | 4 ++++
libselinux/src/Makefile | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 5e65a049..a458a930 100644
--- a/README.md
+++ b/README.md
@@ -151,6 +151,10 @@ set when overriding are:
- -fno-semantic-interposition for gcc or compilers that do not do this. clang does this by default. clang-10 and up
will support passing this flag, but ignore it. Previous clang versions fail.
+## Setting EXTRA_LD_SONAME_FLAGS
+
+Build with EXTRA_LD_SONAME_FLAGS=--undefined-version to fix
+linking against musl with llvm.
macOS
-----
diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index 9982faad..fe8d3239 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -91,7 +91,9 @@ CFLAGS ?= -O -Wall -W -Wundef -Wformat-y2k -Wformat-security -Winit-self -Wmissi
override CFLAGS += $(LFS_CFLAGS)
-LD_SONAME_FLAGS=-soname,$(LIBSO),--version-script=libselinux.map,-z,defs,-z,relro
+# Use make EXTRA_LD_SONAME_FLAGS=--undefined-version to fix
+# linking against musl with llvm.
+LD_SONAME_FLAGS=-soname,$(LIBSO),--version-script=libselinux.map,-z,defs,-z,relro$(EXTRA_LD_SONAME_FLAGS)
ifeq ($(OS), Darwin)
override CFLAGS += -I/opt/local/include
--
2.54.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] libselinux: Add EXTRA_LD_SONAME_FLAGS for musl+llvm builds
2026-06-15 17:27 [PATCH] libselinux: Add EXTRA_LD_SONAME_FLAGS for musl+llvm builds Stephen Smalley
@ 2026-06-16 13:37 ` Petr Lautrbach
0 siblings, 0 replies; 2+ messages in thread
From: Petr Lautrbach @ 2026-06-16 13:37 UTC (permalink / raw)
To: Stephen Smalley, selinux; +Cc: jwcart2, omosnace, Stephen Smalley, Pepper Gray
Stephen Smalley <stephen.smalley.work@gmail.com> writes:
> Introduce an optionally defined EXTRA_LD_SONAME_FLAGS variable for use
> by musl+llvm builds to pass --undefined-version. This enables such
> builds to link despite the intentionally omitted
> matchpathcon_filespec_add64 symbol.
>
> Fixes: https://github.com/SELinuxProject/selinux/issues/512
> Fixes: https://github.com/SELinuxProject/selinux/pull/513
> Link: https://lore.kernel.org/selinux/871pe7n3w3.fsf@redhat.com/
> Fixes: 9395cc03226a0 ("Always build for LFS mode on 32-bit archs.")
> Reported-by: Pepper Gray <hello@peppergray.xyz>
> Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
> ---
> README.md | 4 ++++
> libselinux/src/Makefile | 4 +++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/README.md b/README.md
> index 5e65a049..a458a930 100644
> --- a/README.md
> +++ b/README.md
> @@ -151,6 +151,10 @@ set when overriding are:
> - -fno-semantic-interposition for gcc or compilers that do not do this. clang does this by default. clang-10 and up
> will support passing this flag, but ignore it. Previous clang versions fail.
>
> +## Setting EXTRA_LD_SONAME_FLAGS
> +
> +Build with EXTRA_LD_SONAME_FLAGS=--undefined-version to fix
> +linking against musl with llvm.
>
> macOS
> -----
> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> index 9982faad..fe8d3239 100644
> --- a/libselinux/src/Makefile
> +++ b/libselinux/src/Makefile
> @@ -91,7 +91,9 @@ CFLAGS ?= -O -Wall -W -Wundef -Wformat-y2k -Wformat-security -Winit-self -Wmissi
>
> override CFLAGS += $(LFS_CFLAGS)
>
> -LD_SONAME_FLAGS=-soname,$(LIBSO),--version-script=libselinux.map,-z,defs,-z,relro
> +# Use make EXTRA_LD_SONAME_FLAGS=--undefined-version to fix
> +# linking against musl with llvm.
> +LD_SONAME_FLAGS=-soname,$(LIBSO),--version-script=libselinux.map,-z,defs,-z,relro$(EXTRA_LD_SONAME_FLAGS)
I guess there would be missing ',' before --undefined-version
something like this could fix it:
+LD_SONAME_FLAGS=-soname,$(LIBSO),--version-script=libselinux.map,-z,defs,-z,relro$(EXTRA_LD_SONAME_FLAGS:%=,%)
> ifeq ($(OS), Darwin)
> override CFLAGS += -I/opt/local/include
> --
> 2.54.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-16 13:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-15 17:27 [PATCH] libselinux: Add EXTRA_LD_SONAME_FLAGS for musl+llvm builds Stephen Smalley
2026-06-16 13:37 ` Petr Lautrbach
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.