Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVM artifacts with/without asserts have different ABIBreakingChecks #39433

Closed
maleadt opened this issue Jan 28, 2021 · 4 comments
Closed

LLVM artifacts with/without asserts have different ABIBreakingChecks #39433

maleadt opened this issue Jan 28, 2021 · 4 comments
Assignees
Labels
external dependencies Involves LLVM, OpenBLAS, or other linked libraries

Comments

@maleadt
Copy link
Member

maleadt commented Jan 28, 2021

$ objdump -t /tmp/libLLVM_assert.v11.0.1.x86_64-linux-gnu-cxx11/lib/libLLVM-11.0.1jl.so | grep ABIBreakingChecks
0000000004eeeeb0 g     O .bss   0000000000000004              _ZN4llvm23EnableABIBreakingChecksE
$ objdump -t /tmp/libLLVM.v11.0.1.x86_64-linux-gnu-cxx11/lib/libLLVM-11.0.1jl.so | grep ABIBreakingChecks
0000000003e9ec30 g     O .bss   0000000000000004              _ZN4llvm24DisableABIBreakingChecksE

This breaks libLLVM-based artifacts when using LLVM+asserts:

ERROR: LoadError: InitError: could not load library "/home/tim/Julia/depot/artifacts/769012422c18bf09c53376e964a7fb286d1799c8/lib/libLLVMSPIRVLib.so"
/home/tim/Julia/depot/artifacts/769012422c18bf09c53376e964a7fb286d1799c8/lib/libLLVMSPIRVLib.so: undefined symbol: _ZN4llvm24DisableABIBreakingChecksE, version JL_LLVM_11.0

I guess we should set LLVM_ABI_BREAKING_CHECKS to either FORCE_ON or FORCE_OFF:

LLVM_ABI_BREAKING_CHECKS:STRING

Used to decide if LLVM should be built with ABI breaking checks or not. Allowed values are WITH_ASSERTS (default), FORCE_ON and FORCE_OFF. WITH_ASSERTS turns on ABI breaking checks in an assertion enabled build. FORCE_ON (FORCE_OFF) turns them on (off) irrespective of whether normal (NDEBUG-based) assertions are enabled or not. A version of LLVM built with ABI breaking checks is not ABI compatible with a version built without it.

@maleadt maleadt added the external dependencies Involves LLVM, OpenBLAS, or other linked libraries label Jan 28, 2021
@vtjnash
Copy link
Member

vtjnash commented Jan 30, 2021

That seems intentional, since it literally is warning you that the ABI is incompatible? (the layout of some critical objects changes)

@maleadt
Copy link
Member Author

maleadt commented Jan 30, 2021

It wasn't clear to me whether the ABI is actually incompatible between release/asserts builds, or whether the link-time check for this is just enabled when doing asserts builds. But yeah, it turns out to be the former, which implies we'll need asserts-versions of all of these artifacts... 🙁

@staticfloat Is this something #35193 would include, i.e., would the assertion-ness be discoverable from the libLLVM_jll stdlib (for use by, e.g., a Pkg hook to select the LLVM asserts-based build of any dependency)?

@maleadt maleadt closed this as completed Jan 30, 2021
@staticfloat
Copy link
Member

I haven't thought that far ahead yet. What are the ramifications? Will we have to rebuild everything that links against libLLVM? That seems.... untenable to me.

@maleadt
Copy link
Member Author

maleadt commented Jan 30, 2021

Will we have to rebuild everything that links against libLLVM? That seems.... untenable to me.

Probably. As Jameson mentions, and e.g. https://lists.llvm.org/pipermail/llvm-dev/2016-November/107148.html confirms, asserts builds are ABI incompatible with release builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external dependencies Involves LLVM, OpenBLAS, or other linked libraries
Projects
None yet
Development

No branches or pull requests

4 participants