hubert.reinterpretcast added inline comments.
================
Comment at: clang/test/CodeGen/static-init.cpp:31
+// CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }]
[{ i32, void ()*, i8* } { i32 65535, void ()*
@__sinit80000000_clang_510e898aa8d263cac999dd03eeed5b51, i8* null }]
+// CHECK: @llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }]
[{ i32, void ()*, i8* } { i32 65535, void ()*
@__sterm80000000_clang_510e898aa8d263cac999dd03eeed5b51, i8* null }]
+
----------------
hubert.reinterpretcast wrote:
> Okay, the restricted scope of this patch seems to landed in a place where how
> the `llvm.global_dtors` array will be handled is not indicated...
>
> The backend should implement the semantics of the IR construct. When handling
> said array in the IR, it seems the method to handle the requisite semantics
> would be to generate an alias (with the appropriate linkage for the linker to
> pick it up) that is named using the `__sinit`/`__sterm` convention. Which is
> to say that at least some part of the naming should eventually move into the
> LLVM side and out of Clang.
>
> Please update the description of this patch to indicate that:
>
> - The `llvm.global_ctors` and `llvm.global_dtors` functionality has not yet
> been implemented on AIX.
> - This patch temporarily side-steps the need to implement that
> functionality.
> - The apparent uses of that functionality in this patch (with respect to
> the name of the functions involved) are not representative of how the
> functionality will be used once implemented.
>
I think the `llvm.global_ctors` usage is also more extensive here (and not
symmetric on the finalization side):
```
struct C {
C(int) {}
~C() {}
};
C c0 = 42;
template <typename T> C c = 42;
inline C c1 = 42;
int main(void) {
(void) &c<int>;
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74166/new/
https://reviews.llvm.org/D74166
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits