1 // Check that lld properly handles merging multiple .res files.
2 // The inputs were generated with the following commands, using the original
4 // > rc /fo combined-resources.res /nologo combined-resources.rc
5 // > rc /fo combined-resources-2.res /nologo combined-resources-2.rc
7 // The object files were generated with GNU windres and MS cvtres.exe,
8 // > x86_64-w64-mingw32-windres combined-resources.res combined-resources.o
9 // > cvtres -machine:x64 -out:combined-resources-2.o combined-resources.res
11 # RUN: yaml2obj %p/Inputs/ret42.yaml -o %t.obj
12 # RUN: lld-link /out:%t.exe /entry:main %t.obj %p/Inputs/resource.res \
13 # RUN: %p/Inputs/combined-resources.res %p/Inputs/combined-resources-2.res
15 # RUN: llvm-readobj --coff-resources --file-headers --section-data %t.exe | \
18 # RUN: yaml2obj %p/Inputs/combined-resources.yaml -o %t-combined-resources.o
19 # RUN: yaml2obj %p/Inputs/combined-resources-2.yaml -o %t-combined-resources-2.o
21 # RUN: lld-link /lldmingw /out:%t-resobj.exe /entry:main %t.obj %p/Inputs/resource.res \
22 # RUN: %t-combined-resources.o %t-combined-resources-2.o
24 // As input resources are traversed in a slightly different order, the
25 // RVAs of data blobs will end up slightly different, even if they are
26 // equivalent. Filter out such addresses from llvm-readobj's output,
27 // and compare the rest to make sure it is equivalent.
29 # RUN: llvm-readobj --coff-resources %t.exe | sed -E 's/(RVA|Address|File): .*//' > %t-orig.txt
30 # RUN: llvm-readobj --coff-resources %t-resobj.exe | sed -E 's/(RVA|Address|File): .*//' > %t-resobj.txt
31 # RUN: cmp %t-orig.txt %t-resobj.txt
33 CHECK: ResourceTableRVA: 0x2000
34 CHECK-NEXT: ResourceTableSize: 0xC20
35 CHECK-DAG: Resources [
36 CHECK-NEXT: Total Number of Resources: 13
37 CHECK-DAG: .rsrc Data (
38 CHECK-NEXT: 0000: 00000000 00000000 00000000 01000600 |................|
39 CHECK-NEXT: 0010: 38030080 48000080 02000000 60000080 |8...H.......`...|
40 CHECK-NEXT: 0020: 04000000 80000080 05000000 A0000080 |................|
41 CHECK-NEXT: 0030: 06000000 B8000080 09000000 D0000080 |................|
42 CHECK-NEXT: 0040: 0A000000 F0000080 00000000 00000000 |................|
43 CHECK-NEXT: 0050: 00000000 01000000 50030080 08010080 |........P.......|
44 CHECK-NEXT: 0060: 00000000 00000000 00000000 02000000 |................|
45 CHECK-NEXT: 0070: FE020080 20010080 0C030080 38010080 |.... .......8...|
46 CHECK-NEXT: 0080: 00000000 00000000 00000000 01000100 |................|
47 CHECK-NEXT: 0090: 2C030080 50010080 60380000 68010080 |,...P...`8..h...|
48 CHECK-NEXT: 00A0: 00000000 00000000 00000000 01000000 |................|
49 CHECK-NEXT: 00B0: 16030080 80010080 00000000 00000000 |................|
50 CHECK-NEXT: 00C0: 00000000 00000100 01000000 98010080 |................|
51 CHECK-NEXT: 00D0: 00000000 00000000 00000000 01000100 |................|
52 CHECK-NEXT: 00E0: E0020080 B0010080 0C000000 D0010080 |................|
53 CHECK-NEXT: 00F0: 00000000 00000000 00000000 01000000 |................|
54 CHECK-NEXT: 0100: 66030080 E8010080 00000000 00000000 |f...............|
55 CHECK-NEXT: 0110: 00000000 00000100 09040000 10020000 |................|
56 CHECK-NEXT: 0120: 00000000 00000000 00000000 00000100 |................|
57 CHECK-NEXT: 0130: 09040000 20020000 00000000 00000000 |.... ...........|
58 CHECK-NEXT: 0140: 00000000 00000100 09040000 30020000 |............0...|
59 CHECK-NEXT: 0150: 00000000 00000000 00000000 00000100 |................|
60 CHECK-NEXT: 0160: 090C0000 40020000 00000000 00000000 |....@...........|
61 CHECK-NEXT: 0170: 00000000 00000100 04080000 50020000 |............P...|
62 CHECK-NEXT: 0180: 00000000 00000000 00000000 00000100 |................|
63 CHECK-NEXT: 0190: 09040000 60020000 00000000 00000000 |....`...........|
64 CHECK-NEXT: 01A0: 00000000 00000100 09040000 70020000 |............p...|
65 CHECK-NEXT: 01B0: 00000000 00000000 00000000 00000200 |................|
66 CHECK-NEXT: 01C0: 09040000 80020000 04080000 90020000 |................|
67 CHECK-NEXT: 01D0: 00000000 00000000 00000000 00000100 |................|
68 CHECK-NEXT: 01E0: 09040000 A0020000 00000000 00000000 |................|
69 CHECK-NEXT: 01F0: 00000000 00000300 09040000 B0020000 |................|
70 CHECK-NEXT: 0200: 04080000 C0020000 07100000 D0020000 |................|
71 CHECK-NEXT: 0210: 002B0000 39000000 00000000 00000000 |.+..9...........|
72 CHECK-NEXT: 0220: C8230000 28030000 00000000 00000000 |.#..(...........|
73 CHECK-NEXT: 0230: F0260000 28030000 00000000 00000000 |.&..(...........|
74 CHECK-NEXT: 0240: D02A0000 30000000 00000000 00000000 |.*..0...........|
75 CHECK-NEXT: 0250: 182A0000 2E000000 00000000 00000000 |.*..............|
76 CHECK-NEXT: 0260: 482A0000 6C000000 00000000 00000000 |H*..l...........|
77 CHECK-NEXT: 0270: 80230000 2A000000 00000000 00000000 |.#..*...........|
78 CHECK-NEXT: 0280: B0230000 18000000 00000000 00000000 |.#..............|
79 CHECK-NEXT: 0290: 082C0000 18000000 00000000 00000000 |.,..............|
80 CHECK-NEXT: 02A0: B82A0000 18000000 00000000 00000000 |.*..............|
81 CHECK-NEXT: 02B0: 402B0000 36000000 00000000 00000000 |@+..6...........|
82 CHECK-NEXT: 02C0: 782B0000 43000000 00000000 00000000 |x+..C...........|
83 CHECK-NEXT: 02D0: C02B0000 42000000 00000000 00000000 |.+..B...........|
84 CHECK-NEXT: 02E0: 0E004D00 59004100 43004300 45004C00 |..M.Y.A.C.C.E.L.|
85 CHECK-NEXT: 02F0: 45005200 41005400 4F005200 53000600 |E.R.A.T.O.R.S...|
86 CHECK-NEXT: 0300: 43005500 52005300 4F005200 04004F00 |C.U.R.S.O.R...O.|
87 CHECK-NEXT: 0310: 4B004100 59000A00 54004500 53005400 |K.A.Y...T.E.S.T.|
88 CHECK-NEXT: 0320: 44004900 41004C00 4F004700 05002200 |D.I.A.L.O.G...".|
89 CHECK-NEXT: 0330: 45004100 54002200 0B005300 54005200 |E.A.T."...S.T.R.|
90 CHECK-NEXT: 0340: 49004E00 47004100 52005200 41005900 |I.N.G.A.R.R.A.Y.|
91 CHECK-NEXT: 0350: 0A004D00 59005200 45005300 4F005500 |..M.Y.R.E.S.O.U.|
92 CHECK-NEXT: 0360: 52004300 45000900 52004100 4E004400 |R.C.E...R.A.N.D.|
93 CHECK-NEXT: 0370: 4F004D00 44004100 54000000 00000000 |O.M.D.A.T.......|
94 CHECK-NEXT: 0380: 00000500 48006500 6C006C00 6F000000 |....H.e.l.l.o...|
95 CHECK-NEXT: 0390: 00000000 00000000 00000000 00000000 |................|
96 CHECK-NEXT: 03A0: 00000000 00000000 00000000 00000000 |................|
97 CHECK-NEXT: 03B0: 11000300 E7030000 0D004400 4C040000 |..........D.L...|
98 CHECK-NEXT: 03C0: 82001200 BC010000 28000000 10000000 |........(.......|
99 CHECK-NEXT: 03D0: 10000000 01001800 00000000 00030000 |................|
100 CHECK-NEXT: 03E0: C40E0000 C40E0000 00000000 00000000 |................|
101 CHECK-NEXT: 03F0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
102 CHECK-NEXT: 0400: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
103 CHECK-NEXT: 0410: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
104 CHECK-NEXT: 0420: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
105 CHECK-NEXT: 0430: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
106 CHECK-NEXT: 0440: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
107 CHECK-NEXT: 0450: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
108 CHECK-NEXT: 0460: FFFFFFFF FF7F7F7F 7C7C7C78 78787575 |........|||xxxuu|
109 CHECK-NEXT: 0470: 75FFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |u...............|
110 CHECK-NEXT: 0480: FFFFFFFF FFFFFFFF FFFFFFFF 979797FF |................|
111 CHECK-NEXT: 0490: FFFFFFFF FF838383 AAAAAADB DBDB7979 |..............yy|
112 CHECK-NEXT: 04A0: 79757575 FFFFFFFF FFFFFFFF FFFFFFFF |yuuu............|
113 CHECK-NEXT: 04B0: FFFFFFFF FFFFFFFF FFFFFFFF 9C9C9C98 |................|
114 CHECK-NEXT: 04C0: 9898FFFF FF888888 DBDBDBB7 B7B77D7D |..............}}|
115 CHECK-NEXT: 04D0: 7DFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |}...............|
116 CHECK-NEXT: 04E0: FFFFFFFF FFFFFFFF FFFFFFFF A0A0A09C |................|
117 CHECK-NEXT: 04F0: 9C9C9393 93ADADAD F2F2F284 84848181 |................|
118 CHECK-NEXT: 0500: 81FFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
119 CHECK-NEXT: 0510: FFFFFFFF FFFFFFFF FFFFFFFF A4A4A4D7 |................|
120 CHECK-NEXT: 0520: D7D79D9D 9DD0D0D0 EEEEEE91 91918D8D |................|
121 CHECK-NEXT: 0530: 8DFFFFFF FFFFFF81 81817E7E 7EFFFFFF |..........~~~...|
122 CHECK-NEXT: 0540: FFFFFFFF FFFFFFFF FFFFFFFF A9A9A9F2 |................|
123 CHECK-NEXT: 0550: F2F2E5E5 E5E2E2E2 95959591 91918D8D |................|
124 CHECK-NEXT: 0560: 8D898989 868686FF FFFFFFFF FFFFFFFF |................|
125 CHECK-NEXT: 0570: FFFFFFFF FFFFFFFF FFFFFFFF ADADADF2 |................|
126 CHECK-NEXT: 0580: F2F2E1E1 E1DFDFDF E7E7E7E4 E4E4BBBB |................|
127 CHECK-NEXT: 0590: BB8E8E8E FFFFFFFF FFFFFFFF FFFFFFFF |................|
128 CHECK-NEXT: 05A0: FFFFFFFF FFFFFFFF FFFFFFFF B5B5B5F2 |................|
129 CHECK-NEXT: 05B0: F2F2E8E8 E8E7E7E7 EAEAEAC6 C6C69E9E |................|
130 CHECK-NEXT: 05C0: 9EFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
131 CHECK-NEXT: 05D0: FFFFFFFF FFFFFFFF FFFFFFFF B9B9B9F4 |................|
132 CHECK-NEXT: 05E0: F4F4ECEC ECEDEDED CBCBCBA7 A7A7FFFF |................|
133 CHECK-NEXT: 05F0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
134 CHECK-NEXT: 0600: FFFFFFFF FFFFFFFF FFFFFFFF BDBDBDF7 |................|
135 CHECK-NEXT: 0610: F7F7EFEF EFD0D0D0 AFAFAFFF FFFFFFFF |................|
136 CHECK-NEXT: 0620: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
137 CHECK-NEXT: 0630: FFFFFFFF FFFFFFFF FFFFFFFF C1C1C1F7 |................|
138 CHECK-NEXT: 0640: F7F7D5D5 D5B6B6B6 FFFFFFFF FFFFFFFF |................|
139 CHECK-NEXT: 0650: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
140 CHECK-NEXT: 0660: FFFFFFFF FFFFFFFF FFFFFFFF C4C4C4D9 |................|
141 CHECK-NEXT: 0670: D9D9BEBE BEFFFFFF FFFFFFFF FFFFFFFF |................|
142 CHECK-NEXT: 0680: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
143 CHECK-NEXT: 0690: FFFFFFFF FFFFFFFF FFFFFFFF C8C8C8C5 |................|
144 CHECK-NEXT: 06A0: C5C5FFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
145 CHECK-NEXT: 06B0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
146 CHECK-NEXT: 06C0: FFFFFFFF FFFFFFFF FFFFFFFF CBCBCBFF |................|
147 CHECK-NEXT: 06D0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
148 CHECK-NEXT: 06E0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
149 CHECK-NEXT: 06F0: 28000000 10000000 10000000 01001800 |(...............|
150 CHECK-NEXT: 0700: 00000000 00030000 C40E0000 C40E0000 |................|
151 CHECK-NEXT: 0710: 00000000 00000000 FFFFFFFF FFFFFFFF |................|
152 CHECK-NEXT: 0720: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
153 CHECK-NEXT: 0730: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
154 CHECK-NEXT: 0740: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
155 CHECK-NEXT: 0750: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
156 CHECK-NEXT: 0760: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
157 CHECK-NEXT: 0770: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
158 CHECK-NEXT: 0780: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
159 CHECK-NEXT: 0790: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
160 CHECK-NEXT: 07A0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
161 CHECK-NEXT: 07B0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
162 CHECK-NEXT: 07C0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
163 CHECK-NEXT: 07D0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
164 CHECK-NEXT: 07E0: FFFFFFFF A0E3A901 B31801B3 1801B318 |................|
165 CHECK-NEXT: 07F0: 01B31801 B31801B3 1861D06F FFFFFFFF |.........a.o....|
166 CHECK-NEXT: 0800: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
167 CHECK-NEXT: 0810: FFFFFFFF 01B31800 D7331CDB 49DBF9E2 |.........3..I...|
168 CHECK-NEXT: 0820: 9BEFAF00 D73300D7 3301B318 FFFFFFFF |.....3..3.......|
169 CHECK-NEXT: 0830: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
170 CHECK-NEXT: 0840: FFFFFFFF 01B31800 DE55F6FE F9DBFAE7 |.........U......|
171 CHECK-NEXT: 0850: FEFFFE86 EFAE00DE 5501B318 FFFFFFFF |........U.......|
172 CHECK-NEXT: 0860: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
173 CHECK-NEXT: 0870: FFFFFFFF 01B31800 E676DBFB EC00E676 |.........v.....v|
174 CHECK-NEXT: 0880: 57EFA5FB FFFD55EE A401B318 FFFFFFFF |W.....U.........|
175 CHECK-NEXT: 0890: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
176 CHECK-NEXT: 08A0: FFFFFFFF 01B31800 ED9800ED 9800ED98 |................|
177 CHECK-NEXT: 08B0: 00ED9887 F7CFFEFF FF01B318 FFFFFFFF |................|
178 CHECK-NEXT: 08C0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
179 CHECK-NEXT: 08D0: FFFFFFFF 01B31800 F4BA00F4 BA00F4BA |................|
180 CHECK-NEXT: 08E0: 00F4BA00 F4BA9CFB E401B318 FFFFFFFF |................|
181 CHECK-NEXT: 08F0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
182 CHECK-NEXT: 0900: FFFFFFFF 01B31800 FBDB00FB DB00FBDB |................|
183 CHECK-NEXT: 0910: 00FBDB00 FBDB00FB DB01B318 FFFFFFFF |................|
184 CHECK-NEXT: 0920: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
185 CHECK-NEXT: 0930: FFFFFFFF 9FE2A801 B31801B3 1801B318 |................|
186 CHECK-NEXT: 0940: 01B31801 B31801B3 1861D06F FFFFFFFF |.........a.o....|
187 CHECK-NEXT: 0950: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
188 CHECK-NEXT: 0960: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
189 CHECK-NEXT: 0970: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
190 CHECK-NEXT: 0980: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
191 CHECK-NEXT: 0990: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
192 CHECK-NEXT: 09A0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
193 CHECK-NEXT: 09B0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
194 CHECK-NEXT: 09C0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
195 CHECK-NEXT: 09D0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
196 CHECK-NEXT: 09E0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
197 CHECK-NEXT: 09F0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
198 CHECK-NEXT: 0A00: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF |................|
199 CHECK-NEXT: 0A10: FFFFFFFF FFFFFFFF 00000000 00006400 |..............d.|
200 CHECK-NEXT: 0A20: 79007500 00000000 65007300 68006100 |y.u.....e.s.h.a.|
201 CHECK-NEXT: 0A30: 6C006100 00008000 66006B00 61006F00 |l.a.....f.k.a.o.|
202 CHECK-NEXT: 0A40: 79006100 00000000 0000C080 00000000 |y.a.............|
203 CHECK-NEXT: 0A50: 02000A00 0A00C800 2C010000 00005400 |........,.....T.|
204 CHECK-NEXT: 0A60: 65007300 74000000 01000250 00000000 |e.s.t......P....|
205 CHECK-NEXT: 0A70: 0A000A00 E6000E00 0100FFFF 82004300 |..............C.|
206 CHECK-NEXT: 0A80: 6F006E00 74006900 6E007500 65003A00 |o.n.t.i.n.u.e.:.|
207 CHECK-NEXT: 0A90: 00000000 00000150 00000000 42008600 |.......P....B...|
208 CHECK-NEXT: 0AA0: A1000D00 0200FFFF 80002600 4F004B00 |..........&.O.K.|
209 CHECK-NEXT: 0AB0: 00000000 00000000 11005800 A4000000 |..........X.....|
210 CHECK-NEXT: 0AC0: 0D004800 2E160000 82001200 BC010000 |..H.............|
211 CHECK-NEXT: 0AD0: 00000000 00006400 66006900 73006800 |......d.f.i.s.h.|
212 CHECK-NEXT: 0AE0: 00000000 65007300 61006C00 61006400 |....e.s.a.l.a.d.|
213 CHECK-NEXT: 0AF0: 00008000 66006400 75006300 6B000000 |....f.d.u.c.k...|
214 CHECK-NEXT: 0B00: 74686973 20697320 61207573 65722064 |this is a user d|
215 CHECK-NEXT: 0B10: 6566696E 65642072 65736F75 72636500 |efined resource.|
216 CHECK-NEXT: 0B20: 69742063 6F6E7461 696E7320 6D616E79 |it contains many|
217 CHECK-NEXT: 0B30: 20737472 696E6773 00000000 00000000 | strings........|
218 CHECK-NEXT: 0B40: 74686973 20697320 61207261 6E646F6D |this is a random|
219 CHECK-NEXT: 0B50: 20626974 206F6620 64617461 20746861 | bit of data tha|
220 CHECK-NEXT: 0B60: 74206D65 616E7320 6E6F7468 696E6700 |t means nothing.|
221 CHECK-NEXT: 0B70: A9230E14 F4F60000 7A686534 20736869 |.#......zhe4 shi|
222 CHECK-NEXT: 0B80: 34207969 31676534 20737569 326A6931 |4 yi1ge4 sui2ji1|
223 CHECK-NEXT: 0B90: 20646520 73687534 6A75342C 207A6865 | de shu4ju4, zhe|
224 CHECK-NEXT: 0BA0: 34207969 34776569 347A6865 20736865 |4 yi4wei4zhe she|
225 CHECK-NEXT: 0BB0: 6E326D65 00A9230E 14F4F600 00000000 |n2me..#.........|
226 CHECK-NEXT: 0BC0: 44696573 20697374 2065696E 207A7566 |Dies ist ein zuf|
227 CHECK-NEXT: 0BD0: C3A46C6C 69676573 20426974 20766F6E |..lliges Bit von|
228 CHECK-NEXT: 0BE0: 20446174 656E2C20 64696520 6E696368 | Daten, die nich|
229 CHECK-NEXT: 0BF0: 74732062 65646575 74657400 A9230E14 |ts bedeutet..#..|
230 CHECK-NEXT: 0C00: F4F60000 00000000 11000300 E7030000 |................|
231 CHECK-NEXT: 0C10: 0D004400 4C040000 82001200 BC010000 |..D.L...........|