aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/WindowsResource.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2019-08-30 06:55:49 +0000
committerMartin Storsjo <martin@martin.st>2019-08-30 06:55:49 +0000
commit9438221785b110a3371cabccd47ac9887666ea35 (patch)
tree48d8e5b4b6f4292341fa9b90e0180c39f9cf4e0d /llvm/lib/Object/WindowsResource.cpp
parente96892a8aa4dfb2e7cd8e416b7e427a1dd03c040 (diff)
downloadllvm-9438221785b110a3371cabccd47ac9887666ea35.zip
llvm-9438221785b110a3371cabccd47ac9887666ea35.tar.gz
llvm-9438221785b110a3371cabccd47ac9887666ea35.tar.bz2
[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: https://reviews.llvm.org/D66820 llvm-svn: 370433
Diffstat (limited to 'llvm/lib/Object/WindowsResource.cpp')
0 files changed, 0 insertions, 0 deletions