summaryrefslogtreecommitdiffstats
path: root/llvm/tools/yaml2obj/yaml2coff.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [yaml2obj] Move core yaml2obj code into lib and include for use in unit testsAlex Brachet2019-08-071-616/+0
| | | | | | | | | | | | | | Reviewers: jhenderson, rupprecht, MaskRay, grimar, labath Reviewed By: rupprecht Subscribers: gribozavr, mgrang, seiya, mgorny, sbc100, hiraditya, aheejin, jakehehrlich, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65255 llvm-svn: 368119
* Revert "[yaml2obj] Move core yaml2obj code into lib and include for use in ↵Dmitri Gribenko2019-08-061-0/+616
| | | | | | | | unit tests" This reverts commit r368021, it broke tests. llvm-svn: 368035
* [yaml2obj] Move core yaml2obj code into lib and include for use in unit testsAlex Brachet2019-08-061-616/+0
| | | | | | | | | | | | | | Reviewers: jhenderson, rupprecht, MaskRay, grimar, labath Reviewed By: rupprecht Subscribers: seiya, mgorny, sbc100, hiraditya, aheejin, jakehehrlich, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65255 llvm-svn: 368021
* [COFF] Fix .bss section size bug in obj2yaml / yaml2objReid Kleckner2019-05-101-2/+3
| | | | | | | | | We need to serialize SizeOfRawData through even when there is no data, as in a .bss section. Fixes PR41836 llvm-svn: 360473
* [yaml2obj] Replace num_zeros with write_zerosFangrui Song2019-04-241-35/+24
| | | | llvm-svn: 359091
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [ObjectYAML] [COFF] Support multiple symbols with the same nameMartin Storsjo2019-01-071-1/+10
| | | | | | Differential Revision: https://reviews.llvm.org/D56294 llvm-svn: 350566
* [yaml2obj] Treat COFF/ARM64 as a 64 bit architectureMartin Storsjo2018-11-271-1/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D54935 llvm-svn: 347703
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-011-1/+1
| | | | | | | | | | | | | | | | We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46290 llvm-svn: 331272
* [Debuginfo][COFF] Minimal serialization support for precompiled types recordsAlexandre Ganea2018-04-091-1/+4
| | | | | | | | | | | | | This change adds support for the LF_PRECOMP and LF_ENDPRECOMP records required to read/write Microsoft precompiled types .objs. See https://en.wikipedia.org/wiki/Precompiled_header#Microsoft_Visual_C_and_C++ This also adds handling for the .debug$P section, which is actually a .debug$T section in disguise, found only in precompiled .objs. Differential Revision: https://reviews.llvm.org/D45283 llvm-svn: 329613
* Update obj2yaml and yaml2obj for .debug$H section.Zachary Turner2017-12-061-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D40842 llvm-svn: 319925
* Resubmit "[codeview] Make obj2yaml/yaml2obj support .debug$S..."Zachary Turner2017-06-141-0/+56
| | | | | | | | | This was originally reverted because of some non-deterministic failures on certain buildbots. Luckily ASAN eventually caught this as a stack-use-after-scope, so the fix is included in this patch. llvm-svn: 305393
* Revert "[codeview] Make obj2yaml/yaml2obj support .debug$S..."Zachary Turner2017-06-141-56/+0
| | | | | | | | This is causing failures on linux bots with an invalid stream read. It doesn't repro in any configuration on Windows, so reverting until I have a chance to investigate on Linux. llvm-svn: 305371
* Fix some more errors.Zachary Turner2017-06-141-27/+0
| | | | llvm-svn: 305368
* [codeview] Make obj2yaml/yaml2obj support .debug$S/T sections.Zachary Turner2017-06-141-0/+83
| | | | | | | | | | | | | | | This allows us to use yaml2obj and obj2yaml to round-trip CodeView symbol and type information without having to manually specify the bytes of the section. This makes for much easier to maintain tests. See the tests under lld/COFF in this patch for example. Before they just said SectionData: <blob> whereas now we can use meaningful record descriptions. Note that it still supports the SectionData yaml field, which could be useful for initializing a section to invalid bytes for testing, for example. Differential Revision: https://reviews.llvm.org/D34127 llvm-svn: 305366
* [yaml2obj] Remove --format option in favor of YAML tagsChris Bieneman2016-06-271-9/+2
| | | | | | | | | | | | | | | | | | | | | | Summary: Our YAML library's handling of tags isn't perfect, but it is good enough to get rid of the need for the --format argument to yaml2obj. This patch does exactly that. Instead of requiring --format, it infers the format based on the tags found in the object file. The supported tags are: !ELF !COFF !mach-o !fat-mach-o I have a corresponding patch that is quite large that fixes up all the in-tree test cases. Reviewers: rafael, Bigcheese, compnerd, silvas Subscribers: compnerd, llvm-commits Differential Revision: http://reviews.llvm.org/D21711 llvm-svn: 273915
* [NFC] Header cleanupMehdi Amini2016-04-181-1/+0
| | | | | | | | | | | | | | Removed some unused headers, replaced some headers with forward class declarations. Found using simple scripts like this one: clear && ack --cpp -l '#include "llvm/ADT/IndexedMap.h"' | xargs grep -L 'IndexedMap[<]' | xargs grep -n --color=auto 'IndexedMap' Patch by Eugene Kosov <claprix@yandex.ru> Differential Revision: http://reviews.llvm.org/D19219 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266595
* [yaml2obj, COFF] Correctly handle section alignmentDavid Majnemer2016-03-171-2/+12
| | | | | | | | | The section alignment field was marked optional but not provided a default value: initialize it with 0. While we are here, ensure that the section alignment is plausible. llvm-svn: 263692
* Move ObjectYAML code to a new library.Rafael Espindola2016-03-011-1/+1
| | | | | | | It is only ever used by obj2yaml and yaml2obj. No point in linking it everywhere. llvm-svn: 262368
* Update to use new name alignTo().Rui Ueyama2016-01-141-9/+7
| | | | llvm-svn: 257804
* Mark empty default constructors as =default if it makes the type PODBenjamin Kramer2015-04-111-4/+1
| | | | | | NFC llvm-svn: 234694
* Make helper functions static.Benjamin Kramer2015-03-091-1/+1
| | | | | | Found by -Wmissing-prototypes. NFC. llvm-svn: 231664
* [cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth2015-01-141-2/+2
| | | | | | | | | | | utils/sort_includes.py. I clearly haven't done this in a while, so more changed than usual. This even uncovered a missing include from the InstrProf library that I've added. No functionality changed here, just mechanical cleanup of the include order. llvm-svn: 225974
* yaml2obj, COFF: Consider the DOS stub when laying out section headersDavid Majnemer2014-11-151-2/+12
| | | | | | | | While this program worked correctly with small example programs, larger ones tickled this bug. I'm working on a reduction because my program is quite large. llvm-svn: 222078
* yaml2obj, COFF: Correctly calculate SizeOfImage and SizeOfHeadersDavid Majnemer2014-11-141-9/+16
| | | | | | | | SizeOfHeaders must be aligned to the FileAlignment. SizeOfImage must be at least the SizeOfHeaders aligned to the SectionAlignment. llvm-svn: 222030
* obj2yaml, yaml2obj: Add support for COFF executablesDavid Majnemer2014-11-141-31/+165
| | | | | | | | | | | | | | | | In support of serializing executables, obj2yaml now records the virtual address and size of sections. It also serializes whatever we strictly need from the PE header, it expects that it can reconstitute everything else via inference. yaml2obj can reconstitute a fully linked executable. In order to get executables correctly serialized/deserialized, other bugs were fixed as a circumstance. We now properly respect file and section alignments. We also avoid writing out string tables unless they are strictly necessary. llvm-svn: 221975
* Fixing a -Wsign-compare warning; NFC.Aaron Ballman2014-10-221-1/+2
| | | | | | I think it might make sense to make COFF::MaxNumberOfSections16 be a uint32_t, however, that may have wider-reaching implications in other projects, which is why I did not change that declaration. llvm-svn: 220384
* yaml2obj: Support bigobjDavid Majnemer2014-09-161-21/+73
| | | | | | | | | | | | | | | | Teach yaml2obj how to make a bigobj COFF file. Like the rest of LLVM, we automatically decide whether or not to use regular COFF or bigobj COFF on the fly depending on how many sections the resulting object would have. This ends the task of adding bigobj support to LLVM. N.B. This was tested by forcing yaml2obj to be used in bigobj mode regardless of the number of sections. While a dedicated test was written, the smallest I could make it was 36 MB (!) of yaml and it still took a significant amount of time to execute on a powerful machine. llvm-svn: 217858
* MC: Add support for BigObjDavid Majnemer2014-09-151-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | Teach WinCOFFObjectWriter how to write -mbig-obj style object files; these object files allow for more sections inside an object file. Our support for BigObj is notably different from binutils and cl: we implicitly upgrade object files to BigObj instead of asking the user to compile the same file *again* but with another flag. This matches up with how LLVM treats ELF variants. This was tested by forcing LLVM to always emit BigObj files and running the entire test suite. A specific test has also been added. I've lowered the maximum number of sections in a normal COFF file, VS "14" CTP 3 supports no more than 65279 sections. This is important otherwise we might not switch to BigObj quickly enough, leaving us with a COFF file that we couldn't link. yaml2obj support is all that remains to implement. Differential Revision: http://reviews.llvm.org/D5349 llvm-svn: 217812
* [yaml2obj] Add new command line option `-docnum`.Simon Atanasyan2014-05-311-2/+1
| | | | | | | | | | Input YAML file might contain multiple object file definitions. New option `-docnum` allows to specify an ordinal number (starting from 1) of definition used for an object file generation. Patch reviewed by Sean Silva. llvm-svn: 209967
* Object: Provide a richer means of describing auxiliary symbolsDavid Majnemer2014-03-191-8/+74
| | | | | | | | | | | | | | | | The current state of affairs has auxiliary symbols described as a big bag of bytes. This is less than satisfying, it detracts from the YAML file as being human readable. Instead, allow for symbols to optionally contain their auxiliary data. This allows us to have a much higher level way of describing things like weak symbols, function definitions and section definitions. This depends on D3105. Differential Revision: http://llvm-reviews.chandlerc.com/D3092 llvm-svn: 204214
* yaml2coff/elf: Touchup for compatibility.Will Dietz2013-10-121-1/+1
| | | | | | | * std::string::append(int, int) can be ambiguous. * std::vector<>::data() is a C++11 feature, use ArrayRef abstraction. llvm-svn: 192542
* Print symbol names in relocations when dumping COFF as YAML.Rafael Espindola2013-06-061-2/+12
| | | | llvm-svn: 183403
* Add BinaryRef binary_size() method.Sean Silva2013-06-051-4/+3
| | | | | | This avoids making assumptions about the data representation. llvm-svn: 183349
* Add writeAsBinary(raw_ostream &) method to BinaryRef.Sean Silva2013-06-051-29/+2
| | | | | | | | | | | Previously, yaml2coff.cpp had a writeHexData static helper function to do this, but it is generally useful functionality. Also, validate hex strings up-front to avoid running having to handle errors "deep inside" the yaml2obj code (it also gives better diagnostics than it used to). llvm-svn: 183345
* yaml2obj: split out COFF logic into separate fileSean Silva2013-06-051-0/+306
llvm-svn: 183335
OpenPOWER on IntegriCloud