SELinux Security Module development
 help / color / mirror / Atom feed
From: Petr Lautrbach <plautrba@redhat.com>
To: Stephen Smalley <stephen.smalley.work@gmail.com>,
	selinux@vger.kernel.org
Cc: jwcart2@gmail.com, omosnace@redhat.com,
	Stephen Smalley <stephen.smalley.work@gmail.com>,
	Pepper Gray <hello@peppergray.xyz>
Subject: Re: [PATCH] libselinux: Add EXTRA_LD_SONAME_FLAGS for musl+llvm builds
Date: Tue, 16 Jun 2026 15:37:10 +0200	[thread overview]
Message-ID: <87y0geli7t.fsf@redhat.com> (raw)
In-Reply-To: <20260615172736.45712-1-stephen.smalley.work@gmail.com>

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


      reply	other threads:[~2026-06-16 13:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=87y0geli7t.fsf@redhat.com \
    --to=plautrba@redhat.com \
    --cc=hello@peppergray.xyz \
    --cc=jwcart2@gmail.com \
    --cc=omosnace@redhat.com \
    --cc=selinux@vger.kernel.org \
    --cc=stephen.smalley.work@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