diff options
author | Thomas Schwinge <tschwinge@baylibre.com> | 2025-03-30 14:54:01 +0200 |
---|---|---|
committer | Thomas Schwinge <tschwinge@baylibre.com> | 2025-04-01 11:12:46 +0200 |
commit | 816335960d020eac92d49bc9cd13729afd313da7 (patch) | |
tree | b8a0a2ee30ddedda2bd1e01d1a0eed05593beb04 | |
parent | ae2912748b9913fe9cd198db1b3fa704d0cbc728 (diff) | |
download | gcc-816335960d020eac92d49bc9cd13729afd313da7.zip gcc-816335960d020eac92d49bc9cd13729afd313da7.tar.gz gcc-816335960d020eac92d49bc9cd13729afd313da7.tar.bz2 |
GCN, libstdc++: '#define _GLIBCXX_USE_WEAK_REF 0' [PR119369]
This fixes a few hundreds of compilation/linking FAILs (similar to PR69506),
where the GCN/LLVM 'ld' reported:
ld: error: relocation R_AMDGPU_REL32_LO cannot be used against symbol '_ZGTtnam'; recompile with -fPIC
>>> defined in [...]/amdgcn-amdhsa/./libstdc++-v3/src/.libs/libstdc++.a(cow-stdexcept.o)
>>> referenced by cow-stdexcept.cc:259 ([...]/libstdc++-v3/src/c++11/cow-stdexcept.cc:259)
>>> cow-stdexcept.o:(_txnal_cow_string_C1_for_exceptions(void*, char const*, void*)) in archive [...]/amdgcn-amdhsa/./libstdc++-v3/src/.libs/libstdc++.a
ld: error: relocation R_AMDGPU_REL32_HI cannot be used against symbol '_ZGTtnam'; recompile with -fPIC
>>> defined in [...]/amdgcn-amdhsa/./libstdc++-v3/src/.libs/libstdc++.a(cow-stdexcept.o)
>>> referenced by cow-stdexcept.cc:259 ([...]/source-gcc/libstdc++-v3/src/c++11/cow-stdexcept.cc:259)
>>> cow-stdexcept.o:(_txnal_cow_string_C1_for_exceptions(void*, char const*, void*)) in archive [...]/amdgcn-amdhsa/./libstdc++-v3/src/.libs/libstdc++.a
[...]
..., which is:
$ c++filt _ZGTtnam
transaction clone for operator new[](unsigned long)
..., and similarly for other libitm symbols.
However, the affected test cases, if applicable, then run into execution test
FAILs, due to PR119369
"GCN: weak undefined symbols -> execution test FAIL, 'HSA_STATUS_ERROR_VARIABLE_UNDEFINED'".
PR target/119369
libstdc++-v3/
* config/cpu/gcn/cpu_defines.h: New.
* configure.host [GCN] (cpu_defines_dir): Point to it.
-rw-r--r-- | libstdc++-v3/config/cpu/gcn/cpu_defines.h | 55 | ||||
-rw-r--r-- | libstdc++-v3/configure.host | 3 |
2 files changed, 58 insertions, 0 deletions
diff --git a/libstdc++-v3/config/cpu/gcn/cpu_defines.h b/libstdc++-v3/config/cpu/gcn/cpu_defines.h new file mode 100644 index 0000000..028bfb0 --- /dev/null +++ b/libstdc++-v3/config/cpu/gcn/cpu_defines.h @@ -0,0 +1,55 @@ +// Specific definitions for GCN platforms -*- C++ -*- + +// Copyright (C) 2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +/** @file bits/cpu_defines.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iosfwd} + */ + +#ifndef _GLIBCXX_CPU_DEFINES +#define _GLIBCXX_CPU_DEFINES 1 + +/* GCN appears to run into issues similar to PR69506: + + ld: error: relocation R_AMDGPU_REL32_LO cannot be used against symbol '_ZGTtnam'; recompile with -fPIC + >>> defined in [...]/amdgcn-amdhsa/./libstdc++-v3/src/.libs/libstdc++.a(cow-stdexcept.o) + >>> referenced by cow-stdexcept.cc:259 ([...]/libstdc++-v3/src/c++11/cow-stdexcept.cc:259) + >>> cow-stdexcept.o:(_txnal_cow_string_C1_for_exceptions(void*, char const*, void*)) in archive [...]/amdgcn-amdhsa/./libstdc++-v3/src/.libs/libstdc++.a + + ld: error: relocation R_AMDGPU_REL32_HI cannot be used against symbol '_ZGTtnam'; recompile with -fPIC + >>> defined in [...]/amdgcn-amdhsa/./libstdc++-v3/src/.libs/libstdc++.a(cow-stdexcept.o) + >>> referenced by cow-stdexcept.cc:259 ([...]/source-gcc/libstdc++-v3/src/c++11/cow-stdexcept.cc:259) + >>> cow-stdexcept.o:(_txnal_cow_string_C1_for_exceptions(void*, char const*, void*)) in archive [...]/amdgcn-amdhsa/./libstdc++-v3/src/.libs/libstdc++.a + + [...] + + ..., which is: + + $ c++filt _ZGTtnam + transaction clone for operator new[](unsigned long) + + ..., and similarly for other libitm symbols. See PR119369. */ +#define _GLIBCXX_USE_WEAK_REF 0 + +#endif diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host index cb4c28a..0bed9df 100644 --- a/libstdc++-v3/configure.host +++ b/libstdc++-v3/configure.host @@ -147,6 +147,9 @@ cpu_include_dir=cpu/${try_cpu} # Set specific CPU overrides for cpu_defines_dir. Most can just use generic. # THIS TABLE IS SORTED. KEEP IT THAT WAY. case "${host_cpu}" in + amdgcn) + cpu_defines_dir=cpu/gcn + ;; arm*) cpu_defines_dir=cpu/arm ;; |