summaryrefslogtreecommitdiff
path: root/tools/yaml2obj
Commit message (Collapse)AuthorAge
* [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt.NAKAMURA Takumi2013-12-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196908 91177308-0d34-0410-b5e6-96231b3b80d8
* yaml2coff/elf: Touchup for compatibility.Will Dietz2013-10-12
| | | | | | | * std::string::append(int, int) can be ambiguous. * std::vector<>::data() is a C++11 feature, use ArrayRef abstraction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192542 91177308-0d34-0410-b5e6-96231b3b80d8
* [Object] Split the ELF interface into 3 parts.Michael J. Spencer2013-08-08
| | | | | | | | * ELFTypes.h contains template magic for defining types based on endianess, size, and alignment. * ELFFile.h defines the ELFFile class which provides low level ELF specific access. * ELFObjectFile.h contains ELFObjectFile which uses ELFFile to implement the ObjectFile interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188022 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Make symbol table top-level key.Sean Silva2013-06-22
| | | | | | | | | Although in reality the symbol table in ELF resides in a section, the standard requires that there be no more than one SHT_SYMTAB. To enforce this constraint, it is cleaner to group all the symbols under a top-level `Symbols` key on the object file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184627 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Narrow parameter.Sean Silva2013-06-22
| | | | | | The full ELFYAML::Section isn't needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184626 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Don't special case writing these.Sean Silva2013-06-22
| | | | | | | Just add them to the vector of section headers like the rest of the section headers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184624 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Make this "type switch" actually readable.Sean Silva2013-06-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184623 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Align section contents in the output.Sean Silva2013-06-22
| | | | | | | | | | The improperly aligned section content in the output was causing buildbot failures. This should fix them. Incidentally, this results in a simpler and more robust API for ContiguousBlobAccumulator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184621 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Allow expressing undefined symbols.Sean Silva2013-06-21
| | | | | | | | | | Previously we unconditionally enforced that section references in symbols in the YAML had a name that was a section name present in the object, and linked the references to that section. Now, permit empty section names (already the default, if the `Section` key is not provided) to indicate SHN_UNDEF. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184513 91177308-0d34-0410-b5e6-96231b3b80d8
* Unbreak bots. Didn't realize this was a C++11 feature.Sean Silva2013-06-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184508 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Don't explicitly set `Binding` with STB_*Sean Silva2013-06-21
| | | | | | | | | | | | | | | Instead, just have 3 sub-lists, one for each of {STB_LOCAL,STB_GLOBAL,STB_WEAK}. This allows us to be a lot more explicit w.r.t. the symbol ordering in the object file, because if we allowed explicitly setting the STB_* `Binding` key for the symbol, then we might have ended up having to shuffle STB_LOCAL symbols to the front of the list, which is likely to cause confusion and potential for error. Also, this new approach is simpler ;) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184506 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Add support for st_value and st_size.Sean Silva2013-06-20
| | | | | | | | | After this patch, the ELF file produced by `yaml2obj-elf-symbol-basic.yaml`, when linked and executed on x86_64 (under SysV ABI, obviously; I tested on Linux), produces a working executable that goes into an infinite loop! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184469 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Allow symbols to reference sections.Sean Silva2013-06-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184468 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Add the section name -> section index map to State.Sean Silva2013-06-20
| | | | | | | | | | | | | | One of the key things that the YAML format abstracts over is the use of section numbers for referencing sections. Instead, textual section names are used, which yaml2obj then translates into appropriate section numbers. (Technically ELF doesn't care about section names (only section numbers), but since this is a testing tool, readability counts). This simplifies using section names as symbolic references in various parts of the code. An upcoming commit will use this to allow symbols to reference sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184467 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Start factoring into "single point of truth".Sean Silva2013-06-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184457 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Just let this class own its buffer.Sean Silva2013-06-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184456 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove `using namespace` and use explicit qualification.Sean Silva2013-06-19
| | | | | | There were only two places it was actually making anything shorter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184273 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove spurious space.Sean Silva2013-06-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184272 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused parameter.Sean Silva2013-06-19
| | | | | | | | Not sure why we weren't catching this with -Wunused-parameter... Spotted by inspection. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184271 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Support ELFOSABI_* enum.Sean Silva2013-06-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184268 91177308-0d34-0410-b5e6-96231b3b80d8
* There is no ELF ABI version enum.Sean Silva2013-06-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184267 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Support st_info through `Binding` and `Type` YAML keys.Sean Silva2013-06-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184263 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Don't monkeypatch the YAML sections.Sean Silva2013-06-18
| | | | | | | | | | | | | Previously, we would monkeypatch the vector of YAML::Section's in order to ensure that the SHT_NULL entry is present. Now we just add it unconditionally. The proliferation of small numerical adjustments is beginning to frighten me, but I can't think of a way having a single point of truth for them without introducing a whole new layer of data structures (i.e. lots of code and complexity) between the YAML and binary ELF formats. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184260 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Ensure STN_UNDEF entry is present.Sean Silva2013-06-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184258 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Rudimentary symbol table support.Sean Silva2013-06-18
| | | | | | Currently, we only output the name. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184255 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Add dummy .strtab section.Sean Silva2013-06-18
| | | | | | | This will be needed later for holding symbol names, due to the libObject issue mentioned in the commit message of r184161. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184242 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Factor out string table section creation.Sean Silva2013-06-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184162 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Refer specifically to the section header string table.Sean Silva2013-06-18
| | | | | | | | | | | | | | | A bug in libObject will cause it to assert() if a symbol table's string table and the section header string table are the same section, so we need to ensure that we emit two different string tables (among other things). The problematic code is the hardcoded usage of ".strtab" (`dot_strtab_sec`) for looking up symbol names in ELFObjectFile<ELFT>::getSymbolName. I discussed this with Michael, and he has some local improvements to the ELF code in libObject that, among other things, should fix our handling of this scenario. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184161 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Ensure more fields are zero'd.Sean Silva2013-06-18
| | | | | | | | | | | | I was spotting garbage in the output. I'd like to just zero the entire ELFYAML::Section to be sure, but it contains non-POD types. (I'm also trying to avoid bloating the ELFYAML::Foo classes with a bunch of constructor code). No test, since this is by its very nature unpredictable. I'm pretty sure that one of the sanitizers would catch it immediately though. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184160 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Exit with error status on error.Sean Silva2013-06-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184115 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj] Move some classes into anonymous namespaces.Sean Silva2013-06-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184025 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj] Add support for sh_link via `Link` key.Sean Silva2013-06-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184022 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj] Add support for sh_addralign via `AddressAlign` key.Sean Silva2013-06-14
| | | | | | | For consistency, change the address in the test case from 0xDEADBEEF to 0xCAFEBABE since 0xCAFEBABE that actually has a 2-byte alignment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183962 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj] Add support for specifying raw section content.Sean Silva2013-06-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183955 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj] Add sh_addr via `Address` key.Sean Silva2013-06-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183954 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj] Initial ELF section support.Sean Silva2013-06-13
| | | | | | | The current functionality is extremely basic and a bit rough around the edges, but it will flesh out in future commits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183953 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix dubious type name similar to member name.Sean Silva2013-06-11
| | | | | | Should bring bots back to life. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183715 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj] Initial ELF support.Sean Silva2013-06-10
| | | | | | | | | Currently, only emitting the ELF header is supported (no sections or segments). The ELFYAML code organization is broadly similar to the COFFYAML code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183711 91177308-0d34-0410-b5e6-96231b3b80d8
* Print symbol names in relocations when dumping COFF as YAML.Rafael Espindola2013-06-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183403 91177308-0d34-0410-b5e6-96231b3b80d8
* Add BinaryRef binary_size() method.Sean Silva2013-06-05
| | | | | | This avoids making assumptions about the data representation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183349 91177308-0d34-0410-b5e6-96231b3b80d8
* Add writeAsBinary(raw_ostream &) method to BinaryRef.Sean Silva2013-06-05
| | | | | | | | | | | 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). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183345 91177308-0d34-0410-b5e6-96231b3b80d8
* yaml2obj: split out COFF logic into separate fileSean Silva2013-06-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183335 91177308-0d34-0410-b5e6-96231b3b80d8
* yaml2obj: add -format=<fmt> to choose input YAML interpretationSean Silva2013-06-05
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183332 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename COFFYaml.h to COFFYAML.h for consistency.Rafael Espindola2013-05-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183042 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't allocate temporary string for section data.Rafael Espindola2013-05-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183040 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the configure build.Rafael Espindola2013-05-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182172 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert obj2yaml to use yamlio.Rafael Espindola2013-05-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182169 91177308-0d34-0410-b5e6-96231b3b80d8
* Split Alignment out of the Section Characteristics.Rafael Espindola2013-05-06
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181243 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't compute a std::vector<uint8_t> just to write it out a stream.Rafael Espindola2013-04-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180247 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo.Rafael Espindola2013-04-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180137 91177308-0d34-0410-b5e6-96231b3b80d8