1# REQUIRES: x86
2# RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t.obj %s
3# RUN: lld-link %t.obj /out:%t.exe /entry:main /subsystem:console
4# RUN: llvm-objdump -s %t.exe | FileCheck %s
5# RUN: lld-link %t.obj /out:%t.exe /entry:main /subsystem:console /opt:noicf /opt:lldtailmerge
6# RUN: llvm-objdump -s %t.exe | FileCheck %s
7# RUN: lld-link %t.obj /out:%t.exe /entry:main /subsystem:console /opt:noicf
8# RUN: llvm-objdump -s %t.exe | FileCheck --check-prefix=NOSTM %s
9# RUN: lld-link %t.obj /out:%t.exe /entry:main /subsystem:console /opt:nolldtailmerge
10# RUN: llvm-objdump -s %t.exe | FileCheck --check-prefix=NOSTM %s
11
12# CHECK: Contents of section .text:
13# NOSTM: Contents of section .text:
14.globl main
15main:
16# CHECK-NEXT: 140001000 11200040 01000000 17200040 01000000
17# NOSTM-NEXT: 140001000 00200040 01000000 0c200040 01000000
18.8byte "??_C@_0M@LACCCNMM@hello?5world?$AA@"
19.8byte "??_C@_05MCBCHHEJ@world?$AA@"
20# CHECK-NEXT: 140001010 2a200040 01000000 36200040 01000000
21# NOSTM-NEXT: 140001010 12200040 01000000 2a200040 01000000
22.8byte "??_C@_1BI@HHJHKLLN@?$AAh?$AAe?$AAl?$AAl?$AAo?$AA?5?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$AA@"
23.8byte "??_C@_1M@NBBDDHIO@?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$AA@"
24# CHECK-NEXT: 140001020 00200040 01000000 0c200040 01000000
25# NOSTM-NEXT: 140001020 36200040 01000000 42200040 01000000
26.8byte "??_D@not_a_string_literal"
27.8byte "??_C@string_literal_with_relocs"
28# CHECK-NEXT: 140001030 00300040 01000000 1e200040 01000000
29# NOSTM-NEXT: 140001030 00300040 01000000 48200040 01000000
30.8byte "??_C@string_literal_in_wrong_section"
31.8byte "??_C@overaligned_string_literal"
32
33# CHECK: Contents of section .rdata:
34# CHECK-NEXT:  140002000 68656c6c 6f20776f 726c6400 6f826ca4  hello world.o.l.
35# CHECK-NEXT:  140002010 0068656c 6c6f2077 6f726c64 00006865  .hello world..he
36# CHECK-NEXT:  140002020 6c6c6f20 776f726c 64006800 65006c00  llo world.h.e.l.
37# CHECK-NEXT:  140002030 6c006f00 20007700 6f007200 6c006400  l.o. .w.o.r.l.d.
38# CHECK-NEXT:  140002040 0000                                 ..
39
40# NOSTM: Contents of section .rdata:
41# NOSTM-NEXT:  140002000 68656c6c 6f20776f 726c6400 776f726c  hello world.worl
42# NOSTM-NEXT:  140002010 64006800 65006c00 6c006f00 20007700  d.h.e.l.l.o. .w.
43# NOSTM-NEXT:  140002020 6f007200 6c006400 00007700 6f007200  o.r.l.d...w.o.r.
44# NOSTM-NEXT:  140002030 6c006400 00006865 6c6c6f20 776f726c  l.d...hello worl
45# NOSTM-NEXT:  140002040 64006f82 6ca40000 68656c6c 6f20776f  d.o.l...hello wo
46# NOSTM-NEXT:  140002050 726c6400                             rld.
47
48.section .rdata,"dr",discard,"??_C@_0M@LACCCNMM@hello?5world?$AA@"
49.globl "??_C@_0M@LACCCNMM@hello?5world?$AA@"
50"??_C@_0M@LACCCNMM@hello?5world?$AA@":
51.asciz "hello world"
52
53.section .rdata,"dr",discard,"??_C@_05MCBCHHEJ@world?$AA@"
54.globl "??_C@_05MCBCHHEJ@world?$AA@"
55"??_C@_05MCBCHHEJ@world?$AA@":
56.asciz "world"
57
58.section .rdata,"dr",discard,"??_C@_1BI@HHJHKLLN@?$AAh?$AAe?$AAl?$AAl?$AAo?$AA?5?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$AA@"
59.globl "??_C@_1BI@HHJHKLLN@?$AAh?$AAe?$AAl?$AAl?$AAo?$AA?5?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$AA@"
60.p2align 1
61"??_C@_1BI@HHJHKLLN@?$AAh?$AAe?$AAl?$AAl?$AAo?$AA?5?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$AA@":
62.short 104
63.short 101
64.short 108
65.short 108
66.short 111
67.short 32
68.short 119
69.short 111
70.short 114
71.short 108
72.short 100
73.short 0
74
75.section .rdata,"dr",discard,"??_C@_1M@NBBDDHIO@?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$AA@"
76.globl "??_C@_1M@NBBDDHIO@?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$AA@"
77.p2align 1
78"??_C@_1M@NBBDDHIO@?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$AA@":
79.short 119
80.short 111
81.short 114
82.short 108
83.short 100
84.short 0
85
86.section .data,"drw",discard,"??_C@string_literal_in_wrong_section"
87.globl "??_C@string_literal_in_wrong_section"
88"??_C@string_literal_in_wrong_section":
89.asciz "hello world"
90
91.section .rdata,"dr",discard,"??_D@not_a_string_literal"
92.globl "??_D@not_a_string_literal"
93"??_D@not_a_string_literal":
94.asciz "hello world"
95
96.section .rdata,"dr",discard,"??_C@string_literal_with_relocs"
97.globl "??_C@string_literal_with_relocs"
98"??_C@string_literal_with_relocs":
99.4byte main + 111 + (114 << 8) + (108 << 16) + (100 << 24) # main + "orld"
100.byte 0
101
102.section .rdata,"dr",discard,"??_C@overaligned_string_literal"
103.globl "??_C@overaligned_string_literal"
104.p2align 1
105"??_C@overaligned_string_literal":
106.asciz "hello world"
107