Skip to content

[libcxx] Fix build for glibc < 2.27 #121893

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

Merged
merged 4 commits into from
Jan 7, 2025
Merged

[libcxx] Fix build for glibc < 2.27 #121893

merged 4 commits into from
Jan 7, 2025

Conversation

kongy
Copy link
Collaborator

@kongy kongy commented Jan 7, 2025

PR #109211 introduced a build break on systems with glibc < 2.27, since copy_file_range was only introduced after that version. A version check is added to prevent this breakage.

PR llvm#109211 introduced a build break on systems with glibc < 2.27, since
copy_file_range was only introduced after that version. A version check
is added to prevent this breakage.
@kongy kongy requested a review from vitalybuka January 7, 2025 07:17
@kongy kongy requested a review from a team as a code owner January 7, 2025 07:18
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jan 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 7, 2025

@llvm/pr-subscribers-libcxx

Author: Yi Kong (kongy)

Changes

PR #109211 introduced a build break on systems with glibc < 2.27, since copy_file_range was only introduced after that version. A version check is added to prevent this breakage.


Full diff: https://github.com/llvm/llvm-project/pull/121893.diff

1 Files Affected:

  • (modified) libcxx/src/filesystem/operations.cpp (+2-2)
diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp
index bd37c5af86f6c3..e68f89ab1e6114 100644
--- a/libcxx/src/filesystem/operations.cpp
+++ b/libcxx/src/filesystem/operations.cpp
@@ -39,8 +39,8 @@
 #include <fcntl.h> /* values for fchmodat */
 #include <time.h>
 
-// since Linux 4.5 and FreeBSD 13, but the Linux libc wrapper is only provided by glibc and musl
-#if (defined(__linux__) && (defined(__GLIBC__) || _LIBCPP_HAS_MUSL_LIBC)) || defined(__FreeBSD__)
+// since Linux 4.5 and FreeBSD 13, but the Linux libc wrapper is only provided by glibc >= 2.27 and musl
+#if (defined(__linux__) && (_LIBCPP_GLIBC_PREREQ(2, 27) || _LIBCPP_HAS_MUSL_LIBC)) || defined(__FreeBSD__)
 #  define _LIBCPP_FILESYSTEM_USE_COPY_FILE_RANGE
 #endif
 #if __has_include(<sys/sendfile.h>)

Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like I'd rather just bump the minimum required glibc. 2.27 is almost seven years old by now, which doesn't seem like that crazy of a requirement.

@Jannik2099
Copy link
Contributor

Jannik2099 commented Jan 7, 2025

For reference, RHEL 8 uses glibc 2.28, and Ubuntu 20.04 uses glibc 2.31
Both are the oldest still supported versions, respectively.

@kongy
Copy link
Collaborator Author

kongy commented Jan 7, 2025

Android is still using glibc 2.17 on the host, but we're planning to move to musl. There are still some issues preventing us from doing so. We are not planning to upgrade glibc before the migration.

Since this requires minimal effort to support (just a version macro check), I hope we can continue supporting older versions until it becomes genuinely difficult to maintain.

@philnik777
Copy link
Contributor

Android is still using glibc 2.17 on the host, but we're planning to move to musl. There are still some issues preventing us from doing so. We are not planning to upgrade glibc before the migration.

Since this requires minimal effort to support (just a version macro check), I hope we can continue supporting older versions until it becomes genuinely difficult to maintain.

We already only claim support for glibc 2.24 and later and the Android bots are just happy with the patch. Also, A libc from 2012 seems a bit unreasonable to support IMO. Having support for half a dozen different libc implementations is already a strain and we don't need even more of that by supporting versions that are more than a decade old.

I'm also very sceptical of "just a version macro check". These accumulate, and while one of them isn't much of a problem, all of them together are a burden to support.

@ldionne
Copy link
Member

ldionne commented Jan 7, 2025

We already only claim support for glibc 2.24 and later and the Android bots are just happy with the patch.

If Android is using glibc 2.17, why don't our CI bots fail after applying #109211? CC @Jannik2099

@Jannik2099
Copy link
Contributor

If Android is using glibc 2.17, why don't our CI bots fail after applying #109211? CC @Jannik2099

from what I understand, Google is using glibc 2.17 on some build hosts, meaning the host is some GNU-esque userland that builds an Android environment. Unrelated to Android itself, which always uses Bionic, which is what CI tests.

@ldionne ldionne changed the title [libcxx] Fix build for glibc < 2.27 [libcxx] Fix build for glibc < 2.17 Jan 7, 2025
@ldionne ldionne changed the title [libcxx] Fix build for glibc < 2.17 [libcxx] Fix build for glibc < 2.27 Jan 7, 2025
@ldionne
Copy link
Member

ldionne commented Jan 7, 2025

I'm a bit confused. @kongy Mentioned Glibc 2.27 in their original comment, but then 2.17 in a subsequent comment. The patch itself checks for 2.27. @kongy Can you confirm that you meant 2.27 in #121893 (comment)?

Assuming that's correct, then I think we should actually support this since we do claim to support glibc >= 2.24, and 2.27 is certainly more recent than 2.24. We'd then add this and remove it once we bump the glibc requirement.

@nico
Copy link
Contributor

nico commented Jan 7, 2025

FWIW, the original change also breaks building chromium against a debian bullseye sysroot (which you can get from here: https://commondatastorage.googleapis.com/chrome-linux-sysroot/dec7a3a0fc5b83b909cba1b6d119077e0429a138eadef6bf5a0f2e03b1904631). https://issues.chromium.org/issues/388064491 has some details.

@Jannik2099
Copy link
Contributor

FWIW, the original change also breaks building chromium against a debian bullseye sysroot

bullseye is glibc 2.31, and as already noticed in the link, the symbol is present in your libc. I think this is due to your linker scripts / wrapper and needs to be fixed on the chromium end?

On that note a heads up, you'll possibly want to add copy_file_range to chromium's seccomp whitelist

@kongy
Copy link
Collaborator Author

kongy commented Jan 7, 2025

I'm a bit confused. @kongy Mentioned Glibc 2.27 in their original comment, but then 2.17 in a subsequent comment. The patch itself checks for 2.27. @kongy Can you confirm that you meant 2.27 in #121893 (comment)?

To clarify, copy_file_range was introduced in Glibc 2.27 (https://abi-laboratory.pro/?view=changelog&l=glibc&v=2.27). Android's host build environment uses Glibc 2.17.

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, this patch LGTM since we support glibc 2.24 and this is truly required for glibc 2.24 through 2.26.

@philnik777 We can and should clean this up as soon as we drop support for older glibcs.

@Jannik2099
Copy link
Contributor

In that case, this patch LGTM

no, see AIX CI

/scratch/powerllvm/cpap8006/llvm-project/libcxx-ci/libcxx/src/filesystem/operations.cpp:43:29: error: function-like macro '_LIBCPP_GLIBC_PREREQ' is not defined
   43 | #if (defined(__linux__) && (_LIBCPP_GLIBC_PREREQ(2, 27) || _LIBCPP_HAS_MUSL_LIBC)) || defined(__FreeBSD__)
      |                             ^
1 error generated.

this'll require a bit of ugly #if defined() machinery, unless we just define _LIBCPP_GLIBC_PREREQ to 0 on non-glibc?

Copy link

github-actions bot commented Jan 7, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@ldionne
Copy link
Member

ldionne commented Jan 7, 2025

Can be merged once the CI is green.

@vitalybuka vitalybuka merged commit cda43e1 into llvm:main Jan 7, 2025
62 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 7, 2025

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux-fast running on sanitizer-buildbot4 while building libcxx at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/169/builds/7146

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 88153 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.
FAIL: LLVM :: ExecutionEngine/JITLink/x86-64/MachO_weak_references.s (57538 of 88153)
******************** TEST 'LLVM :: ExecutionEngine/JITLink/x86-64/MachO_weak_references.s' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: rm -rf /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp && mkdir -p /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp
+ rm -rf /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp
+ mkdir -p /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp
RUN: at line 2: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp/macho_weak_refs.o /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_weak_references.s
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp/macho_weak_refs.o /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_weak_references.s
RUN: at line 3: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-jitlink -noexec -check-name=jitlink-check-bar-present -abs bar=0x1 -check=/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_weak_references.s /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp/macho_weak_refs.o
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-jitlink -noexec -check-name=jitlink-check-bar-present -abs bar=0x1 -check=/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_weak_references.s /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp/macho_weak_refs.o
RUN: at line 4: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-jitlink -noexec -check-name=jitlink-check-bar-absent -check=/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_weak_references.s /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp/macho_weak_refs.o
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-jitlink -noexec -check-name=jitlink-check-bar-absent -check=/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_weak_references.s /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp/macho_weak_refs.o

=================================================================
==2164067==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x61eb45d3e20f in malloc /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:68:3
    #1 0x714704a9cf8b  (/lib/x86_64-linux-gnu/libc.so.6+0x9cf8b) (BuildId: 5f3f024b472f38389da3a2f567b3d0eaa8835ca2)
    #2 0x714704a9d613 in dlsym (/lib/x86_64-linux-gnu/libc.so.6+0x9d613) (BuildId: 5f3f024b472f38389da3a2f567b3d0eaa8835ca2)
    #3 0x61eb46ea6f66 in llvm::orc::SelfExecutorProcessControl::lookupSymbolsAsync(llvm::ArrayRef<llvm::orc::DylibManager::LookupRequest>, llvm::unique_function<void (llvm::Expected<std::__1::vector<std::__1::vector<llvm::orc::ExecutorSymbolDef, std::__1::allocator<llvm::orc::ExecutorSymbolDef>>, std::__1::allocator<std::__1::vector<llvm::orc::ExecutorSymbolDef, std::__1::allocator<llvm::orc::ExecutorSymbolDef>>>>>)>) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp:101:26
    #4 0x61eb46cd68f9 in llvm::orc::EPCDynamicLibrarySearchGenerator::tryToGenerate(llvm::orc::LookupState&, llvm::orc::LookupKind, llvm::orc::JITDylib&, llvm::orc::JITDylibLookupFlags, llvm::orc::SymbolLookupSet const&) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/Orc/EPCDynamicLibrarySearchGenerator.cpp:56:21
    #5 0x61eb46bd791f in llvm::orc::ExecutionSession::OL_applyQueryPhase1(std::__1::unique_ptr<llvm::orc::InProgressLookupState, std::__1::default_delete<llvm::orc::InProgressLookupState>>, llvm::Error) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:2473:19
    #6 0x61eb46bc872c in llvm::orc::ExecutionSession::lookup(llvm::orc::LookupKind, std::__1::vector<std::__1::pair<llvm::orc::JITDylib*, llvm::orc::JITDylibLookupFlags>, std::__1::allocator<std::__1::pair<llvm::orc::JITDylib*, llvm::orc::JITDylibLookupFlags>>> const&, llvm::orc::SymbolLookupSet, llvm::orc::SymbolState, llvm::unique_function<void (llvm::Expected<llvm::DenseMap<llvm::orc::SymbolStringPtr, llvm::orc::ExecutorSymbolDef, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>, llvm::detail::DenseMapPair<llvm::orc::SymbolStringPtr, llvm::orc::ExecutorSymbolDef>>>)>, std::__1::function<void (llvm::DenseMap<llvm::orc::JITDylib*, llvm::DenseSet<llvm::orc::SymbolStringPtr, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>>, llvm::DenseMapInfo<llvm::orc::JITDylib*, void>, llvm::detail::DenseMapPair<llvm::orc::JITDylib*, llvm::DenseSet<llvm::orc::SymbolStringPtr, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>>>> const&)>) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:1814:3
    #7 0x61eb46d981e2 in llvm::orc::LinkGraphLinkingLayer::JITLinkCtx::lookup(llvm::DenseMap<llvm::orc::SymbolStringPtr, llvm::jitlink::SymbolLookupFlags, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>, llvm::detail::DenseMapPair<llvm::orc::SymbolStringPtr, llvm::jitlink::SymbolLookupFlags>> const&, std::__1::unique_ptr<llvm::jitlink::JITLinkAsyncLookupContinuation, std::__1::default_delete<llvm::jitlink::JITLinkAsyncLookupContinuation>>) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/Orc/LinkGraphLinkingLayer.cpp:117:8
    #8 0x61eb464aefb7 in llvm::jitlink::JITLinkerBase::linkPhase2(std::__1::unique_ptr<llvm::jitlink::JITLinkerBase, std::__1::default_delete<llvm::jitlink::JITLinkerBase>>, llvm::Expected<std::__1::unique_ptr<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc, std::__1::default_delete<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc>>>) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp:122:8
    #9 0x61eb464b5865 in operator() /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp:63:18
    #10 0x61eb464b5865 in void llvm::detail::UniqueFunctionBase<void, llvm::Expected<std::__1::unique_ptr<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc, std::__1::default_delete<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc>>>>::CallImpl<llvm::jitlink::JITLinkerBase::linkPhase1(std::__1::unique_ptr<llvm::jitlink::JITLinkerBase, std::__1::default_delete<llvm::jitlink::JITLinkerBase>>)::$_1>(void*, llvm::Expected<std::__1::unique_ptr<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc, std::__1::default_delete<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc>>>&) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:222:12
    #11 0x61eb46e00e61 in operator() /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:387:12
    #12 0x61eb46e00e61 in llvm::orc::MapperJITLinkMemoryManager::allocate(llvm::jitlink::JITLinkDylib const*, llvm::jitlink::LinkGraph&, llvm::unique_function<void (llvm::Expected<std::__1::unique_ptr<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc, std::__1::default_delete<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc>>>)>)::$_0::operator()(llvm::Expected<llvm::orc::ExecutorAddrRange>) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/Orc/MapperJITLinkMemoryManager.cpp:120:5
    #13 0x61eb46e12188 in void llvm::detail::UniqueFunctionBase<void, llvm::Expected<llvm::orc::ExecutorAddrRange>>::CallImpl<llvm::orc::MapperJITLinkMemoryManager::allocate(llvm::jitlink::JITLinkDylib const*, llvm::jitlink::LinkGraph&, llvm::unique_function<void (llvm::Expected<std::__1::unique_ptr<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc, std::__1::default_delete<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc>>>)>)::$_0>(void*, llvm::Expected<llvm::orc::ExecutorAddrRange>&) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:222:12
    #14 0x61eb45dbe59b in operator() /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:387:12
    #15 0x61eb45dbe59b in llvm::InProcessDeltaMapper::reserve(unsigned long, llvm::unique_function<void (llvm::Expected<llvm::orc::ExecutorAddrRange>)>)::'lambda'(llvm::Expected<llvm::orc::ExecutorAddrRange>)::operator()(llvm::Expected<llvm::orc::ExecutorAddrRange>) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/llvm-jitlink/llvm-jitlink.cpp:566:11
    #16 0x61eb45dbde68 in void llvm::detail::UniqueFunctionBase<void, llvm::Expected<llvm::orc::ExecutorAddrRange>>::CallImpl<llvm::InProcessDeltaMapper::reserve(unsigned long, llvm::unique_function<void (llvm::Expected<llvm::orc::ExecutorAddrRange>)>)::'lambda'(llvm::Expected<llvm::orc::ExecutorAddrRange>)>(void*, llvm::Expected<llvm::orc::ExecutorAddrRange>&) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:222:12
    #17 0x61eb46e13d5f in operator() /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:387:12
    #18 0x61eb46e13d5f in llvm::orc::InProcessMemoryMapper::reserve(unsigned long, llvm::unique_function<void (llvm::Expected<llvm::orc::ExecutorAddrRange>)>) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp:57:3
Step 10 (stage2/asan_ubsan check) failure: stage2/asan_ubsan check (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 88153 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.
FAIL: LLVM :: ExecutionEngine/JITLink/x86-64/MachO_weak_references.s (57538 of 88153)
******************** TEST 'LLVM :: ExecutionEngine/JITLink/x86-64/MachO_weak_references.s' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: rm -rf /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp && mkdir -p /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp
+ rm -rf /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp
+ mkdir -p /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp
RUN: at line 2: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp/macho_weak_refs.o /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_weak_references.s
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp/macho_weak_refs.o /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_weak_references.s
RUN: at line 3: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-jitlink -noexec -check-name=jitlink-check-bar-present -abs bar=0x1 -check=/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_weak_references.s /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp/macho_weak_refs.o
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-jitlink -noexec -check-name=jitlink-check-bar-present -abs bar=0x1 -check=/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_weak_references.s /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp/macho_weak_refs.o
RUN: at line 4: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-jitlink -noexec -check-name=jitlink-check-bar-absent -check=/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_weak_references.s /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp/macho_weak_refs.o
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-jitlink -noexec -check-name=jitlink-check-bar-absent -check=/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_weak_references.s /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_weak_references.s.tmp/macho_weak_refs.o

=================================================================
==2164067==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x61eb45d3e20f in malloc /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:68:3
    #1 0x714704a9cf8b  (/lib/x86_64-linux-gnu/libc.so.6+0x9cf8b) (BuildId: 5f3f024b472f38389da3a2f567b3d0eaa8835ca2)
    #2 0x714704a9d613 in dlsym (/lib/x86_64-linux-gnu/libc.so.6+0x9d613) (BuildId: 5f3f024b472f38389da3a2f567b3d0eaa8835ca2)
    #3 0x61eb46ea6f66 in llvm::orc::SelfExecutorProcessControl::lookupSymbolsAsync(llvm::ArrayRef<llvm::orc::DylibManager::LookupRequest>, llvm::unique_function<void (llvm::Expected<std::__1::vector<std::__1::vector<llvm::orc::ExecutorSymbolDef, std::__1::allocator<llvm::orc::ExecutorSymbolDef>>, std::__1::allocator<std::__1::vector<llvm::orc::ExecutorSymbolDef, std::__1::allocator<llvm::orc::ExecutorSymbolDef>>>>>)>) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp:101:26
    #4 0x61eb46cd68f9 in llvm::orc::EPCDynamicLibrarySearchGenerator::tryToGenerate(llvm::orc::LookupState&, llvm::orc::LookupKind, llvm::orc::JITDylib&, llvm::orc::JITDylibLookupFlags, llvm::orc::SymbolLookupSet const&) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/Orc/EPCDynamicLibrarySearchGenerator.cpp:56:21
    #5 0x61eb46bd791f in llvm::orc::ExecutionSession::OL_applyQueryPhase1(std::__1::unique_ptr<llvm::orc::InProgressLookupState, std::__1::default_delete<llvm::orc::InProgressLookupState>>, llvm::Error) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:2473:19
    #6 0x61eb46bc872c in llvm::orc::ExecutionSession::lookup(llvm::orc::LookupKind, std::__1::vector<std::__1::pair<llvm::orc::JITDylib*, llvm::orc::JITDylibLookupFlags>, std::__1::allocator<std::__1::pair<llvm::orc::JITDylib*, llvm::orc::JITDylibLookupFlags>>> const&, llvm::orc::SymbolLookupSet, llvm::orc::SymbolState, llvm::unique_function<void (llvm::Expected<llvm::DenseMap<llvm::orc::SymbolStringPtr, llvm::orc::ExecutorSymbolDef, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>, llvm::detail::DenseMapPair<llvm::orc::SymbolStringPtr, llvm::orc::ExecutorSymbolDef>>>)>, std::__1::function<void (llvm::DenseMap<llvm::orc::JITDylib*, llvm::DenseSet<llvm::orc::SymbolStringPtr, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>>, llvm::DenseMapInfo<llvm::orc::JITDylib*, void>, llvm::detail::DenseMapPair<llvm::orc::JITDylib*, llvm::DenseSet<llvm::orc::SymbolStringPtr, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>>>> const&)>) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:1814:3
    #7 0x61eb46d981e2 in llvm::orc::LinkGraphLinkingLayer::JITLinkCtx::lookup(llvm::DenseMap<llvm::orc::SymbolStringPtr, llvm::jitlink::SymbolLookupFlags, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>, llvm::detail::DenseMapPair<llvm::orc::SymbolStringPtr, llvm::jitlink::SymbolLookupFlags>> const&, std::__1::unique_ptr<llvm::jitlink::JITLinkAsyncLookupContinuation, std::__1::default_delete<llvm::jitlink::JITLinkAsyncLookupContinuation>>) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/Orc/LinkGraphLinkingLayer.cpp:117:8
    #8 0x61eb464aefb7 in llvm::jitlink::JITLinkerBase::linkPhase2(std::__1::unique_ptr<llvm::jitlink::JITLinkerBase, std::__1::default_delete<llvm::jitlink::JITLinkerBase>>, llvm::Expected<std::__1::unique_ptr<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc, std::__1::default_delete<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc>>>) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp:122:8
    #9 0x61eb464b5865 in operator() /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp:63:18
    #10 0x61eb464b5865 in void llvm::detail::UniqueFunctionBase<void, llvm::Expected<std::__1::unique_ptr<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc, std::__1::default_delete<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc>>>>::CallImpl<llvm::jitlink::JITLinkerBase::linkPhase1(std::__1::unique_ptr<llvm::jitlink::JITLinkerBase, std::__1::default_delete<llvm::jitlink::JITLinkerBase>>)::$_1>(void*, llvm::Expected<std::__1::unique_ptr<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc, std::__1::default_delete<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc>>>&) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:222:12
    #11 0x61eb46e00e61 in operator() /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:387:12
    #12 0x61eb46e00e61 in llvm::orc::MapperJITLinkMemoryManager::allocate(llvm::jitlink::JITLinkDylib const*, llvm::jitlink::LinkGraph&, llvm::unique_function<void (llvm::Expected<std::__1::unique_ptr<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc, std::__1::default_delete<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc>>>)>)::$_0::operator()(llvm::Expected<llvm::orc::ExecutorAddrRange>) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/Orc/MapperJITLinkMemoryManager.cpp:120:5
    #13 0x61eb46e12188 in void llvm::detail::UniqueFunctionBase<void, llvm::Expected<llvm::orc::ExecutorAddrRange>>::CallImpl<llvm::orc::MapperJITLinkMemoryManager::allocate(llvm::jitlink::JITLinkDylib const*, llvm::jitlink::LinkGraph&, llvm::unique_function<void (llvm::Expected<std::__1::unique_ptr<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc, std::__1::default_delete<llvm::jitlink::JITLinkMemoryManager::InFlightAlloc>>>)>)::$_0>(void*, llvm::Expected<llvm::orc::ExecutorAddrRange>&) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:222:12
    #14 0x61eb45dbe59b in operator() /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:387:12
    #15 0x61eb45dbe59b in llvm::InProcessDeltaMapper::reserve(unsigned long, llvm::unique_function<void (llvm::Expected<llvm::orc::ExecutorAddrRange>)>)::'lambda'(llvm::Expected<llvm::orc::ExecutorAddrRange>)::operator()(llvm::Expected<llvm::orc::ExecutorAddrRange>) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/llvm-jitlink/llvm-jitlink.cpp:566:11
    #16 0x61eb45dbde68 in void llvm::detail::UniqueFunctionBase<void, llvm::Expected<llvm::orc::ExecutorAddrRange>>::CallImpl<llvm::InProcessDeltaMapper::reserve(unsigned long, llvm::unique_function<void (llvm::Expected<llvm::orc::ExecutorAddrRange>)>)::'lambda'(llvm::Expected<llvm::orc::ExecutorAddrRange>)>(void*, llvm::Expected<llvm::orc::ExecutorAddrRange>&) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:222:12
    #17 0x61eb46e13d5f in operator() /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:387:12
    #18 0x61eb46e13d5f in llvm::orc::InProcessMemoryMapper::reserve(unsigned long, llvm::unique_function<void (llvm::Expected<llvm::orc::ExecutorAddrRange>)>) /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp:57:3

@nico
Copy link
Contributor

nico commented Jan 8, 2025

Looks like this healed our bots too, so I suppose the problem was with android sysroots, not with linux sysroots. Sorry for the noise!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants