From 9837f62f066db532c9db6df38ccf2653d0c3a960 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 14 Jul 2022 23:22:35 +0200 Subject: [PATCH] nvptx: Use the usual '#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)' With this 'MAKE_DECL_ONE_ONLY' definition, we get 'SUPPORTS_ONE_ONLY', and thus '__GXX_WEAK__', and thus '__GXX_TYPEINFO_EQUALITY_INLINE'. This unblocks build of 'libstdc++-v3/libsupc++/tinfo.cc', which otherwise depends on symbol alias support, which GCC/nvptx doesn't generally provide. Also, this gets us a number of FAIL -> PASS progressions in the test suite. Given that GCC/nvptx support for weak symbols isn't complete, we also get a few more of the already-known 'error: PTX does not support weak declarations (only weak definitions)': [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C -std=c++14 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C -std=c++17 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C -std=c++20 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C -std=c++98 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C -std=c++14 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C -std=c++17 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C -std=c++20 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C -std=c++98 (test for excess errors) [-PASS:-]{+FAIL:+} 23_containers/map/56613.cc -std=gnu++17 (test for excess errors) ... as well as one more of the already-known 'sorry, unimplemented: target cannot support nonlocal goto': PASS: g++.dg/tree-ssa/pr22488.C -std=gnu++14 (test for excess errors) PASS: g++.dg/tree-ssa/pr22488.C -std=gnu++17 (test for excess errors) PASS: g++.dg/tree-ssa/pr22488.C -std=gnu++20 (test for excess errors) [-PASS:-]{+FAIL:+} g++.dg/tree-ssa/pr22488.C -std=gnu++98 (test for excess errors) We shall look into these, later. gcc/ * config/nvptx/nvptx.h (MAKE_DECL_ONE_ONLY): Define. --- gcc/config/nvptx/nvptx.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h index 129427e5654..407fd70f06a 100644 --- a/gcc/config/nvptx/nvptx.h +++ b/gcc/config/nvptx/nvptx.h @@ -319,6 +319,9 @@ struct GTY(()) machine_function #define SUPPORTS_WEAK 1 +#define MAKE_DECL_ONE_ONLY(DECL) \ + (DECL_WEAK (DECL) = 1) + /* The documentation states that ASM_OUTPUT_DEF_FROM_DECLS is used in preference to ASM_OUTPUT_DEF if the tree nodes are available. However, we need the tree nodes to emit the prototype, so at this point it's not clear -- 2.34.1