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$XTA00042,"dr"
7; CHECK: .p2align        3
8; CHECK: .quad   f
9; CHECK: .section        .CRT$XTT12345,"dr"
10; CHECK: .p2align        3
11; CHECK: .quad   g
12; CHECK: .section        .CRT$XTT23456,"dr",associative,h
13; CHECK: .p2align        3
14; CHECK: .quad   init_h
15; CHECK: .section        .CRT$XTX,"dr"
16; CHECK: .p2align        3
17; CHECK: .quad   str3_dtor
18
19target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
20target triple = "x86_64-pc-windows-msvc19.14.26433"
21
22$h = comdat any
23
24@h = linkonce_odr global i8 55, comdat, align 1
25
26@str0 = private dso_local unnamed_addr constant [6 x i8] c"later\00", align 1
27@str1 = private dso_local unnamed_addr constant [6 x i8] c"first\00", align 1
28@str2 = private dso_local unnamed_addr constant [5 x i8] c"main\00", align 1
29@str3 = private dso_local unnamed_addr constant [8 x i8] c"default\00", align 1
30
31@llvm.global_dtors = appending global [4 x { i32, void ()*, i8* }] [
32  { i32, void ()*, i8* } { i32 12345, void ()* @g, i8* null },
33  { i32, void ()*, i8* } { i32 42, void ()* @f, i8* null },
34  { i32, void ()*, i8* } { i32 23456, void ()* @init_h, i8* @h },
35  { i32, void ()*, i8* } { i32 65535, void ()* @str3_dtor, i8* null }
36]
37
38declare dso_local i32 @puts(i8* nocapture readonly) local_unnamed_addr
39
40define dso_local void @g() {
41entry:
42  %call = tail call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str0, i64 0, i64 0))
43  ret void
44}
45
46define dso_local void @f() {
47entry:
48  %call = tail call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str1, i64 0, i64 0))
49  ret void
50}
51
52define dso_local void @str3_dtor() {
53entry:
54  %call = tail call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str3, i64 0, i64 0))
55  ret void
56}
57
58define dso_local void @init_h() {
59entry:
60  store i8 42, i8* @h
61  ret void
62}
63
64
65; Function Attrs: nounwind uwtable
66define dso_local i32 @main() local_unnamed_addr {
67entry:
68  %call = tail call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str2, i64 0, i64 0))
69  ret i32 0
70}
71