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

[compiler-rt] Check for and use -lunwind when linking with -nodefaultlibs #65912

Merged
merged 1 commit into from
Sep 15, 2023

Conversation

mstorsjo
Copy link
Member

If libc++ is available and should be used as the ubsan C++ ABI library, the check for libc++ might fail if libc++ is a static library, as the -nodefaultlibs flag inhibits a potential compiler default -lunwind.

Just like the -nodefaultlibs configuration tests for and manually adds a bunch of compiler default libraries, look for -lunwind too.

…libs

If libc++ is available and should be used as the ubsan C++ ABI
library, the check for libc++ might fail if libc++ is a static
library, as the -nodefaultlibs flag inhibits a potential compiler
default -lunwind.

Just like the -nodefaultlibs configuration tests for and manually
adds a bunch of compiler default libraries, look for -lunwind too.
@mstorsjo mstorsjo added cmake Build system in general and CMake in particular compiler-rt:ubsan Undefined behavior sanitizer labels Sep 10, 2023
@mstorsjo mstorsjo requested a review from petrhosek September 10, 2023 21:26
@mstorsjo
Copy link
Member Author

Ping @petrhosek

@mstorsjo mstorsjo merged commit 64c0bdd into llvm:main Sep 15, 2023
@mstorsjo mstorsjo deleted the compiler-rt-libunwind branch September 15, 2023 08:49
mstorsjo added a commit that referenced this pull request Sep 15, 2023
…odefaultlibs (#65912)"

This reverts commit 64c0bdd.

This seems to run into errors on some buildbots; configure errors
out like this:

    -- Looking for _Unwind_RaiseException in unwind
    -- Looking for _Unwind_RaiseException in unwind - not found
    CMake Error at /usr/share/cmake-3.25/Modules/CheckLibraryExists.cmake:71 (try_compile):
      Only libraries may be used as try_compile or try_run IMPORTED
      LINK_LIBRARIES.  Got unwind of type UTILITY.
    Call Stack (most recent call first):
      /b/sanitizer-aarch64-linux-fuzzer/build/llvm-project/compiler-rt/cmake/config-ix.cmake:66 (check_library_exists)
      /b/sanitizer-aarch64-linux-fuzzer/build/llvm-project/compiler-rt/CMakeLists.txt:281 (include)
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
…libs (llvm#65912)

If libc++ is available and should be used as the ubsan C++ ABI library,
the check for libc++ might fail if libc++ is a static library, as the
-nodefaultlibs flag inhibits a potential compiler default -lunwind.

Just like the -nodefaultlibs configuration tests for and manually adds a
bunch of compiler default libraries, look for -lunwind too.
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
…odefaultlibs (llvm#65912)"

This reverts commit 64c0bdd.

This seems to run into errors on some buildbots; configure errors
out like this:

    -- Looking for _Unwind_RaiseException in unwind
    -- Looking for _Unwind_RaiseException in unwind - not found
    CMake Error at /usr/share/cmake-3.25/Modules/CheckLibraryExists.cmake:71 (try_compile):
      Only libraries may be used as try_compile or try_run IMPORTED
      LINK_LIBRARIES.  Got unwind of type UTILITY.
    Call Stack (most recent call first):
      /b/sanitizer-aarch64-linux-fuzzer/build/llvm-project/compiler-rt/cmake/config-ix.cmake:66 (check_library_exists)
      /b/sanitizer-aarch64-linux-fuzzer/build/llvm-project/compiler-rt/CMakeLists.txt:281 (include)
mstorsjo added a commit to mstorsjo/llvm-project that referenced this pull request Oct 4, 2023
…odefaultlibs

If libc++ is available and should be used as the ubsan C++ ABI library,
the check for libc++ might fail if libc++ is a static library, as the
-nodefaultlibs flag inhibits a potential compiler default -lunwind.

Just like the -nodefaultlibs configuration tests for and manually adds a
bunch of compiler default libraries, look for -lunwind too.

This is a reland of llvm#65912.
mstorsjo added a commit that referenced this pull request Oct 5, 2023
…odefaultlibs (#66584)

If libc++ is available and should be used as the ubsan C++ ABI library,
the check for libc++ might fail if libc++ is a static library, as the
-nodefaultlibs flag inhibits a potential compiler default -lunwind.

Just like the -nodefaultlibs configuration tests for and manually adds a
bunch of compiler default libraries, look for -lunwind too.

This is a reland of #65912.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake Build system in general and CMake in particular compiler-rt:ubsan Undefined behavior sanitizer compiler-rt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants