[clang] [llvm] [PowerPC][AIX] Support #pragma comment copyright for AIX (PR #178184)

Hubert Tong via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 16 16:56:52 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:

> Thanks! Removed the named csect section in this PR.

@tonykuttai, I don't think the conclusion was necessarily to remove the named csect section in this PR. It has a tradeoff between a _potentially_ larger memory footprint under "full" LTO (not known to apply to thinLTO) and a likely better layout where the copyright strings are all grouped "out of the way" from other data.

I am leaning towards keeping the named csect section and updating the code comments to provide the reasoning.

https://github.com/llvm/llvm-project/pull/178184


More information about the llvm-commits mailing list