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