[clang] [clang] Do not emit template parameter objects as COMDATs when they have internal linkage. (PR #125448)
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 2 19:04:50 PST 2025
================
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -emit-llvm -std=c++20 -triple x86_64-unknown-linux-gnu %s -o - | FileCheck %s
+
+// COMDAT groups in ELF objects are not permitted to contain local symbols. While template parameter
+// objects are normally emitted in COMDATs, we shouldn't do so if they would have internal linkage.
+
+extern "C" int printf(...);
+typedef __typeof__(sizeof(0)) size_t;
+
+namespace {
+template<size_t N>
+struct DebugContext
+{
+ char value[N];
+ constexpr DebugContext(const char (&str)[N]) {
----------------
MaskRay wrote:
The test can be reduced.
https://github.com/llvm/llvm-project/pull/125448
More information about the cfe-commits
mailing list