summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-cvtres
Commit message (Collapse)AuthorAgeFilesLines
* [COFF] Add a ResourceSectionRef method for getting resource contentsMartin Storsjo2019-08-302-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [COFF] Add a ResourceSectionRef method for getting the data entry, print it ↵Martin Storsjo2019-08-292-0/+120
| | | | | | | | in llvm-readobj Differential Revision: https://reviews.llvm.org/D66819 llvm-svn: 370311
* Let writeWindowsResourceCOFF() take a TimeStamp parameterNico Weber2019-06-112-0/+11
| | | | | | | | | | | | | | | | | | | For lld, pass in Config->Timestamp (which is set based on lld's /timestamp: and /Brepro flags). Since the writeWindowsResourceCOFF() data is only used in-memory by LLD and the obj's timestamp isn't used for anything in the output, this doesn't change behavior. For llvm-cvtres, add an optional /timestamp: parameter, and use the current behavior of calling time() if the parameter is not passed in. This doesn't really change observable behavior (unless someone passes /timestamp: to llvm-cvtres, which wasn't possible before), but it removes the last unqualified call to time() from llvm/lib, which seems like a good thing. Differential Revision: https://reviews.llvm.org/D63116 llvm-svn: 363050
* [llvm-readobj] Change -long-option to --long-option in tests. NFCFangrui Song2019-05-014-8/+8
| | | | | | | | | | We use both -long-option and --long-option in tests. Switch to --long-option for consistency. In the "llvm-readelf" mode, -long-option is discouraged as it conflicts with grouped short options and it is not accepted by GNU readelf. While updating the tests, change llvm-readobj -s to llvm-readobj -S to reduce confusion ("s" is --section-headers in llvm-readobj but --symbols in llvm-readelf). llvm-svn: 359649
* llvm-cvtres: Make new dupe resource error a bit friendlierNico Weber2019-04-243-10/+10
| | | | | | | | | | | | For well-known type IDs, include the name of the type. To not duplicate the ID->name map, make llvm-readobj call this new function as well. It has slightly different output, so this also requires updating a few tests. Differential Revision: https://reviews.llvm.org/D61086 llvm-svn: 359153
* Let llvm-cvtres (and lld-link) report duplicate resourcesNico Weber2019-04-245-0/+23
| | | | | | | | | | | | | | | | | If two .res files contain the same resource, cvtres.exe (and hence link.exe) reject the input with this message: CVTRES : fatal error CVT1100: duplicate resource. type:STRING, name:101, language:0x0409 LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt llvm-cvtres (and lld-link) used to silently pick one of the duplicate resources instead. This patch makes them report an error as well. We slightly improve on cvtres by printing the name of two .res files containing duplicate entries as well. Differential Revision: https://reviews.llvm.org/D61049 llvm-svn: 359083
* [opt] Change the parameter of OptTable::PrintHelp from Name to Usage and ↵Fangrui Song2018-10-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | don't append "[options] <inputs>" Summary: Before, "[options] <inputs>" is unconditionally appended to the `Name` parameter. It is more flexible to change its semantic to `Usage` and let user customize the usage line. % llvm-objcopy ... USAGE: llvm-objcopy <input> [ <output> ] [options] <inputs> With this patch: % llvm-objcopy ... USAGE: llvm-objcopy input [output] Reviewers: rupprecht, alexshap, jhenderson Reviewed By: rupprecht Subscribers: jakehehrlich, mehdi_amini, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D51009 llvm-svn: 344097
* [llvm-cvtres] Allow parameters preceded by '-' in addition to '/'Martin Storsjo2018-05-021-0/+4
| | | | | | | | The real cvtres.exe also allows parameters in either form. Differential Revision: https://reviews.llvm.org/D46358 llvm-svn: 331402
* [llvm-cvtres] Update the help test after SVN r326244.Martin Storsjo2018-02-271-1/+1
| | | | llvm-svn: 326248
* Fix buffer overrun in WindowsResourceCOFFWriter::writeSymbolTable()Bob Haarman2017-12-182-34/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We were using sprintf(..., "$R06X", <some uint32_t>) to create strings that are expected to be exactly length 8, but this results in longer strings if the uint32_t is greater than 0xffffff. This change modifies the behavior as follows: - Uses the loop counter instead of the data offset. This gives us sequential symbol names, avoiding collisions as much as possible. - Masks the value to 0xffffff to avoid generating names longer than 8 bytes. - Uses formatv instead of sprintf. Fixes PR35581. Reviewers: ruiu, zturner Reviewed By: ruiu Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D41270 llvm-svn: 321030
* [llvm-cvtres] Add support for ARM64Martin Storsjo2017-11-101-0/+15
| | | | | | | | | | | Also change some default cases into llvm_unreachable in WindowsResourceCOFFWriter, to make it easier to find if they are triggerd from within e.g. lld, which supported ARM64 earlier than llvm-cvtres did. Differential Revision: https://reviews.llvm.org/D39892 llvm-svn: 317942
* Fix bug in symbol generation for resource COFFEric Beckmann2017-06-301-0/+33
| | | | | | | | | | | | Symbols in the resource COFF file should be for .rsrc$02, where the actual resource data is, not .rsrc$01, which contains the directory tree. Differential Revision: https://reviews.llvm.org/D34832 Patch by Joe Ranieri. llvm-svn: 306853
* Re-enable tests on power pc since the bug has been fixed.Eric Beckmann2017-06-142-8/+0
| | | | | | | | | | Summary: just flip them on. Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34186 llvm-svn: 305345
* [powerpc] deactivate tests combined.test and object.test on powerpc64 beBill Seurer2017-06-132-0/+8
| | | | | | | | | | | These tests fail on powerpc64 BE (only, not LE) and are thus intefering with the running of 3 of the powerpc buildbots. The author of the tests has been notified and is working on fixing them but in the meantime I am disabling them to get the bots working again. See https://bugs.llvm.org//show_bug.cgi?id=33429 llvm-svn: 305317
* Improve error messages in order to help with fixing a big-endian bug.Eric Beckmann2017-06-132-2/+2
| | | | | | | | | | | | Summary: Added output to stderr so that we can actually see what is happening when the test fails on big endian. Reviewers: zturner Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D34155 llvm-svn: 305314
* Read /out:%t which was (accidentally?) removed in r305258.Daniel Jasper2017-06-131-1/+1
| | | | | | Without it, the source directory gets polluted. llvm-svn: 305271
* Update the test framework for llvm-cvtres to be more comprehensive.Eric Beckmann2017-06-1311-102/+550
| | | | | | | | | | Summary: Added test cases for multiple machine types, file merging, multiple languages, and more resource types. Also fixed new bugs these tests exposed. Subscribers: javed.absar, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D34047 llvm-svn: 305258
* Revert "Fix alignment bug in COFF emission."Eric Beckmann2017-06-1311-550/+102
| | | | | | | | | I accidentally combined this patch with one for adding more tests, they should be separated. This reverts commit 3da218a523be78df32e637d3446ecf97c9ea0465. llvm-svn: 305257
* Fix alignment bug in COFF emission.Eric Beckmann2017-06-1311-102/+550
| | | | | | | | | | | | Summary: Fix alignment issue in D34020, by aligning all sections to 8 bytes. Reviewers: zturner Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D34072 llvm-svn: 305256
* I guess /dev/null is a bad idea on windows. Use a temp file instead.Benjamin Kramer2017-06-091-1/+1
| | | | llvm-svn: 305100
* [llvm-cvtres] Don't polute the test directory.Benjamin Kramer2017-06-091-1/+1
| | | | llvm-svn: 305097
* Implement COFF emission for parsed Windows Resource ( .res) files.Eric Beckmann2017-06-093-1/+230
| | | | | | | | | | | | Summary: Add the WindowsResourceCOFFWriter class for producing the final COFF after all parsing is done. Reviewers: hiraditya!, zturner, ruiu Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34020 llvm-svn: 305092
* Adding parsing ability for .res file.Eric Beckmann2017-05-303-1/+51
| | | | | | | | Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33566 llvm-svn: 304225
* Add functionality to cvtres to parse all entries in res file.Eric Beckmann2017-05-205-0/+51
| | | | | | | | | | | Summary: Added the new modules in the Object/ folder. Updated the llvm-cvtres interface as well, and added additional tests. Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D33180 llvm-svn: 303480
* Add empty shell of llvm-cvtres.Zachary Turner2017-04-211-0/+4
This marks the beginning of an effort to port remaining MSVC toolchain miscellaneous utilities to all platforms. Currently clang-cl shells out to certain additional tools such as the IDL compiler, resource compiler, and a few other tools, but as these tools are Windows-only it limits the ability of clang to target Windows on other platforms. having a full suite of these tools directly in LLVM should eliminate this constraint. The current implementation provides no actual functionality, it is just an empty skeleton executable for the purposes of making incremental changes. Differential Revision: https://reviews.llvm.org/D32095 Patch by Eric Beckmann (ecbeckmann@google.com) llvm-svn: 301004
OpenPOWER on IntegriCloud