John Paul Adrian Glaubitz via llvm-dev
2020-Oct-21 18:19 UTC
[llvm-dev] compiler-rt linking failure on linux-sparcv9
Hi! The build on linux-sparcv9 has recently started to fail with a linker failure that looks easy to fix but so far I've been unable to find out where to include the necessary -latomic [1]: /usr/bin/ld: warning: -z gnu-version-script-compat ignored /usr/bin/ld: projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.sparc.dir/asan_allocator.cpp.o: in function `__sanitizer::atomic_uint64_t::Type __sanitizer::atomic_load<__sanitizer::atomic_uint64_t>(__sanitizer::atomic_uint64_t const volatile*, __sanitizer::memory_order)': /home/glaubitz/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_atomic_clang_other.h:56: undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: /home/glaubitz/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_atomic_clang_other.h:56: undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: /home/glaubitz/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_atomic_clang_other.h:56: undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: /home/glaubitz/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_atomic_clang_other.h:56: undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: /home/glaubitz/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_atomic_clang_other.h:56: undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.sparc.dir/asan_allocator.cpp.o:/home/glaubitz/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_atomic_clang_other.h:56: more undefined references to `__sync_fetch_and_add_8' follow /usr/bin/ld: projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.sparc.dir/asan_allocator.cpp.o: in function `void __sanitizer::atomic_store<__sanitizer::atomic_uint64_t>(__sanitizer::atomic_uint64_t volatile*, __sanitizer::atomic_uint64_t::Type, __sanitizer::memory_order)': /home/glaubitz/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_atomic_clang_other.h:87: undefined reference to `__sync_val_compare_and_swap_8' /usr/bin/ld: /home/glaubitz/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_atomic_clang_other.h:87: undefined reference to `__sync_val_compare_and_swap_8' /usr/bin/ld: /home/glaubitz/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_atomic_clang_other.h:87: undefined reference to `__sync_val_compare_and_swap_8' /usr/bin/ld: /home/glaubitz/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_atomic_clang_other.h:87: undefined reference to `__sync_val_compare_and_swap_8' collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed. Does anyone have any suggestion where to add the necessary linker flags? Full build log in [1]. Adrian> [1] https://buildd.debian.org/status/fetch.php?pkg=llvm-toolchain-snapshot&arch=sparc64&ver=1%3A12%7E%2B%2B20200929085817%2B962a247aebb-1%7Eexp1&stamp=1603274506&raw=0-- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaubitz at debian.org `. `' Freie Universitaet Berlin - glaubitz at physik.fu-berlin.de `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
John Paul Adrian Glaubitz via llvm-dev
2020-Oct-21 22:28 UTC
[llvm-dev] compiler-rt linking failure on linux-sparcv9
Hello! On 10/21/20 8:19 PM, John Paul Adrian Glaubitz wrote:> The build on linux-sparcv9 has recently started to fail with a linker failure that looks easy to > fix but so far I've been unable to find out where to include the necessary -latomic [1]:This was introduced by: commit 3f7c3e84ad69f1ffa767b1b7ce3aa36de6c30f87 (refs/bisect/bad) Author: Vitaly Buka <vitalybuka at google.com> Date: Thu Sep 10 19:59:31 2020 -0700 [Asan] Fix __asan_update_allocation_context Update both thread and stack. Update thread and stack as atomic operation. Keep all 32bit of TID as now we have enough bits. Depends on D87135. Reviewed By: morehouse Differential Revision: https://reviews.llvm.org/D87217 Any suggestions on how to fix this? Passing -latomic for the offending linker command doesn't help, unfortunately. A Linux SPARC porterbox (which I used for bisecting this) is available in the GCC compile farm [1]. Adrian> [1] https://gcc.gnu.org/wiki/CompileFarm-- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaubitz at debian.org `. `' Freie Universitaet Berlin - glaubitz at physik.fu-berlin.de `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
John Paul Adrian Glaubitz via llvm-dev
2020-Oct-22 00:10 UTC
[llvm-dev] compiler-rt linking failure on linux-sparcv9
Hi! On 10/22/20 12:28 AM, John Paul Adrian Glaubitz via llvm-dev wrote:> On 10/21/20 8:19 PM, John Paul Adrian Glaubitz wrote: >> The build on linux-sparcv9 has recently started to fail with a linker failure that looks easy to >> fix but so far I've been unable to find out where to include the necessary -latomic [1]: > > This was introduced by:So, the build actually fails in the 32-bit libraries and I think the main problem is in [1]: The way atomic_load/store on 32 bits are implemented is just weird. The code could just use __atomic_load() and __atomic_store() [2]. The build doesn't fail on x86 and MIPS because these architectures have custom headers for this code. Not sure about PPC but it looks like the code is disabled on PPC completely? Adrian> [1] https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang.h > [2] https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html-- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaubitz at debian.org `. `' Freie Universitaet Berlin - glaubitz at physik.fu-berlin.de `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913