[llvm-dev] Raising the default baseline for a target

14 views
Skip to first unread message

John Paul Adrian Glaubitz via llvm-dev

unread,
Jan 18, 2022, 6:16:54 PM1/18/22
to llvm-dev
Hello!

I'm trying to figure out how to raise the default baseline for the 32-bit SPARC
target on Linux. Currently, this target defaults to the SPARCv7 architecture which
lacks support for atomic instructions which is why the build of compiler-rt fails
with, see [1]:

/usr/bin/ld: warning: -z gnu-version-script-compat ignored
/usr/bin/ld: projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.sparc.dir/sanitizer_libignore.cpp.o: in function `bool __sanitizer::atomic_compare_exchange_strong<__sanitizer::atomic_uint64_t>(__sanitizer::atomic_uint64_t volatile*, __sanitizer::atomic_uint64_t::Type*, __sanitizer::atomic_uint64_t::Type, __sanitizer::memory_order)':
/var/lib/buildbot/workers/debian-stadler-sparc64/clang-sparc64-linux-multistage/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang.h:80: undefined reference to `__sync_val_compare_and_swap_8'

Since Linux distributions have been defaulting to the v9 instruction set with 32-bit
pointers for the 32-bit SPARC for quite a while, I would like to set this baseline as
default when targeting SPARC on 32-bit Linux. If anyone wanted to build for v7, they
could still set the target with "-mcpu=v7".

Does anyone know how to set the default baseline for a given target? Raising the
baseline would finally fix the LLVM build on the Linux sparc64 buildbot which has
been failing for quite a long time.

Discussion for this change happens in [2].

Thanks,
Adrian

> [1] https://lab.llvm.org/staging/#/builders/113/builds/5719
> [2] https://reviews.llvm.org/D98575

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - glau...@debian.org
`. `' Freie Universitaet Berlin - glau...@physik.fu-berlin.de
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

John Paul Adrian Glaubitz via llvm-dev

unread,
Jan 21, 2022, 3:33:22 AM1/21/22
to llvm-dev
Hello!

On 1/19/22 00:16, John Paul Adrian Glaubitz wrote:
> I'm trying to figure out how to raise the default baseline for the 32-bit SPARC
> target on Linux. Currently, this target defaults to the SPARCv7 architecture which
> lacks support for atomic instructions which is why the build of compiler-rt fails
> with, see [1]:

Can anyone recommend a place where I might find an answer?

The discourse channel for the related topics code generation [1] and sanitizers [2]
don't seem to get much attention either.

Thanks,
Adrian

> [1] https://llvm.discourse.group/c/code-generation/51
> [2] https://llvm.discourse.group/c/runtimes/sanitizers/12

Nemanja Ivanovic via llvm-dev

unread,
Jan 21, 2022, 8:01:24 AM1/21/22
to John Paul Adrian Glaubitz, llvm-dev
It would seem that the default in the back end is "v9" for 64-bit and "v8" otherwise as per: https://llvm.org/doxygen/SparcSubtarget_8cpp_source.html#l00028

In clang, it looks like tools::getCPUName() (https://clang.llvm.org/doxygen/namespaceclang_1_1driver_1_1tools.html#a4aa5f09d301ea25099c8badc35a4e09d) returns "v9" for Solaris and an empty string otherwise. Presumably if you set it to what it should be set for, you will get what you want.

John Paul Adrian Glaubitz via llvm-dev

unread,
Jan 21, 2022, 8:30:38 AM1/21/22
to Nemanja Ivanovic, llvm-dev
Hello!

Thanks for the answer!

On 1/21/22 14:01, Nemanja Ivanovic wrote:
> It would seem that the default in the back end is "v9" for 64-bit and "v8" otherwise

> as per: https://llvm.org/doxygen/SparcSubtarget_8cpp_source.html#l00028 <https://llvm.org/doxygen/SparcSubtarget_8cpp_source.html#l00028>
>
> In clang, it looks like tools::getCPUName() (https://clang.llvm.org/doxygen/namespaceclang_1_1driver_1_1tools.html#a4aa5f09d301ea25099c8badc35a4e09d <https://clang.llvm.org/doxygen/namespaceclang_1_1driver_1_1tools.html#a4aa5f09d301ea25099c8badc35a4e09d>) returns "v9" for Solaris and an empty string otherwise. Presumably if you set it to what it should be set for, you will get what you want.

Yes, that is what I am planning to do now, although I still need to make changes
to compiler-rt since even with V9, __sync_val_compare_and_swap_8 are not available
with GCC.

I opened a bug report for that matter [1]. I will also check whether I can fix something
on the GCC side.

Adrian

> [1] https://github.com/llvm/llvm-project/issues/53337

Reply all
Reply to author
Forward
0 new messages