[PATCH] D66824: [09/10] [LLD] [COFF] Support merging resource object files

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 12:14:37 PDT 2019


mstorsjo created this revision.
mstorsjo added reviewers: thakis, rnk, ruiu.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Extend WindowsResourceParser to support using a ResourceSectionRef for loading resources from an object file.

@thakis - do you want to keep the error on multiple resource object files if not in mingw mode, or just do the merging if needed? This patch so far keeps that error unless the mingw flag is set.

If there only is one resource object file and no .res resources, don't mangle 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.)

Only parse the .rsrc section and recreate the resource tree if needed (more than one resource object file, or one resource object file and one or more .res files).

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 the rest of those object files, as they can legitimately contain other sections as well, in addition to .rsrc section chunks.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66824

Files:
  lld/COFF/Driver.cpp
  lld/COFF/Driver.h
  lld/COFF/DriverUtils.cpp
  lld/COFF/InputFiles.cpp
  lld/COFF/InputFiles.h
  lld/test/COFF/Inputs/combined-resources-2.o
  lld/test/COFF/Inputs/combined-resources.o
  lld/test/COFF/combined-resources.test
  llvm/include/llvm/Object/WindowsResource.h
  llvm/lib/Object/WindowsResource.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66824.217472.patch
Type: text/x-patch
Size: 16885 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190827/29329a63/attachment.bin>


More information about the llvm-commits mailing list