[PATCH] D104420: thread_local support for AIX
Hubert Tong via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 12 12:31:19 PDT 2021
hubert.reinterpretcast added inline comments.
================
Comment at: clang/lib/CodeGen/ItaniumCXXABI.cpp:4790
+ llvm::Value *Arg2 = llvm::ConstantExpr::getBitCast(
+ cast<llvm::Constant>(dtor.getCallee()), FpTy);
+ CGF.EmitNounwindRuntimeCall(AtExit, {Arg1, Arg2});
----------------
The function registered needs to be something more like what `createAtExitStub` stub creates. Otherwise, the destructor will not be able to reference `*this` correctly.
As it is, the registered function is currently just the destructor itself:
```
$ clang++ -target powerpc64-ibm-aix -emit-llvm -S -o - -xc++ -<<<$'struct A { ~A(); }; thread_local A a;' | grep -C2 __pt_atexit_np
define internal void @__cxx_global_var_init() #0 {
entry:
%0 = call i32 (i32, i32 (i32, ...)*, ...) @__pt_atexit_np(i32 0, i32 (i32, ...)* bitcast (void (%struct.A*)* @_ZN1AD1Ev to i32 (i32, ...)*)) #3
ret void
}
--
declare void @_ZN1AD1Ev(%struct.A* nonnull align 1 dereferenceable(1)) unnamed_addr #1
declare i32 @__pt_atexit_np(i32, i32 (i32, ...)*, ...)
; Function Attrs: noinline
Return: 0x00:0 Mon Jul 12 15:24:15 2021 EDT
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104420/new/
https://reviews.llvm.org/D104420
More information about the cfe-commits
mailing list