summaryrefslogtreecommitdiffstats
path: root/llvm/tools/yaml2obj/yaml2obj.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [yaml2obj/ObjectYAML] - Cleanup the error reporting API, add custom errors ↵George Rimar2019-09-131-10/+9
| | | | | | | | | | | | | | | | | | | | | handlers. This is a continuation of the YAML library error reporting refactoring/improvement and the idea by itself was mentioned in the following thread: https://reviews.llvm.org/D67182?id=218714#inline-603404 This performs a cleanup of all object emitters in the library. It allows using the custom one provided by the caller. One of the nice things is that each tool can now print its tool name, e.g: "yaml2obj: error: <text>" Also, the code became a bit simpler. Differential revision: https://reviews.llvm.org/D67445 llvm-svn: 371865
* [yaml2obj] Move core yaml2obj code into lib and include for use in unit testsAlex Brachet2019-08-071-31/+8
| | | | | | | | | | | | | | 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-8/+31
| | | | | | | | 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-31/+8
| | | | | | | | | | | | | | 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
* Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFCFangrui Song2019-08-051-1/+1
| | | | | | F_{None,Text,Append} are kept for compatibility since r334221. llvm-svn: 367800
* [yaml2obj] - Don't crash on invalid inputs.George Rimar2019-04-251-5/+1
| | | | | | | | | | | | | | yaml2obj might crash on invalid input when unable to parse the YAML. Recently a crash with a very similar nature was fixed for an empty files. This patch revisits the fix and does it in yaml::Input instead. It seems to be more correct way to handle such situation. With that crash for invalid inputs is also fixed now. Differential revision: https://reviews.llvm.org/D61059 llvm-svn: 359178
* [yaml2obj] Fixing opening empty yaml files.Puyan Lotfi2019-03-281-1/+4
| | | | | | | | | | | | | | Essentially echo "" | yaml2obj crashes. This patch attempts to trim whitespace and determine if the yaml string in the file is empty or not. If the input is empty then it will not properly print out an error message and return an error code. Differential Revision: https://reviews.llvm.org/D59964 A test/tools/yaml2obj/empty.yaml M tools/yaml2obj/yaml2obj.cpp llvm-svn: 357219
* [ObjectYAML] Add basic minidump generation supportPavel Labath2019-03-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds the ability to read a yaml form of a minidump file and write it out as binary. Apart from the minidump header and the stream directory, only three basic stream kinds are supported: - Text: This kind is used for streams which contain textual data. This is typically the contents of a /proc file on linux (e.g. /proc/PID/maps). In this case, we just put the raw stream contents into the yaml. - SystemInfo: This stream contains various bits of information about the host system in binary form. We expose the data in a structured form. - Raw: This kind is used as a fallback when we don't have any special knowledge about the stream. In this case, we just print the stream contents in hex. For this code to be really useful, more stream kinds will need to be added (particularly for things like lists of memory regions and loaded modules). However, these can be added incrementally. Reviewers: jhenderson, zturner, clayborg, aprantl Subscribers: mgorny, lemo, llvm-commits, lldb-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59482 llvm-svn: 356753
* 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
* Define InitLLVM to do common initialization all at once.Rui Ueyama2018-04-131-6/+2
| | | | | | | | | | | We have a few functions that virtually all command wants to run on process startup/shutdown. This patch adds InitLLVM class to do that all at once, so that we don't need to copy-n-paste boilerplate code to each llvm command's main() function. Differential Revision: https://reviews.llvm.org/D45602 llvm-svn: 330046
* Avoid int to string conversion in Twine or raw_ostream contexts.Benjamin Kramer2017-12-281-1/+1
| | | | | | Some output changes from uppercase hex to lowercase hex, no other functionality change intended. llvm-svn: 321526
* [Support] Rename tool_output_file to ToolOutputFile, NFCReid Kleckner2017-09-231-2/+2
| | | | | | | This class isn't similar to anything from the STL, so it shouldn't use the STL naming conventions. llvm-svn: 314050
* Try to fix uninitialized read reported by msan.Zachary Turner2017-06-151-0/+1
| | | | llvm-svn: 305528
* [yaml2obj] Factor out error handling code.Davide Italiano2017-04-051-15/+12
| | | | llvm-svn: 299551
* [yaml2obj] Improve error message when output file cannot be opened.Davide Italiano2017-04-051-1/+2
| | | | | | | | Patch by Sam Clegg! Differential Revision: https://reviews.llvm.org/D31351 llvm-svn: 299546
* [WebAssembly] Improve support for WebAssembly binary formatDerek Schuff2017-03-301-0/+2
| | | | | | | | | | | | | | | | | | | Mostly this change adds support converting to and from YAML which will allow us to write more test cases for the WebAssembly MC and lld ports. Better support for objdump, readelf, and nm will be in followup CLs. I had to update the two wasm test binaries because they used the old style 'name' section which is no longer supported. Differential Revision: https://reviews.llvm.org/D31099 Patch by Sam Clegg llvm-svn: 299101
* [yaml2obj] Remove --format option in favor of YAML tagsChris Bieneman2016-06-271-42/+20
| | | | | | | | | | | | | | | | | | | | | | 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
* Search for llvm-symbolizer binary in the same directory as argv[0], beforeRichard Smith2016-06-091-1/+1
| | | | | | | looking for it along $PATH. This allows installs of LLVM tools outside of $PATH to find the symbolizer and produce pretty backtraces if they crash. llvm-svn: 272232
* Initial add for MachO support for yaml2objChris Bieneman2016-05-111-1/+5
| | | | | | | | Adding the initial files for adding MachO support to yaml2obj. Passing a MachO file will result in an error. I will be implementing obj2yaml and yaml2obj for MachO in parallel so that one can be used to test the other. llvm-svn: 269244
* Make helper functions static.Benjamin Kramer2015-03-091-1/+2
| | | | | | Found by -Wmissing-prototypes. NFC. llvm-svn: 231664
* Modernize raw_fd_ostream's constructor a bit.Rafael Espindola2014-08-251-4/+4
| | | | | | | | | | Take a StringRef instead of a "const char *". Take a "std::error_code &" instead of a "std::string &" for error. A create static method would be even better, but this patch is already a bit too big. llvm-svn: 216393
* Update the MemoryBuffer API to use ErrorOr.Rafael Espindola2014-07-061-3/+4
| | | | llvm-svn: 212405
* Remove system_error.h.Rafael Espindola2014-06-121-2/+2
| | | | | | | This is a minimal change to remove the header. I will remove the occurrences of "using std::error_code" in a followup patch. llvm-svn: 210803
* [yaml2obj] Add new command line option `-docnum`.Simon Atanasyan2014-05-311-4/+29
| | | | | | | | | | 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
* [yaml2obj] Add "-o" command line option to specify an output file name.Simon Atanasyan2014-05-151-7/+27
| | | | llvm-svn: 208900
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-2/+1
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* [yaml2obj] Initial ELF support.Sean Silva2013-06-101-1/+5
| | | | | | | | | Currently, only emitting the ELF header is supported (no sections or segments). The ELFYAML code organization is broadly similar to the COFFYAML code. llvm-svn: 183711
* yaml2obj: split out COFF logic into separate fileSean Silva2013-06-051-287/+2
| | | | llvm-svn: 183335
* yaml2obj: add -format=<fmt> to choose input YAML interpretationSean Silva2013-06-051-11/+39
| | | | | | | | | | | | See the comment in yaml2obj.cpp for why this is currently needed. Eventually we can get rid of this, but for now it is needed in order to make forward progress with adding ELF support, and should be straightforward to remove later. Also, preserve the default of COFF, to avoid breaking existing tests. This policy can easily be changed later though. llvm-svn: 183332
* Rename COFFYaml.h to COFFYAML.h for consistency.Rafael Espindola2013-05-311-1/+1
| | | | llvm-svn: 183042
* Don't allocate temporary string for section data.Rafael Espindola2013-05-311-7/+10
| | | | llvm-svn: 183040
* Convert obj2yaml to use yamlio.Rafael Espindola2013-05-171-360/+1
| | | | llvm-svn: 182169
* Split Alignment out of the Section Characteristics.Rafael Espindola2013-05-061-14/+4
| | | | | | | | The alignment is just a byte in the middle of Characteristics, not an independent flag. Making it an independent field in the yaml representation makes it more yamlio friendly. llvm-svn: 181243
* Don't compute a std::vector<uint8_t> just to write it out a stream.Rafael Espindola2013-04-251-83/+17
| | | | llvm-svn: 180247
* Fix typo.Rafael Espindola2013-04-231-7/+7
| | | | llvm-svn: 180137
* Simplify yaml2obj a bit.Rafael Espindola2013-04-231-105/+112
| | | | | | | | | | | | The COFFParser now contains only a COFFYAML::Object and the string table (which is recomputed, not serialized). The structs in COFFParser now all begin with a Header field with what is actually on the COFF object. The other fields are things that are semantically part of the struct (relocations in a section for exmaple), but are not actually represented that way in the object file. llvm-svn: 180134
* Write relocations in yaml2obj.Rafael Espindola2013-04-231-0/+13
| | | | llvm-svn: 180115
* Remove COFFYAML::Header.Rafael Espindola2013-04-201-17/+38
| | | | | | | Instead, use MappingNormalization to directly parse COFF::header. Also change the naming convention of the helper classes to be a bit shorter. llvm-svn: 179917
* Remove COFFYAML::Relocation.Rafael Espindola2013-04-191-11/+19
| | | | | | | | Use MappingNormalization to read a COFF::relocation directly. No functionality change. llvm-svn: 179891
* Move yaml2obj to tools too.Rafael Espindola2013-04-051-0/+707
llvm-svn: 178904
OpenPOWER on IntegriCloud