1; RUN: llc < %s | FileCheck %s
2
3; Check that we come up with appropriate section names that link.exe sorts
4; well.
5
6; CHECK: .section        .CRT$XCA00042,"dr"
7; CHECK: .p2align        3
8; CHECK: .quad   f
9; CHECK: .section        .CRT$XCT12345,"dr"
10; CHECK: .p2align        3
11; CHECK: .quad   g
12; CHECK: .section        .CRT$XCT23456,"dr",associative,h
13; CHECK: .p2align        3
14; CHECK: .quad   init_h
15
16target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
17target triple = "x86_64-pc-windows-msvc19.14.26433"
18
19$h = comdat any
20
21@h = linkonce_odr global i8 55, comdat, align 1
22
23@str0 = private dso_local unnamed_addr constant [6 x i8] c"later\00", align 1
24@str1 = private dso_local unnamed_addr constant [6 x i8] c"first\00", align 1
25@str2 = private dso_local unnamed_addr constant [5 x i8] c"main\00", align 1
26
27@llvm.global_ctors = appending global [3 x { i32, void ()*, i8* }] [
28  { i32, void ()*, i8* } { i32 12345, void ()* @g, i8* null },
29  { i32, void ()*, i8* } { i32 42, void ()* @f, i8* null },
30  { i32, void ()*, i8* } { i32 23456, void ()* @init_h, i8* @h }
31]
32
33declare dso_local i32 @puts(i8* nocapture readonly) local_unnamed_addr
34
35define dso_local void @g() {
36entry:
37  %call = tail call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str0, i64 0, i64 0))
38  ret void
39}
40
41define dso_local void @f() {
42entry:
43  %call = tail call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str1, i64 0, i64 0))
44  ret void
45}
46
47define dso_local void @init_h() {
48entry:
49  store i8 42, i8* @h
50  ret void
51}
52
53
54; Function Attrs: nounwind uwtable
55define dso_local i32 @main() local_unnamed_addr {
56entry:
57  %call = tail call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str2, i64 0, i64 0))
58  ret i32 0
59}
60