GCN, nvptx: Allow for "hosted" libstdc++ build
We need '-fno-exceptions', '-fno-rtti', disable generation of PCH files, and for nvptx twiddle some more knobs. PR target/92713 PR target/101544 libstdc++-v3/ * config/cpu/nvptx/cpu_defines.h: New. * config/cpu/nvptx/t-nvptx: Likewise. * configure.host: Handle GCN, nvptx.
This commit is contained in:
parent
62dc2d24f1
commit
1268924a2e
3 changed files with 80 additions and 0 deletions
36
libstdc++-v3/config/cpu/nvptx/cpu_defines.h
Normal file
36
libstdc++-v3/config/cpu/nvptx/cpu_defines.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Specific definitions for nvptx 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
|
||||
|
||||
// No support for referencing weak symbols without a definition.
|
||||
#define _GLIBCXX_USE_WEAK_REF 0
|
||||
|
||||
#endif
|
7
libstdc++-v3/config/cpu/nvptx/t-nvptx
Normal file
7
libstdc++-v3/config/cpu/nvptx/t-nvptx
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Per-file flags, see '../../../configure.host', "inject per-file flags".
|
||||
|
||||
# 'ptxas'/CUDA Driver rejects objects with a lot of global constant data:
|
||||
# ptxas error : File uses too much global constant data ([...])
|
||||
# Cut short the assembly-time check; defer to actual use of the object file.
|
||||
AM_MAKEFLAGS += CXXFLAGS-src/c++17/floating_to_chars.lo=-Wa,--no-verify
|
||||
AM_MAKEFLAGS += CXXFLAGS-src/c++20/tzdb.lo=-Wa,--no-verify
|
|
@ -150,6 +150,9 @@ case "${host_cpu}" in
|
|||
arm*)
|
||||
cpu_defines_dir=cpu/arm
|
||||
;;
|
||||
nvptx)
|
||||
cpu_defines_dir=cpu/nvptx
|
||||
;;
|
||||
powerpc* | rs6000)
|
||||
cpu_defines_dir=cpu/powerpc
|
||||
;;
|
||||
|
@ -367,6 +370,16 @@ case "${host}" in
|
|||
arm*-*-freebsd*)
|
||||
port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
|
||||
;;
|
||||
nvptx-*-none)
|
||||
# For 'make all-target-libstdc++-v3', we need to inject per-file flags:
|
||||
OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} \$(CXXFLAGS-\$(subdir)/\$@)"
|
||||
# ..., see:
|
||||
tmake_file="$tmake_file cpu/nvptx/t-nvptx"
|
||||
|
||||
# For 'make all-target-libstdc++-v3', re 'alloca'/VLA usage:
|
||||
EXTRA_CFLAGS="${EXTRA_CFLAGS} -mfake-ptx-alloca"
|
||||
OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -mfake-ptx-alloca"
|
||||
;;
|
||||
powerpc*-*-darwin*)
|
||||
port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver"
|
||||
;;
|
||||
|
@ -383,3 +396,27 @@ case "${host}" in
|
|||
abi_baseline_subdir_switch=--print-multi-os-directory
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# Dumb down libstdc++ for certain configurations.
|
||||
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
|
||||
case "${host}" in
|
||||
amdgcn-*-amdhsa \
|
||||
| nvptx-*-none )
|
||||
# For 'make all-target-libstdc++-v3' and 'make check-target-libstdc++-v3',
|
||||
# exception handling is not supported: in case that exception handling
|
||||
# constructs survive compiler optimizations, the back ends error out:
|
||||
# sorry, unimplemented: exception handling not supported
|
||||
EXTRA_CXX_FLAGS="${EXTRA_CXX_FLAGS} -fno-exceptions"
|
||||
|
||||
# For 'make all-target-libstdc++-v3' and 'make check-target-libstdc++-v3',
|
||||
# RTTI is not supported.
|
||||
EXTRA_CXX_FLAGS="${EXTRA_CXX_FLAGS} -fno-rtti"
|
||||
|
||||
# Cannot '#include' all newlib header files without explosion, for example:
|
||||
# error: 'jmp_buf' was not declared in this scope
|
||||
# Just disable generation of PCH files here, instead of attempting to care
|
||||
# for such special cases in some more complex way.
|
||||
enable_libstdcxx_pch=no
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Add table
Reference in a new issue