Uh oh!
There was an error while loading. Please reload this page.
libunwind fix and cleanup - #84124
Conversation
rust-highfive
commented
Apr 12, 2021
(rust-highfive has picked a reviewer for you, use r? to override) |
Mark-Simulacrum
commented
Apr 27, 2021
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. |
12101111
commented
Apr 27, 2021
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 |
Uh oh!
There was an error while loading. Please reload this page.
bstrie
commented
May 12, 2021
@12101111 , are there still changes that you intend to make to this PR? |
12101111
commented
May 13, 2021
No. |
Mark-Simulacrum
commented
May 14, 2021
r? @petrochenkov on the linking concern (I don't have an opinion either way) Otherwise this seems OK. |
petrochenkov
commented
May 16, 2021
I'm ok with addressing #84124 (comment) later if it does get addressed. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
petrochenkov
commented
May 16, 2021
I don't understand what happens here with regards to C and C++, in particular what
|
petrochenkov
commented
May 16, 2021
Could you also add comments explaining what features Especially with |
12101111
commented
May 16, 2021
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. |
petrochenkov
commented
May 16, 2021
I've read some docs on the difference between
Both
Ok, this part is clear.
Ok, I now understand that |
12101111
commented
May 16, 2021
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.) |
Uh oh!
There was an error while loading. Please reload this page.
petrochenkov
commented
May 18, 2021
@12101111 |
12101111
commented
May 19, 2021
@rustbot label -S-waiting-on-author +S-waiting-on-review |
12101111
commented
May 26, 2021
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.
petrochenkov
commented
May 26, 2021
@bors r+ |
bors
commented
May 26, 2021
📌 Commit 52a3365 has been approved by |
petrochenkov
commented
May 26, 2021
How this worked previously though, when |
12101111
commented
May 26, 2021
In original code, the x86_64-fortanix-unknown-sgx branch don't add |
bors
commented
May 26, 2021
⌛ Testing commit 52a3365 with merge d316c43c5b2160ab17c20acdb44a0008bc2068d9... |
This comment has been minimized.
This comment has been minimized.
12101111
commented
May 26, 2021
Network error. |
This comment has been minimized.
This comment has been minimized.
petrochenkov
commented
May 26, 2021
Looks like CI is generally broken right now, will re-r+ once it's working again. |
petrochenkov
commented
May 26, 2021
@bors r+ |
bors
commented
May 26, 2021
💡 This pull request was already approved, no need to approve it again.
|
bors
commented
May 26, 2021
📌 Commit 52a3365 has been approved by |
bors
commented
May 27, 2021
bors
commented
May 27, 2021
☀️ Test successful - checks-actions |
Fix:
compile(), as they are not used