[PATCH] D66825: [10/10] [LLD] [COFF] Silently drop a manifest with language 0, if there's another manifest with a nonzero language id

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


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

In mingw environments, resources are normally compiled to resource object files directly, instead of letting the linker convert them to COFF format.

Since some time, GCC supports the notion of a default manifest object. When invoking the linker, GCC looks for the default manifest object file, and if found in the expected path, it is added to linker commands.

The default manifest is one that indicates support for the latest known versions of windows, to implicitly unlock the modern behaviours of certain APIs. (No stance taken on whether doing that implicitly is a good thing.)

Not all mingw/gcc distributions include this file, but e.g. in msys2, the default manifest object is distributed in a separate package (which can be but might not always be installed).

This means that even if user projects only use one single resource object file, the linker can end up with two resource object files, and thus needs to support merging them.

The default manifest has a language id of zero, and GNU ld has got logic for dropping a manifest with a zero language id, if there's another manifest present with a nonzero language id. If there are multiple manifests with a nonzero id, the merging process errors out.

Replicate the same logic from GNU ld in llvm's WindowsResourceParser class.  (Should we limit this behaviour to object files, and/or when the mingw flag is used?)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66825

Files:
  lld/test/COFF/Inputs/manifest-lang0.o
  lld/test/COFF/Inputs/manifest-lang0.res
  lld/test/COFF/Inputs/manifest-lang1.o
  lld/test/COFF/Inputs/manifest-lang1.res
  lld/test/COFF/Inputs/manifest-lang2.o
  lld/test/COFF/Inputs/manifest-lang2.res
  lld/test/COFF/merge-resource-manifest.test
  llvm/include/llvm/Object/WindowsResource.h
  llvm/lib/Object/WindowsResource.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66825.217473.patch
Type: text/x-patch
Size: 7728 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190827/e383e93c/attachment.bin>


More information about the llvm-commits mailing list