1. [COFF] Add a ResourceSectionRef method for getting resource contents (details)
  2. [WindowsResource] Avoid duplicating the input filenames for each (details)
  3. [WindowsResource] Remove use of global variables in (details)
  4. [LLD] [COFF] Support merging resource object files (details)
  5. [ELF] Set `referenced` bit of Undefined created by BitcodeFile (details)
Commit 9438221785b110a3371cabccd47ac9887666ea35 by martin
[COFF] Add a ResourceSectionRef method for getting resource contents
This allows llvm-readobj to print the contents of each resource when
printing resources from an object file or executable, like it already
does for plain .res files.
This requires providing the whole COFFObjectFile to ResourceSectionRef.
This supports both object files and executables. For executables, the
DataRVA field is used as is to look up the right section.
For object files, ideally we would need to complete linking of them and
fix up all relocations to know what the DataRVA field would end up
being. In practice, the only thing that makes sense for an RVA field is
an ADDR32NB relocation. Thus, find a relocation pointing at this field,
verify that it has the expected type, locate the symbol it points at,
look up the section the symbol points at, and read from the right offset
in that section.
This works both for GNU windres object files (which use one single
.rsrc section, with all relocations against the base of the .rsrc
section, with the original value of the DataRVA field being the offset
of the data from the beginning of the .rsrc section) and cvtres object
files (with two separate .rsrc$01 and .rsrc$02 sections, and one symbol
per data entry, with the original pre-relocated DataRVA field being set
to zero).
Differential Revision:
llvm-svn: 370433
The file was modifiedllvm/tools/llvm-readobj/COFFDumper.cpp (diff)
The file was modifiedllvm/lib/Object/COFFObjectFile.cpp (diff)
The file was modifiedllvm/test/tools/llvm-cvtres/combined.test (diff)
The file was modifiedllvm/test/tools/llvm-cvtres/object.test (diff)
The file was modifiedllvm/test/tools/llvm-readobj/coff-resources.test (diff)
The file was modifiedllvm/include/llvm/Object/COFF.h (diff)
Commit e62d5682fb31285d836d97bbe35fc3b64a248d58 by martin
[WindowsResource] Avoid duplicating the input filenames for each
resource. NFC.
Differential Revision:
llvm-svn: 370434
The file was modifiedllvm/lib/Object/WindowsResource.cpp (diff)
Commit d8d63ff24ba760a7585a8eb1d4e38370cb0627e7 by martin
[WindowsResource] Remove use of global variables in
Instead of updating a global variable counter for the next index of
strings and data blobs, pass along a reference to actual data/string
vectors and let the TreeNode insertion methods add their data/strings to
the vectors when a new entry is needed.
Additionally, if the resource tree had duplicates, that were ignored
with -force:multipleres in lld, we no longer store all versions of the
duplicated resource data, now we only keep the one that actually ends up
Differential Revision:
llvm-svn: 370435
The file was modifiedllvm/include/llvm/Object/WindowsResource.h (diff)
The file was modifiedllvm/lib/Object/WindowsResource.cpp (diff)
Commit 3d3a9b3b413d29c80b6dc4cf4f923a6dd9366887 by martin
[LLD] [COFF] Support merging resource object files
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:
llvm-svn: 370436
The file was modifiedlld/COFF/InputFiles.h (diff)
The file was modifiedlld/COFF/DriverUtils.cpp (diff)
The file was addedlld/test/COFF/mixed-resource-obj.yaml
The file was modifiedllvm/include/llvm/Object/WindowsResource.h (diff)
The file was addedlld/test/COFF/Inputs/combined-resources.yaml
The file was modifiedlld/COFF/InputFiles.cpp (diff)
The file was modifiedlld/test/COFF/combined-resources.test (diff)
The file was modifiedlld/test/COFF/force-multipleres.test (diff)
The file was modifiedllvm/lib/Object/WindowsResource.cpp (diff)
The file was modifiedlld/COFF/Driver.cpp (diff)
The file was modifiedlld/COFF/Driver.h (diff)
The file was addedlld/test/COFF/Inputs/combined-resources-2.yaml
Commit 688183ec54482666e4faa6b6e1a83fe3ccc9372d by maskray
[ELF] Set `referenced` bit of Undefined created by BitcodeFile
D64136 and D65584, while fixing STB_WEAK issues and improving our
compatibility with ld.bfd, can cause another STB_WEAK problem related to
If %tundef.o has an undefined reference on f, and %tweakundef.o has a
weak undefined reference on f,
%tdef.o has a definition of f
``` ld.lld %tundef.o %tweakundef.o --start-lib %tdef.o --end-lib
1) `%tundef.o` doesn't set the `referenced` bit. 2) `%weakundef.o`
changes the binding from STB_GLOBAL to STB_WEAK 3) `%tdef.o` is not
fetched because the binding is weak.
Step (1) is incorrect. This patch sets the `referenced` bit of Undefined
created by bitcode files.
Reviewed By: ruiu
Differential Revision:
llvm-svn: 370437
The file was addedlld/test/ELF/lto/undef-weak-lazy.ll
The file was modifiedlld/ELF/InputFiles.cpp (diff)
The file was addedlld/test/ELF/lto/Inputs/undef.ll