summaryrefslogtreecommitdiffstats
path: root/llvm/tools/yaml2obj
Commit message (Collapse)AuthorAgeFilesLines
...
* 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][obj2yaml] Support ELF symbol's visibility flags ↵Simon Atanasyan2014-06-061-0/+1
| | | | | | (default/hidden/protected). llvm-svn: 210316
* [yaml2obj] Add new command line option `-docnum`.Simon Atanasyan2014-05-314-12/+37
| | | | | | | | | | 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][ELF] Add an optional `Size` field to the YAML section declaration.Simon Atanasyan2014-05-161-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now the only method to configure ELF section's content and size is to assign a hexadecimal string to the `Content` field. Unfortunately this way is completely useless when you need to declare a really large section. To solve this problem this patch adds one more optional field `Size` to the `RawContentSection` structure. When yaml2obj generates an ELF file it uses the following algorithm: 1. If both `Content` and `Size` fields are missed create an empty section. 2. If only `Content` field is missed take section length from the `Size` field and fill the section by zero. 3. If only `Size` field is missed create a section using data from the `Content` field. 4. If both `Content` and `Size` fields are provided validate that the `Size` value is not less than size of `Content` data. Than take section length from the `Size`, fill beginning of the section by `Content` and the rest by zero. Examples -------- * Create a section 0x10000 bytes long filled by zero Name: .data Type: SHT_PROGBITS Flags: [ SHF_ALLOC ] Size: 0x10000 * Create a section 0x10000 bytes long starting from 'CA' 'FE' 'BA' 'BE' Name: .data Type: SHT_PROGBITS Flags: [ SHF_ALLOC ] Content: CAFEBABE Size: 0x10000 The patch reviewed by Michael Spencer. llvm-svn: 208995
* [yaml2obj] Add "-o" command line option to specify an output file name.Simon Atanasyan2014-05-152-11/+31
| | | | llvm-svn: 208900
* Use the new StringTableBuilder in yaml2elfHans Wennborg2014-04-301-45/+27
| | | | | | http://reviews.llvm.org/D3574 llvm-svn: 207694
* ELFObjectWriter: deduplicate suffices in strtabHans Wennborg2014-04-301-4/+2
| | | | | | | | | | | | | | | We already do this for shstrtab, so might as well do it for strtab. This extracts the string table building code into a separate class. The idea is to use it for other object formats too. I mostly wanted to do this for the general principle, but it does save a little bit on object file size. I tried this on a clang bootstrap and saved 0.54% on the sum of object file sizes (1.14 MB out of 212 MB for a release build). Differential Revision: http://reviews.llvm.org/D3533 llvm-svn: 207670
* [yaml2obj][ELF] ELF Relocations Support.Simon Atanasyan2014-04-111-16/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch implements support for both relocation record formats: Elf_Rel and Elf_Rela. It is possible to define relocation against symbol only. Relocations against sections will be implemented later. Now yaml2obj recognizes X86_64, MIPS and Hexagon relocation types. Example of relocation section specification: Sections: - Name: .text Type: SHT_PROGBITS Content: "0000000000000000" AddressAlign: 16 Flags: [SHF_ALLOC] - Name: .rel.text Type: SHT_REL Info: .text AddressAlign: 4 Relocations: - Offset: 0x1 Symbol: glob1 Type: R_MIPS_32 - Offset: 0x2 Symbol: glob2 Type: R_MIPS_CALL16 The patch reviewed by Michael Spencer, Sean Silva, Shankar Easwaran. llvm-svn: 206017
* [yaml2obj][ELF] Rename class SectionNameToIdxMap => NameToIdxMap. It canSimon Atanasyan2014-04-061-10/+10
| | | | | | | | be used for indexing not only section's names. No functional changes. llvm-svn: 205687
* [yaml2obj][ELF] Convert some static functions into class members toSimon Atanasyan2014-04-021-149/+159
| | | | | | | | reduce number of arguments. No functional changes. llvm-svn: 205434
* [yaml2obj][ELF] Remove unused typedef.Simon Atanasyan2014-04-021-1/+0
| | | | | | No functional changes. llvm-svn: 205433
* [yaml2obj][ELF] Move section index to the ELFState class.Simon Atanasyan2014-04-021-32/+39
| | | | | | No functional changes. llvm-svn: 205432
* [yaml2obj][ELF] Remove relationship between ELFStateSimon Atanasyan2014-04-021-13/+6
| | | | | | | | | and ContiguousBlobAccumulator classes. Pass ContiguousBlobAccumulator to the handleSymtabSectionHeader function directly. No functional changes. llvm-svn: 205431
* [yaml2obj] Add support for ELF e_flags.Daniel Sanders2014-03-311-0/+1
| | | | | | | | | | | | | | | | Summary: The FileHeader mapping now accepts an optional Flags sequence that accepts the EF_<arch>_<flag> constants. When not given, Flags defaults to zero. Reviewers: atanasyan Reviewed By: atanasyan CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3213 llvm-svn: 205173
* 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
* [yaml2obj][ELF] Use range-based for loops.Simon Atanasyan2014-03-141-4/+2
| | | | llvm-svn: 203900
* [yaml2obj][ELF] Refer to a section in the error message by its name notSimon Atanasyan2014-03-141-1/+1
| | | | | | index. llvm-svn: 203899
* [yaml2obj][ELF] Remove unused ELFState class field.Simon Atanasyan2014-03-141-7/+4
| | | | llvm-svn: 203898
* [yaml2obj][ELF] Assign name (.shstrtab) to the section holds sections names.Simon Atanasyan2014-03-141-0/+1
| | | | llvm-svn: 203897
* 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
* llvm/tools: Prune redundant target_link_libraries.NAKAMURA Takumi2014-01-311-2/+0
| | | | llvm-svn: 200559
* [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt.NAKAMURA Takumi2013-12-101-1/+4
| | | | llvm-svn: 196908
* yaml2coff/elf: Touchup for compatibility.Will Dietz2013-10-122-8/+10
| | | | | | | * std::string::append(int, int) can be ambiguous. * std::vector<>::data() is a C++11 feature, use ArrayRef abstraction. llvm-svn: 192542
* [Object] Split the ELF interface into 3 parts.Michael J. Spencer2013-08-081-10/+11
| | | | | | | | * 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. llvm-svn: 188022
* [yaml2obj][ELF] Make symbol table top-level key.Sean Silva2013-06-221-9/+11
| | | | | | | | | 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. llvm-svn: 184627
* [yaml2obj][ELF] Narrow parameter.Sean Silva2013-06-221-6/+6
| | | | | | The full ELFYAML::Section isn't needed. llvm-svn: 184626
* [yaml2obj][ELF] Don't special case writing these.Sean Silva2013-06-221-2/+2
| | | | | | | Just add them to the vector of section headers like the rest of the section headers. llvm-svn: 184624
* [yaml2obj][ELF] Make this "type switch" actually readable.Sean Silva2013-06-221-7/+20
| | | | llvm-svn: 184623
* [yaml2obj][ELF] Align section contents in the output.Sean Silva2013-06-221-8/+17
| | | | | | | | | | 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. llvm-svn: 184621
* [yaml2obj][ELF] Allow expressing undefined symbols.Sean Silva2013-06-211-7/+9
| | | | | | | | | | 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. llvm-svn: 184513
* Unbreak bots. Didn't realize this was a C++11 feature.Sean Silva2013-06-211-5/+6
| | | | llvm-svn: 184508
* [yaml2obj][ELF] Don't explicitly set `Binding` with STB_*Sean Silva2013-06-211-24/+33
| | | | | | | | | | | | | | | 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 ;) llvm-svn: 184506
* [yaml2obj][ELF] Add support for st_value and st_size.Sean Silva2013-06-201-0/+2
| | | | | | | | | 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! llvm-svn: 184469
* [yaml2obj][ELF] Allow symbols to reference sections.Sean Silva2013-06-201-0/+7
| | | | llvm-svn: 184468
* [yaml2obj][ELF] Add the section name -> section index map to State.Sean Silva2013-06-201-4/+7
| | | | | | | | | | | | | | 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. llvm-svn: 184467
* [yaml2obj][ELF] Start factoring into "single point of truth".Sean Silva2013-06-201-19/+51
| | | | llvm-svn: 184457
* [yaml2obj][ELF] Just let this class own its buffer.Sean Silva2013-06-201-4/+4
| | | | llvm-svn: 184456
* Remove `using namespace` and use explicit qualification.Sean Silva2013-06-191-3/+2
| | | | | | There were only two places it was actually making anything shorter. llvm-svn: 184273
* Remove spurious space.Sean Silva2013-06-191-1/+1
| | | | llvm-svn: 184272
* Remove unused parameter.Sean Silva2013-06-191-2/+1
| | | | | | | | Not sure why we weren't catching this with -Wunused-parameter... Spotted by inspection. llvm-svn: 184271
* [yaml2obj][ELF] Support ELFOSABI_* enum.Sean Silva2013-06-191-2/+1
| | | | llvm-svn: 184268
* There is no ELF ABI version enum.Sean Silva2013-06-191-1/+0
| | | | llvm-svn: 184267
* [yaml2obj][ELF] Support st_info through `Binding` and `Type` YAML keys.Sean Silva2013-06-191-0/+1
| | | | llvm-svn: 184263
* [yaml2obj][ELF] Don't monkeypatch the YAML sections.Sean Silva2013-06-181-14/+17
| | | | | | | | | | | | | 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. llvm-svn: 184260
* [yaml2obj][ELF] Ensure STN_UNDEF entry is present.Sean Silva2013-06-181-1/+6
| | | | llvm-svn: 184258
* [yaml2obj][ELF] Rudimentary symbol table support.Sean Silva2013-06-181-2/+43
| | | | | | Currently, we only output the name. llvm-svn: 184255
* [yaml2obj][ELF] Add dummy .strtab section.Sean Silva2013-06-181-3/+11
| | | | | | | This will be needed later for holding symbol names, due to the libObject issue mentioned in the commit message of r184161. llvm-svn: 184242
* [yaml2obj][ELF] Factor out string table section creation.Sean Silva2013-06-181-11/+14
| | | | llvm-svn: 184162
* [yaml2obj][ELF] Refer specifically to the section header string table.Sean Silva2013-06-181-17/+17
| | | | | | | | | | | | | | | 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. llvm-svn: 184161
* [yaml2obj][ELF] Ensure more fields are zero'd.Sean Silva2013-06-181-0/+2
| | | | | | | | | | | | 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. llvm-svn: 184160
OpenPOWER on IntegriCloud