mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 04:06:46 +00:00

Extend WindowsResourceParser to support using a ResourceSectionRef for loading resources from an object file. Only allow merging resource object files in mingw mode; keep the existing error on multiple resource objects in link mode. If there only is one resource object file and no .res resources, don't parse and recreate the .rsrc section, but just link it in without inspecting it. This allows users to produce any .rsrc section (outside of what the parser supports), just like before. (I don't have a specific need for this, but it reduces the risk of this new feature.) Separate out the .rsrc section chunks in InputFiles.cpp, and only include them in the list of section chunks to link if we've determined that there only was one single resource object. (We need to keep other chunks from those object files, as they can legitimately contain other sections as well, in addition to .rsrc section chunks.) Differential Revision: https://reviews.llvm.org/D66824 llvm-svn: 370436
30 lines
1.6 KiB
Plaintext
30 lines
1.6 KiB
Plaintext
// Check that lld-link rejects duplicate resources, unless
|
|
// /force or /force:multipleres is passed.
|
|
// The input was generated with the following command, using the original Windows
|
|
// rc.exe:
|
|
// > rc /fo id.res /nologo id.rc
|
|
// > rc /fo name.res /nologo name.rc
|
|
|
|
RUN: rm -rf %t.dir
|
|
RUN: mkdir %t.dir
|
|
RUN: cp %S/Inputs/id.res %t.dir/id1.res
|
|
RUN: cp %S/Inputs/id.res %t.dir/id2.res
|
|
RUN: cp %S/Inputs/id.res.o %t.dir/id1.o
|
|
RUN: cp %S/Inputs/id.res.o %t.dir/id2.o
|
|
|
|
RUN: not lld-link /machine:x64 /nodefaultlib /noentry /dll %t.dir/id1.res %t.dir/id2.res 2>&1 | \
|
|
RUN: FileCheck -check-prefix=ERR %s
|
|
RUN: not lld-link /lldmingw /machine:x64 /nodefaultlib /noentry /dll %t.dir/id1.res %t.dir/id2.o 2>&1 | \
|
|
RUN: FileCheck -check-prefix=ERR %s
|
|
RUN: not lld-link /lldmingw /machine:x64 /nodefaultlib /noentry /dll %t.dir/id1.o %t.dir/id2.o 2>&1 | \
|
|
RUN: FileCheck -check-prefix=ERR %s
|
|
ERR: error: duplicate resource: type STRINGTABLE (ID 6)/name ID 3/language 1033, in {{.*}}id1.{{res|o}} and in {{.*}}id2.{{res|o}}
|
|
|
|
RUN: lld-link /force /machine:x64 /nodefaultlib /noentry /dll %t.dir/id1.res %t.dir/id2.res 2>&1 | \
|
|
RUN: FileCheck -check-prefix=WARN %s
|
|
RUN: lld-link /force:multipleres /machine:x64 /nodefaultlib /noentry /dll %t.dir/id1.res %t.dir/id2.res 2>&1 | \
|
|
RUN: FileCheck -check-prefix=WARN %s
|
|
RUN: lld-link /lldmingw /force:multipleres /machine:x64 /nodefaultlib /noentry /dll %t.dir/id1.o %t.dir/id2.o 2>&1 | \
|
|
RUN: FileCheck -check-prefix=WARN %s
|
|
WARN: warning: duplicate resource: type STRINGTABLE (ID 6)/name ID 3/language 1033, in {{.*}}id1.{{res|o}} and in {{.*}}id2.{{res|o}}
|