libmultipath: Remove the undefined symbol from the linker script
PATCH 1/1 libmultipath: Remove the undefined symbol from the linker script
dm_get_multipath() is a static function, not a symbol that can be exported. Clang is strict about not allowing undefined symbols in linker scripts and therefore its presence prevents clang from building libmultipath.
--- libmultipath/libmultipath.version | 1 - 1 file changed, 1 deletion(-)
libmultipath/libmultipath.version +0 -1
@@ -85,7 +85,6 @@ global: dm_geteventnr; dm_get_major_minor; dm_get_maps; - dm_get_multipath; dm_is_mpath; dm_mapname; dm_prereq;
Signature · 1 line
2.52.0
Quoted 9 lines · Michal Rostecki
dm_get_multipath()is a static function, not a symbol that can be exported. Clang is strict about not allowing undefined symbols in linker
scripts and therefore its presence prevents clang from building libmultipath.Fixes bf3a4ad ("libmultipath: simplify dm_get_maps()")Signed-off-by Michal Rostecki <[email protected]>
Thanks!
Yet I'm wondering which compiler version you use, or if you use any non-standard compilation options. Our CI compiles multipath-tools with MANY different versions of clang, but never encountered this problem.
Martin
Quoted 17 lines
---
libmultipath/libmultipath.version | 1 -1 file changed, 1 deletion(-)libmultipath/libmultipath.version +0
-1@@ -85,7 +85,6 @@ global: dm_geteventnr; dm_get_major_minor; dm_get_maps; - dm_get_multipath; dm_is_mpath; dm_mapname; dm_prereq;
Quoted 14 lines · Martin Wilck
Quoted 9 lines · Michal Rostecki
dm_get_multipath()is a static function, not a symbol that can be exported. Clang is strict about not allowing undefined symbols in linker
scripts and therefore its presence prevents clang from building libmultipath.Fixes bf3a4ad ("libmultipath: simplify dm_get_maps()")Signed-off-by Michal Rostecki [email protected]
Quoted 8 lines
Thanks!
Reviewed-by Martin Wilck [email protected]Yet I'm wondering which compiler version you use, or if you use any non-standard compilation options. Our CI compiles multipath-tools with MANY different versions of clang, but never encountered this problem.
I'm glad you asked - after reading your email I tried using different linkers and it looks like it's a linker error and it's thrown only by lld. lld enabled --no-undefined-version as a default option.[0] Choice of a compiler (gcc, clang) shouldn't matter.
I'm using clang 21.1.7 on Gentoo on musl-llvm profile, which uses full LLVM toolchain (clang + compiler-rt + libunwind + lld, also in 21.1.7 version) system-wide, so that's why I've seen the error without providing any additional flags.
From what I see, no other linker enables that by default and I've been able to build the current master without errors with bfd and mold:
$ make LDFLAGS="-fuse-ld=bfd" $ make LDFLAGS="-fuse-ld=mold"
One can reproduce the error on any system by specifying lld explicitly:
$ make LDFLAGS="-fuse-ld=lld"
Or by passing --no-undefined-version (and making the warning fatal), which throws an error wyth any linker:
$ make LDFLAGS="-fuse-ld=mold -Wl,--no-undefined-version -Wl,--fatal-warnings".
I will send v2 with a more accurate commit message.
[0] https://reviews.llvm.org/D135402
Quoted 19 lines
Martin
Quoted 17 lines
---
libmultipath/libmultipath.version | 1 -1 file changed, 1 deletion(-)libmultipath/libmultipath.version +0
-1@@ -85,7 +85,6 @@ global: dm_geteventnr; dm_get_major_minor; dm_get_maps; - dm_get_multipath; dm_is_mpath; dm_mapname; dm_prereq;
Quoted 51 lines · On Wed, 2026-01-07 at 16:57 +0000, [email protected] wrote:
Quoted 16 lines · Martin Wilck
Quoted 9 lines · Michal Rostecki
dm_get_multipath()is a static function, not a symbol that can be exported. Clang is strict about not allowing undefined symbols in linker
scripts and therefore its presence prevents clang from building libmultipath.Fixes bf3a4ad ("libmultipath: simplify dm_get_maps()")Signed-off-by Michal Rostecki [email protected]Thanks!
Quoted 8 lines
Reviewed-by Martin Wilck [email protected]Yet I'm wondering which compiler version you use, or if you use any non-standard compilation options. Our CI compiles multipath-tools with
MANY different versions of clang, but never encountered this problem.I'm glad you asked - after reading your email I tried using different linkers and it looks like it's a linker error and it's thrown only by lld. lld enabled --no-undefined-version as a default option.[0] Choice
of a compiler (gcc, clang) shouldn't matter.I'm using clang 21.1.7 on Gentoo on musl-llvm profile, which uses full
LLVM toolchain (clang + compiler-rt + libunwind + lld, also in 21.1.7 version) system-wide, so that's why I've seen the error without providing any additional flags.From what I see, no other linker enables that by default and I've been
able to build the current master without errors with bfd and mold:$ make LDFLAGS="-fuse-ld=bfd" $ make LDFLAGS="-fuse-ld=mold"One can reproduce the error on any system by specifying lld explicitly:
$ make LDFLAGS="-fuse-ld=lld"
Quoted 7 lines
Or by passing --no-undefined-version (and making the warning fatal), which throws an error wyth any linker:
$ make LDFLAGS="-fuse-ld=mold -Wl,--no-undefined-version -Wl,--fatal- warnings".I will send v2 with a more accurate commit message.
Not necessary. I've already applied your patch to my "queue" branch. I can add this additional information to the existing commit.
This makes we wonder whether we could/should use lld in some of our CI runs (probably those where we use clang as compiler?). Currently the containers we use for the CI don't contain lld.
Martin