libselinux: Add EXTRA_LD_SONAME_FLAGS for musl+llvm builds
Stephen Smalley
maintainerPATCH 1/1 libselinux: Add EXTRA_LD_SONAME_FLAGS for musl+llvm builds
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.
--- README.md | 4 ++++ libselinux/src/Makefile | 4 +++- 2 files changed, 7 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_SONAME_FLAGS + +Build with EXTRA_LD_SONAME_FLAGS=--undefined-version to fix +linking against musl with llvm. macOS -----
libselinux/src/Makefile +3 -1
@@ -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
Signature · 1 line
2.54.0
Quoted 36 lines · Stephen Smalley
Introduce an optionally defined
EXTRA_LD_SONAME_FLAGSvariable for use by musl+llvm builds to pass --undefined-version. This enables such builds to link despite the intentionally omittedmatchpathcon_filespec_add64symbol.Fixes 9395cc03226a0 ("Always build for LFS mode on 32-bit archs.")Reported-by Pepper Gray <[email protected]>Signed-off-by Stephen Smalley <[email protected]>--- README.md | 4 ++++ libselinux/src/Makefile | 4 +++- 2 files changed, 7 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_SONAME_FLAGS + +Build with EXTRA_LD_SONAME_FLAGS=--undefined-version to fix +linking against musl with llvm. macOS -----libselinux/src/Makefile +0
-0
libselinux/src/Makefile CFLAGS ?= -O -Wall -W -Wundef -Wformat-y2k -Wformat-security -Winit-self -Wmissi · line 96
Quoted 7 lines
libselinux/src/Makefile +3
-1@@ -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:%=,%)
Quoted 4 lines
libselinux/src/Makefile +0
-0ifeq ($(OS), Darwin) override CFLAGS += -I/opt/local/includeSignature · 1 line
2.54.0