1// Check that lld-link rejects duplicate resources, unless
2// /force or /force:multipleres is passed.
3// The input was generated with the following command, using the original Windows
4// rc.exe:
5// > rc /fo id.res /nologo id.rc
6// > rc /fo name.res /nologo name.rc
7
8RUN: rm -rf %t.dir
9RUN: mkdir %t.dir
10RUN: cp %S/Inputs/id.res %t.dir/id1.res
11RUN: cp %S/Inputs/id.res %t.dir/id2.res
12RUN: cp %S/Inputs/id.res.o %t.dir/id1.o
13RUN: cp %S/Inputs/id.res.o %t.dir/id2.o
14
15RUN: not lld-link /machine:x64 /nodefaultlib /noentry /dll %t.dir/id1.res %t.dir/id2.res 2>&1 | \
16RUN:     FileCheck -check-prefix=ERR %s
17RUN: not lld-link /lldmingw /machine:x64 /nodefaultlib /noentry /dll %t.dir/id1.res %t.dir/id2.o 2>&1 | \
18RUN:     FileCheck -check-prefix=ERR %s
19RUN: not lld-link /lldmingw /machine:x64 /nodefaultlib /noentry /dll %t.dir/id1.o %t.dir/id2.o 2>&1 | \
20RUN:     FileCheck -check-prefix=ERR %s
21ERR: error: duplicate resource: type STRINGTABLE (ID 6)/name ID 3/language 1033, in {{.*}}id1.{{res|o}} and in {{.*}}id2.{{res|o}}
22
23RUN: lld-link /force /machine:x64 /nodefaultlib /noentry /dll %t.dir/id1.res %t.dir/id2.res 2>&1 | \
24RUN:     FileCheck -check-prefix=WARN %s
25RUN: lld-link /force:multipleres /machine:x64 /nodefaultlib /noentry /dll %t.dir/id1.res %t.dir/id2.res 2>&1 | \
26RUN:     FileCheck -check-prefix=WARN %s
27RUN: lld-link /lldmingw /force:multipleres /machine:x64 /nodefaultlib /noentry /dll %t.dir/id1.o %t.dir/id2.o 2>&1 | \
28RUN:     FileCheck -check-prefix=WARN %s
29WARN: warning: duplicate resource: type STRINGTABLE (ID 6)/name ID 3/language 1033, in {{.*}}id1.{{res|o}} and in {{.*}}id2.{{res|o}}
30