[PATCH] D125095: [Clang][AIX] Add .ref in frontend for AIX XCOFF to support `-bcdtors:csect` linker option

Ting Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 5 18:12:43 PDT 2022


tingwang added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:522
   EmitCXXThreadLocalInitFunc();
+  if (getTriple().isOSAIX()) {
+    genAssocMeta();
----------------
shchenz wrote:
> Seems this dos not follow other functions call's style. Can we call a function like `EmitAssociatedMetadata()` here and do the clean up (`cleanupAssoc()` may not be needed) in the `EmitAssociatedMetadata()`? 
Thanks! I will update the code.


================
Comment at: clang/test/CodeGen/PowerPC/aix-init-ref-null.cpp:2
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -emit-llvm -O3 -x c++ \
+// RUN:     -debug-info-kind=limited < %s | \
+// RUN:   FileCheck %s
----------------
shchenz wrote:
> is `-debug-info-kind=limited` or `-O3` necessary in this test? Same as other new added cases.
Oh, "-debug-info-kind=limited" is not required. I will remove those. The "-O3" flag is required to show that associated metadata can be `nullptr`. Without "-O3", normal llvm.global_ctors will be generated.


================
Comment at: clang/test/CodeGen/PowerPC/aix-ref-tls_init.cpp:10
+// CHECK: @r = thread_local global ptr null, align [[ALIGN:[0-9]+]], !dbg ![[DBG0:[0-9]+]], !associated ![[ASSOC0:[0-9]+]]
+// CHECK: ![[ASSOC0]] = !{ptr @__tls_init}
----------------
shchenz wrote:
> Not sure if this is right or not. XLC on AIX seems refer to `__tls_get_addr` instead  of `__tls_init`...
I saw some case that AIX generated tls related association, and I was postulating that the association should be linked to _tls_init. I will revisit my case and update with more info or correct the association later.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125095/new/

https://reviews.llvm.org/D125095



More information about the llvm-commits mailing list