CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
71 lines
3.1 KiB
C++
71 lines
3.1 KiB
C++
// RUN: %clang_cc1 %s -triple=i686-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s
|
|
|
|
int f();
|
|
|
|
// CHECK: $"?x@selectany_init@@3HA" = comdat any
|
|
// CHECK: $"?x@?$A@H@explicit_template_instantiation@@2HB" = comdat any
|
|
// CHECK: $"?x@?$A@H@implicit_template_instantiation@@2HB" = comdat any
|
|
|
|
namespace simple_init {
|
|
#pragma init_seg(compiler)
|
|
int x = f();
|
|
// CHECK: @"?x@simple_init@@3HA" = dso_local global i32 0, align 4
|
|
// No function pointer! This one goes on @llvm.global_ctors.
|
|
|
|
#pragma init_seg(lib)
|
|
int y = f();
|
|
// CHECK: @"?y@simple_init@@3HA" = dso_local global i32 0, align 4
|
|
// No function pointer! This one goes on @llvm.global_ctors.
|
|
|
|
#pragma init_seg(user)
|
|
int z = f();
|
|
// CHECK: @"?z@simple_init@@3HA" = dso_local global i32 0, align 4
|
|
// No function pointer! This one goes on @llvm.global_ctors.
|
|
}
|
|
|
|
#pragma init_seg(".asdf")
|
|
|
|
namespace internal_init {
|
|
namespace {
|
|
int x = f();
|
|
// CHECK: @"?x@?A0x{{[^@]*}}@internal_init@@3HA" = internal global i32 0, align 4
|
|
// CHECK: @__cxx_init_fn_ptr = private constant ptr @"??__Ex@?A0x{{[^@]*}}@internal_init@@YAXXZ", section ".asdf"
|
|
}
|
|
}
|
|
|
|
namespace selectany_init {
|
|
int __declspec(selectany) x = f();
|
|
// CHECK: @"?x@selectany_init@@3HA" = weak_odr dso_local global i32 0, comdat, align 4
|
|
// CHECK: @__cxx_init_fn_ptr.1 = private constant ptr @"??__Ex@selectany_init@@YAXXZ", section ".asdf", comdat($"?x@selectany_init@@3HA")
|
|
}
|
|
|
|
namespace explicit_template_instantiation {
|
|
template <typename T> struct A { static const int x; };
|
|
template <typename T> const int A<T>::x = f();
|
|
template struct A<int>;
|
|
// CHECK: @"?x@?$A@H@explicit_template_instantiation@@2HB" = weak_odr dso_local global i32 0, comdat, align 4
|
|
// CHECK: @__cxx_init_fn_ptr.2 = private constant ptr @"??__E?x@?$A@H@explicit_template_instantiation@@2HB@@YAXXZ", section ".asdf", comdat($"?x@?$A@H@explicit_template_instantiation@@2HB")
|
|
}
|
|
|
|
namespace implicit_template_instantiation {
|
|
template <typename T> struct A { static const int x; };
|
|
template <typename T> const int A<T>::x = f();
|
|
int g() { return A<int>::x; }
|
|
// CHECK: @"?x@?$A@H@implicit_template_instantiation@@2HB" = linkonce_odr dso_local global i32 0, comdat, align 4
|
|
// CHECK: @__cxx_init_fn_ptr.3 = private constant ptr @"??__E?x@?$A@H@implicit_template_instantiation@@2HB@@YAXXZ", section ".asdf", comdat($"?x@?$A@H@implicit_template_instantiation@@2HB")
|
|
}
|
|
|
|
// ... and here's where we emitted user level ctors.
|
|
// CHECK: @llvm.global_ctors = appending global [3 x { i32, ptr, ptr }]
|
|
// CHECK: [{ i32, ptr, ptr } { i32 200, ptr @"??__Ex@simple_init@@YAXXZ", ptr @"?x@simple_init@@3HA" }, { i32, ptr, ptr } { i32 400, ptr @"??__Ey@simple_init@@YAXXZ", ptr @"?y@simple_init@@3HA" }, { i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I_pragma_init_seg.cpp, ptr null }]
|
|
|
|
// We have to mark everything used so we can survive globalopt, even through
|
|
// LTO. There's no way LLVM could really understand if data in the .asdf
|
|
// section is really used or dead.
|
|
//
|
|
// CHECK: @llvm.used = appending global [4 x ptr]
|
|
// CHECK: [ptr @__cxx_init_fn_ptr,
|
|
// CHECK: ptr @__cxx_init_fn_ptr.1,
|
|
// CHECK: ptr @__cxx_init_fn_ptr.2,
|
|
// CHECK: ptr @__cxx_init_fn_ptr.3], section "llvm.metadata"
|