-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
libunwind fix and cleanup #84124
libunwind fix and cleanup #84124
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
Can you say more about why? I would expect us to be able to link to a system-installed (rather than locally compiled libunwind) on any platform, is this not true today? Is there some reason we shouldn't try to support this?
I think we'll need to revert this for now at least, as we currently support a minimum system LLVM version of 10. Good to know there's an upstream fix though! Otherwise this seems pretty OK to me. |
Currently linux can choose whether to use libunwind or libgcc_s, other platform only support one implement, so enable or disable feature "system-llvm-libunwind" should have no effect. Linux is special because it's just a kernel, and the userspace can randomly have libgcc_s or libunwind (or even don't either). Other os like BSD, solaris fuchsia, and mingw have a stable userspace.
The build script will build against the source code from rust fork of llvm, and the version has been updated to 12.0. Line 140 in dc8cb63
The version of llvm codegen backend is irrelevant with libunwind |
@12101111 , are there still changes that you intend to make to this PR? |
No. |
r? @petrochenkov on the linking concern (I don't have an opinion either way) Otherwise this seems OK. |
I'm ok with addressing #84124 (comment) later if it does get addressed. |
I don't understand what happens here with regards to C and C++, in particular what
|
Could you also add comments explaining what features Especially with |
Clang don't allow this. It will trigger an error : #69222
GCC don't allow this.
In our builder, GCC for musl is not built. Instead, we just use the wrapper script
libunwind don't require libc++, just like LLVM libc which is a libc writing in c++, or rust
But it need a real c++ compiler to compile it, and g++ just don't work if libstdc++ is missing. |
I've read some docs on the difference between
Both
Ok, this part is clear.
Ok, I now understand that |
As to features llvm-libunwind and system-llvm-libunwind, It's complicated. #40113 add crt-static support of musl. This PR break the static build of musl on gnu system, and fixed by #44070. #47663 fix the mips support of libunwind. From that time to now, the linking of musl in crate #[cfg(target_env = "musl")]
#[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))]
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
extern {} Note, in that time, libunwind.a is built by a script along with musl: rust/src/ci/docker/scripts/musl-toolchain.sh Lines 60 to 69 in f717b58
Later, the Later, PR #59752 break And another PR #72746 break the bootstrap of rust on glibc when |
Yeah, the history is complicated.
(I'm not sure that this ^^^ describes the rules correctly, just something that I would expect intuitively.) |
@12101111 |
@rustbot label -S-waiting-on-author +S-waiting-on-review |
This is ok: "sccache" "clang++-11" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-fortanix-unknown-sgx" "-static" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-fortanix-unknown-sgx" "-D__ELF__" "-isystem/usr/include/x86_64-linux-gnu" "-mlvi-hardening" "-mllvm" "-x86-experimental-lvi-inline-asm-hardening" "-I" "../../src/llvm-project/libunwind/include" "-nostdinc++" "-fno-exceptions" "-fno-rtti" "-fstrict-aliasing" "-funwind-tables" "-fvisibility=hidden" "-fno-stack-protector" "-ffreestanding" "-fexceptions" "-U_FORTIFY_SOURCE" "-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS" "-D_FORTIFY_SOURCE=0" "-DRUST_SGX=1" "-D__NO_STRING_INLINES" "-D__NO_MATH_INLINES" "-D_LIBUNWIND_IS_BAREMETAL" "-D__LIBUNWIND_IS_NATIVE_ONLY" "-DNDEBUG" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/x86_64-fortanix-unknown-sgx/release/build/unwind-755fc94387c8ab25/out/libunwind.o" "-c" "/checkout/src/llvm-project/libunwind/src/libunwind.cpp" This don't compile and cause "sccache" "clang++-11" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=x86_64-fortanix-unknown-sgx" "-static" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-fortanix-unknown-sgx" "-D__ELF__" "-isystem/usr/include/x86_64-linux-gnu" "-mlvi-hardening" "-mllvm" "-x86-experimental-lvi-inline-asm-hardening" "-I" "../../src/llvm-project/libunwind/include" "-nostdinc++" "-fno-exceptions" "-fno-rtti" "-std=c++11" "-fstrict-aliasing" "-funwind-tables" "-fvisibility=hidden" "-fno-stack-protector" "-ffreestanding" "-fexceptions" "-U_FORTIFY_SOURCE" "-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS" "-D_FORTIFY_SOURCE=0" "-DRUST_SGX=1" "-D__NO_STRING_INLINES" "-D__NO_MATH_INLINES" "-D_LIBUNWIND_IS_BAREMETAL" "-D__LIBUNWIND_IS_NATIVE_ONLY" "-DNDEBUG" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/x86_64-fortanix-unknown-sgx/release/build/unwind-58c16432097bb360/out/libunwind.o" "-c" "/checkout/src/llvm-project/libunwind/src/libunwind.cpp" The only different is |
fix conditional compiling of llvm-libunwind feaure for musl target. update document of llvm-libunwind feature.
@bors r+ |
📌 Commit 52a3365 has been approved by |
How this worked previously though, when |
In original code, the x86_64-fortanix-unknown-sgx branch don't add |
⌛ Testing commit 52a3365 with merge d316c43c5b2160ab17c20acdb44a0008bc2068d9... |
This comment has been minimized.
This comment has been minimized.
Network error. |
This comment has been minimized.
This comment has been minimized.
Looks like CI is generally broken right now, will re-r+ once it's working again. |
@bors r+ |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit 52a3365 has been approved by |
☀️ Test successful - checks-actions |
Fix:
compile()
, as they are not used