summaryrefslogtreecommitdiffstats
path: root/llvm/tools/yaml2obj/yaml2macho.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [yaml2obj] Move core yaml2obj code into lib and include for use in unit testsAlex Brachet2019-08-071-602/+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/+602
| | | | | | | | 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-602/+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
* [yaml2obj][MachO] Don't fill dummy data for virtual sectionsSeiya Nuta2019-06-171-3/+15
| | | | | | | | | | | | | | | | | | | Summary: Currently, MachOWriter::writeSectionData writes dummy data (0xdeadbeef) to fill section data areas in the file even if the section is a virtual one. Since virtual sections don't occupy any space in the file, writing dummy data could results the "OS.tell() - fileStart <= Sec.offset" assertion failure. This patch fixes the bug by simply not writing any dummy data for virtual sections. Reviewers: beanz, jhenderson, rupprecht, alexshap Reviewed By: alexshap Subscribers: compnerd, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62991 llvm-svn: 363525
* 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
* llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)Fangrui Song2018-09-271-4/+3
| | | | | | | | | | | | Summary: The convenience wrapper in STLExtras is available since rL342102. Reviewers: dblaikie, javed.absar, JDevlieghere, andreadb Subscribers: MatzeB, sanjoy, arsenm, dschuff, mehdi_amini, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, eraman, aheejin, kbarton, JDevlieghere, javed.absar, gbedwell, jrtc27, mgrang, atanasyan, steven_wu, george.burgess.iv, dexonsmith, kristina, jsji, llvm-commits Differential Revision: https://reviews.llvm.org/D52573 llvm-svn: 343163
* 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
* [tools] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-04-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort. Refer the comments section in D44363 for a list of all the required patches. Reviewers: JDevlieghere, zturner, echristo, dberris, friss Reviewed By: echristo Subscribers: gbedwell, llvm-commits Differential Revision: https://reviews.llvm.org/D45141 llvm-svn: 328943
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-071-3/+3
| | | | | | | | | | | | This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
* Add LC_BUILD_VERSION load commandSteven Wu2017-01-231-0/+15
| | | | | | | | | | | | | | | | | | | Summary: Add a new load command LC_BUILD_VERSION. It is a generic version of LC_*_VERSION_MIN load_command used on Apple platforms. Instead of having a seperate load command for each platform, LC_BUILD_VERSION is recording platform info as an enum. It also records SDK version, min_os, and tools that used to build the binary. rdar://problem/29781291 Reviewers: enderby Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29044 llvm-svn: 292824
* [ObjectYAML] Pull yaml2dwarf out of yaml2obj for reuseChris Bieneman2017-01-121-7/+10
| | | | | | This patch pulls the yaml2dwarf code out of yaml2obj into a new set of DWARF emitter functions in the DWARFYAML namespace. This will enable the YAML->DWARF code to be used inside DWARF tests by populating the DWARFYAML structs and calling the Emitter functions. llvm-svn: 291828
* [ObjectYAML] Support for DWARF line tablesChris Bieneman2017-01-101-0/+2
| | | | | | | | | | | | | | One more try... relanding r291541 with a fix to properly gate MaxOpsPerInst on DWARF version. Description from r291541: This patch re-lands r291470, which failed on Linux bots. The issue (I believe) was undefined behavior because the size of llvm::dwarf::LineNumberOps was not explcitly specified or consistently respected. The updated patch adds an explcit underlying type to the enum and preserves the size more correctly. Original description: This patch adds support for the DWARF debug_lines section. The line table state machine opcodes are preserved, so this can be used to test the state machine evaluation directly. llvm-svn: 291546
* Revert "[ObjectYAML] Support for DWARF line tables"Chris Bieneman2017-01-101-2/+0
| | | | | | | | | | This reverts commit r291541. Still failing on a bot: http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/47224/steps/test_llvm/logs/stdio llvm-svn: 291542
* [ObjectYAML] Support for DWARF line tablesChris Bieneman2017-01-101-0/+2
| | | | | | | | | | This patch re-lands r291470, which failed on Linux bots. The issue (I believe) was undefined behavior because the size of llvm::dwarf::LineNumberOps was not explcitly specified or consistently respected. The updated patch adds an explcit underlying type to the enum and preserves the size more correctly. Original description: This patch adds support for the DWARF debug_lines section. The line table state machine opcodes are preserved, so this can be used to test the state machine evaluation directly. llvm-svn: 291541
* Revert "[ObjectYAML] Support for DWARF line tables"Chris Bieneman2017-01-091-2/+0
| | | | | | | | This reverts commit r291470 due to failing bots: http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/47209/steps/test_llvm/logs/stdio llvm-svn: 291471
* [ObjectYAML] Support for DWARF line tablesChris Bieneman2017-01-091-0/+2
| | | | | | This patch adds support for the DWARF debug_lines section. The line table state machine opcodes are preserved, so this can be used to test the state machine evaluation directly. llvm-svn: 291470
* [ObjectYAML] Support for DWARF debug_info sectionChris Bieneman2016-12-221-0/+2
| | | | | | | | | | This patch adds support for YAML<->DWARF for debug_info sections. This re-lands r290147, reverted in 290148, re-landed in r290204 after fixing the issue that caused bots to fail (thank you UBSan!), and reverted again in r290209 due to failures on big endian systems. After adding support for preserving endianness, this should be good now. llvm-svn: 290386
* [ObjectYAML] Fixing big endian bots from r290381Chris Bieneman2016-12-221-1/+1
| | | | | | | Bot URL: http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/2505 llvm-svn: 290383
* [ObjectYAML] MachO support for endiannessChris Bieneman2016-12-221-60/+66
| | | | | | This patch adds support to the macho<->yaml tools for preserving endianness in MachO structures and DWARF data. llvm-svn: 290381
* Revert "[ObjectYAML] Support for DWARF debug_info section"Chris Bieneman2016-12-201-2/+0
| | | | | | | | | | | This reverts commit r290204. Still breaking bots... In a meeting now, so I can't fix it immediately. Bot URL: http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/2415 llvm-svn: 290209
* [ObjectYAML] Support for DWARF debug_info sectionChris Bieneman2016-12-201-0/+2
| | | | | | | | This patch adds support for YAML<->DWARF for debug_info sections. This re-lands r290147, after fixing the issue that caused bots to fail (thank you UBSan!). llvm-svn: 290204
* Revert "[ObjectYAML] Support for DWARF debug_info section"Chris Bieneman2016-12-201-2/+0
| | | | | | | | This reverts commit r290147. This commit is breaking a bot (http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/621). I don't have time to investigate at the moment, so I'll revert for now. llvm-svn: 290148
* [ObjectYAML] Support for DWARF debug_info sectionChris Bieneman2016-12-201-0/+2
| | | | | | This patch adds support for YAML<->DWARF for debug_info sections. llvm-svn: 290147
* [ObjectYAML] Support for DWARF Pub SectionsChris Bieneman2016-12-191-0/+4
| | | | | | This patch adds support for YAML<->DWARF round tripping for pub* section data. The patch supports both GNU and non-GNU style entries. llvm-svn: 290139
* clang-format to fix post-commit feedbackChris Bieneman2016-12-121-3/+2
| | | | | | Thanks dblaikie! llvm-svn: 289485
* [ObjectYAML] Support for DWARF debug_arangesChris Bieneman2016-12-091-0/+3
| | | | | | This patch adds support for round tripping DWARF debug_aranges in and out of YAML. llvm-svn: 289161
* [yaml2obj] Refactor and abstract yaml2dwarf functionsChris Bieneman2016-12-071-15/+2
| | | | | | This abstracts the code for emitting DWARF binary from the DWARFYAML types into reusable interfaces that could be used by ELF and COFF. llvm-svn: 288990
* [ObjectYAML] Support for DWARF __debug_abbrev sectionChris Bieneman2016-12-071-0/+12
| | | | | | This patch adds support for round-tripping DWARF debug abbreviations through the obj<->yaml tools. llvm-svn: 288955
* [ObjectYAML] First bit of support for encoding DWARF in MachOChris Bieneman2016-12-061-1/+21
| | | | | | This patch adds the starting support for encoding data from the MachO __DWARF segment. The first section supported is the __debug_str section because it is the simplest. llvm-svn: 288774
* [yaml2obj] Remove --format option in favor of YAML tagsChris Bieneman2016-06-271-17/+10
| | | | | | | | | | | | | | | | | | | | | | 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
* [obj2yaml] [yaml2obj] Support for MachO Universal binariesChris Bieneman2016-06-241-2/+105
| | | | | | This patch adds round-trip support for MachO Universal binaries to obj2yaml and yaml2obj. Universal binaries have a header and list of architecture structures, followed by a the individual object files at specified offsets. llvm-svn: 273719
* [yaml2macho] Removing asserts in favor of explicit yaml parse errorChris Bieneman2016-06-231-4/+0
| | | | | | | | | | | | 32-bit Mach headers don't have reserved fields. When generating the mapping for 32-bit headers leaving off the reserved field will result in parse errors if the field is present in the yaml. Added a CHECK-NOT line to ensure that mach_header.yaml isn't adding a reserved field, and a test to ensure that the parser error gets hit with 32-bit headers. llvm-svn: 273623
* [yaml2obj] Get rid of MachO header unionChris Bieneman2016-06-061-11/+6
| | | | | | This is based on post-commit feedback from Sean Silva. llvm-svn: 271942
* [yaml2obj] Sort MachO LinkEdit write operations based on offsetChris Bieneman2016-06-031-26/+64
| | | | | | | | This re-applies r271611, and hopefully the bots won't break this time. Although ld64 always outputs linkedit data in the same order, it isn't actually required to. This change makes yaml2obj resilient if the offsets are in arbitrary order. llvm-svn: 271687
* Revert "[yaml2obj] Sort MachO LinkEdit write operations based on offset"Chris Bieneman2016-06-021-66/+26
| | | | | | | | | | This reverts commit r271611 because it broke a bot: http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/38184 I don't currently have a handle on what went wrong, so I'll revert while I investigate. llvm-svn: 271613
* [yaml2obj] Sort MachO LinkEdit write operations based on offsetChris Bieneman2016-06-021-26/+66
| | | | | | Although ld64 always outputs linkedit data in the same order, it isn't actually required to. This change makes yaml2obj resilient if the offsets are in arbitrary order. llvm-svn: 271611
* [obj2yaml] [yaml2obj] Support for MachO nlist and string tableChris Bieneman2016-06-021-7/+36
| | | | | | This commit adds round tripping for MachO symbol data. Symbols are entries in the name list, that contain offsets into the string table which is at the end of the __LINKEDIT segment. llvm-svn: 271604
* [obj2yaml][yaml2obj] Support for reading and dumping the MachO export trieChris Bieneman2016-05-311-1/+43
| | | | | | The MachO export trie is a serially encoded trie keyed by symbol name. This code parses the trie and preserves the structure so that it can be dumped again. llvm-svn: 271300
* Avoid some copies by using const references.Benjamin Kramer2016-05-271-2/+2
| | | | | | | clang-tidy's performance-unnecessary-copy-initialization with some manual fixes. No functional changes intended. llvm-svn: 270988
* [obj2yaml][yaml2obj] Support for MachO lazy bindingsChris Bieneman2016-05-261-0/+2
| | | | | | This adds support for YAML round tripping dyld info lazy bindings. The storage and format of these is the same as regular bind opcodes, they are just interpreted differently by dyld, and can have DONE opcodes in the middle of the opcode lists. llvm-svn: 270920
* [obj2yaml][yaml2obj] Support for MachO weak bindingsChris Bieneman2016-05-261-16/+26
| | | | | | This adds support for YAML round tripping dyld info weak bindings. The storage and format of these is the same as regular bind opcodes, they are just interpreted differently by dyld. llvm-svn: 270911
* [obj2yaml][yaml2obj] Support for MachO bind opcodesChris Bieneman2016-05-261-0/+17
| | | | | | This adds support for YAML round tripping dyld info bind opcodes. Bind opcodes can have signed or unsigned LEB128 data, and they can have symbols associated with them. llvm-svn: 270901
* [obj2yaml] [yaml2obj] MachO support for rebase opcodesChris Bieneman2016-05-251-20/+67
| | | | | | This is the first bit of support for MachO __LINKEDIT segment data. llvm-svn: 270724
* [yaml2obj] [MachO] Fill Segment and Section dataChris Bieneman2016-05-201-7/+61
| | | | | | | | This fills section data with 0xDEADBEEF and segment data not inside a section with 0xBAADDA7A. This results in yaml2obj generating a matching size object file. Any additional bytes in the file are zero'd. This is a starting point for populating the remaining segment data, and provides a hex viewable file that you can easily see the missing data in. llvm-svn: 270286
* [yaml2obj] Removing debug code that scribbled 0xDEADBEEFChris Bieneman2016-05-191-4/+3
| | | | | | | | Now that MachO load command fields are fully covered we can fill unaccounted for bytes with 0. That allows us to sparsely specify YAML to simplify tests. Simplifying load_commands test accordingly. llvm-svn: 270158
* [obj2yaml] [yaml2obj] Support for MachO Load Command dataChris Bieneman2016-05-191-15/+68
| | | | | | | | | | | | | | This re-applies r270115. Many of the MachO load commands can have data appended after the command structure. This data is frequently strings, but can actually be anything. This patch adds support for three optional fields on load command yaml descriptions. The new PayloadString YAML field is populated with the data after load commands known to have strings as extra data. The new ZeroPadBytes YAML field is a count of zero'd bytes after the end of the load command structure before the next command. This can apply anywhere in the file. MachO2YAML verifies that bytes are zero before populating this field, and YAML2MachO will add zero'd bytes. The new PayloadBytes YAML field stores all bytes after the end of the load command structure before the next command if they are non-zero. This is a catch all for all unhandled bytes. If MachO2Yaml populates PayloadBytes it will not populate ZeroPadBytes, instead zero'd bytes will be in the PayloadBytes structure. llvm-svn: 270124
* Revert "[obj2yaml] [yaml2obj] Support for MachO Load Command data"Chris Bieneman2016-05-191-68/+15
| | | | | | | | This reverts commit r270115. This failed on several builders using GCC. llvm-svn: 270121
* [obj2yaml] [yaml2obj] Support for MachO Load Command dataChris Bieneman2016-05-191-15/+68
| | | | | | | | | | | | Many of the MachO load commands can have data appended after the command structure. This data is frequently strings, but can actually be anything. This patch adds support for three optional fields on load command yaml descriptions. The new PayloadString YAML field is populated with the data after load commands known to have strings as extra data. The new ZeroPadBytes YAML field is a count of zero'd bytes after the end of the load command structure before the next command. This can apply anywhere in the file. MachO2YAML verifies that bytes are zero before populating this field, and YAML2MachO will add zero'd bytes. The new PayloadBytes YAML field stores all bytes after the end of the load command structure before the next command if they are non-zero. This is a catch all for all unhandled bytes. If MachO2Yaml populates PayloadBytes it will not populate ZeroPadBytes, instead zero'd bytes will be in the PayloadBytes structure. llvm-svn: 270115
* Re-apply: [obj2yaml] [yaml2obj] Support MachO section and section_64Chris Bieneman2016-05-181-0/+32
| | | | | | This re-applies r269845, r269846, and r269850 with an included fix for a crash reported by zturner. llvm-svn: 269953
* Revert "[obj2yaml] [yaml2obj] Support MachO section and section_64Zachary Turner2016-05-171-32/+0
| | | | | | | | | structs" This reverts commits r269845, r269846, and r269850 as they introduce a crash in obj2yaml when trying to do a roundtrip. llvm-svn: 269865
OpenPOWER on IntegriCloud