[clang] [llvm] [PowerPC][AIX] Support #pragma comment copyright for AIX (PR #178184)
Hubert Tong via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 8 12:56:57 PDT 2026
================
@@ -0,0 +1,150 @@
+//===-- LowerCommentStringPass.cpp - Lower Comment string metadata -------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===---------------------------------------------------------------------===//
+//
+// This pass lowers the module-level comment string metadata emitted by Clang:
+//
+// !comment_string.loadtime = !{!"Copyright ..."}
+//
+// into concrete, translation-unit-local globals.
+// This Pass is enabled only for AIX.
+// For each module (translation unit), the pass performs the following:
+//
+// 1. Creates a null-terminated, internal constant string global
+// (`__loadtime_comment_str`) containing the copyright text with
+// section attribute "__loadtime_comment". The backend places this
----------------
hubert-reinterpretcast wrote:
There needs to be more rationale here for using a named section. What is the benefit of having it?
My understanding is that it interacts with (full) LTO such that the linker is less able to garbage-collect individual strings. Perhaps that is fine as the general intent seems to be for the strings to be kept.
A possible benefit of the named section is that the strings are more likely to be grouped in a block that does not interfere with the rest of the program.
https://github.com/llvm/llvm-project/pull/178184
More information about the cfe-commits
mailing list