Skip to content

Commit

Permalink
make: use readelf for LLVM symbol version detection (#54713)
Browse files Browse the repository at this point in the history
Apparently on some distributions `nm --with-symbol-versions` does not
report symbol versions, despite the flag.

`readelf` should be a more reliable alternative which is also part of
binutils.

See spack/spack#44534 (comment)
for more information

(cherry picked from commit d0f165f)
  • Loading branch information
topolarity authored and KristofferC committed Jun 19, 2024
1 parent 9fac394 commit 005fd2f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ ifeq ($(JULIACODEGEN),LLVM)
ifneq ($(USE_SYSTEM_LLVM),0)
# USE_SYSTEM_LLVM != 0
CG_LLVMLINK += $(LLVM_LDFLAGS) $(shell $(LLVM_CONFIG_HOST) --libs --system-libs)
LLVM_SHLIB_SYMBOL_VERSION := $(shell nm -D --with-symbol-versions $(shell $(LLVM_CONFIG_HOST) --libfiles --link-shared | awk '{print $1; exit}') | \
LLVM_SHLIB_SYMBOL_VERSION := $(shell readelf -W --dyn-syms $(shell $(LLVM_CONFIG_HOST) --libfiles --link-shared | awk '{print $1; exit}') | \
grep _ZN4llvm3Any6TypeId | head -n 1 | sed -ne 's/.*@//p')

# HACK: llvm-config doesn't correctly point to shared libs on all platforms
Expand Down

0 comments on commit 005fd2f

Please sign in to comment.