libselinux: Add EXTRA_LD_FLAGS for musl+llvm builds
Stephen Smalley
maintainerPATCH v2 1/1 libselinux: Add EXTRA_LD_FLAGS for musl+llvm builds
Introduce an optionally defined EXTRA_LD_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.
---
v2 fixes the missing comma issue noted by Petr and shortens the new variable name to just EXTRA_LD_FLAGS, moving its use down to only the line where the linker is called.
README.md | 4 ++++ libselinux/src/Makefile | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-)
README.md +4 -0
@@ -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_FLAGS + +Build with EXTRA_LD_FLAGS=--undefined-version to fix linking against +musl with llvm. macOS -----
libselinux/src/Makefile +4 -1
@@ -7,6 +7,9 @@ RUBY ?= ruby RUBYPREFIX ?= $(notdir $(RUBY)) PKG_CONFIG ?= pkg-config +# Set EXTRA_LD_FLAGS to --undefined-version to fix +# linking against musl with llvm. + # Installation directories. PREFIX ?= /usr LIBDIR ?= $(PREFIX)/lib
@@ -163,7 +166,7 @@ $(LIBA): $(OBJS) $(RANLIB) $@ $(LIBSO): $(LOBJS) - $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -fPIC -shared -o $@ $^ $(PCRE_LDLIBS) $(FTS_LDLIBS) -ldl -Wl,$(LD_SONAME_FLAGS) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -fPIC -shared -o $@ $^ $(PCRE_LDLIBS) $(FTS_LDLIBS) -ldl -Wl,$(LD_SONAME_FLAGS)$(EXTRA_LD_FLAGS:%=,%) ln -sf $@ $(TARGET) $(LIBPC): $(LIBPC).in ../VERSION
Signature · 1 line
2.54.0
Stephen Smalley
maintainerQuoted 6 lines · Stephen Smalley
Introduce an optionally defined
EXTRA_LD_FLAGSvariable for use by musl+llvm builds to pass --undefined-version. This enables such builds to link despite the intentionally omittedmatchpathcon_filespec_add64symbol.
Quoted 7 lines
Fixes 9395cc03226a0 ("Always build for LFS mode on 32-bit archs.")Reported-by Pepper Gray <[email protected]>Suggested-by Petr Lautrbach <[email protected]>Signed-off-by Stephen Smalley <[email protected]>
Merged.
Quoted 50 lines
---
v2 fixes the missing comma issue noted by Petr and shortens the new variable name to justEXTRA_LD_FLAGS, moving its use down to only the line where the linker is called.README.md | 4 ++++ libselinux/src/Makefile | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-)README.md +4
-0@@ -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_FLAGS + +Build with EXTRA_LD_FLAGS=--undefined-version to fix linking against +musl with llvm. macOS -----libselinux/src/Makefile +4
-2@@ -7,6 +7,9 @@ RUBY ?= ruby RUBYPREFIX ?= $(notdir $(RUBY)) PKG_CONFIG ?= pkg-config +# Set EXTRA_LD_FLAGS to --undefined-version to fix +# linking against musl with llvm. + # Installation directories. PREFIX ?= /usr LIBDIR ?= $(PREFIX)/lib@@ -163,7 +166,7 @@ $(LIBA): $(OBJS) $(RANLIB) $@ $(LIBSO): $(LOBJS) - $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -fPIC -shared -o $@ $^ $(PCRE_LDLIBS) $(FTS_LDLIBS) -ldl -Wl,$(LD_SONAME_FLAGS) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -fPIC -shared -o $@ $^ $(PCRE_LDLIBS) $(FTS_LDLIBS) -ldl -Wl,$(LD_SONAME_FLAGS)$(EXTRA_LD_FLAGS:%=,%) ln -sf $@ $(TARGET) $(LIBPC): $(LIBPC).in ../VERSION --2.54.0