summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't crash in 'llvm -s' when an archive has no symtab.Rafael Espindola2013-07-101-1/+7
| | | | llvm-svn: 186029
* Add missing getters. They will be used in llvm-ar.Rafael Espindola2013-07-091-0/+32
| | | | llvm-svn: 185937
* Archive members cannot be larger than 4GB. Return a uint32_t.Rafael Espindola2013-07-091-5/+5
| | | | llvm-svn: 185936
* Add getHeader helper and move ToHeader to the cpp file.Rafael Espindola2013-07-091-2/+6
| | | | llvm-svn: 185933
* Compute the size of an archive member in the constructor.Rafael Espindola2013-07-091-14/+13
| | | | | | | It is always computed the same way (by parsing the header). Doing it in the constructor simplifies the callers a bit. llvm-svn: 185905
* Move some code out of line. No functionality change.Rafael Espindola2013-07-091-0/+70
| | | | llvm-svn: 185901
* Make BinaryRef output correctly in case of empty data.Sean Silva2013-07-091-0/+4
| | | | | | | Previously, it would simply output nothing, but it should output an empty string `""`. llvm-svn: 185894
* Remove a useless declarations (found by scan-build)Sylvestre Ledru2013-07-051-1/+0
| | | | llvm-svn: 185709
* Use the raw member names in Archive::Archive.Rafael Espindola2013-07-051-15/+10
| | | | | | | This a bit more efficient and avoids having a function that uses the string table being called by a function that searches for it. llvm-svn: 185680
* Add support for archives with no symbol table or string table.Rafael Espindola2013-07-041-1/+1
| | | | llvm-svn: 185664
* Add support for gnu archives with a string table and no symtab.Rafael Espindola2013-07-031-27/+52
| | | | | | While there, use early returns to reduce nesting. llvm-svn: 185547
* Make a switch in createBinary fully-covered. Add forgotten ↵Alexey Samsonov2013-06-281-2/+7
| | | | | | macho_dsym_companion case. llvm-svn: 185139
* [yaml2obj][ELF] Make symbol table top-level key.Sean Silva2013-06-221-7/+3
| | | | | | | | | 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] Don't explicitly set `Binding` with STB_*Sean Silva2013-06-211-10/+7
| | | | | | | | | | | | | | | 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/+1
| | | | llvm-svn: 184468
* MachOUniversal.cpp: Fix abuse of Twine. It would be sufficient to use ↵NAKAMURA Takumi2013-06-191-3/+3
| | | | | | std::string instead. llvm-svn: 184291
* [yaml2obj][ELF] Support ELFOSABI_* enum.Sean Silva2013-06-191-0/+28
| | | | llvm-svn: 184268
* [yaml2obj][ELF] Support st_info through `Binding` and `Type` YAML keys.Sean Silva2013-06-191-0/+25
| | | | llvm-svn: 184263
* [yaml2obj][ELF] Rudimentary symbol table support.Sean Silva2013-06-181-0/+10
| | | | | | Currently, we only output the name. llvm-svn: 184255
* Basic support for parsing Mach-O universal binaries in LLVMObject libraryAlexey Samsonov2013-06-186-2/+156
| | | | llvm-svn: 184191
* Don't convert object_error's enum to and from int.Rafael Espindola2013-06-181-4/+4
| | | | | | | This allows the compiler to see the enum and warn about it. While in here, fix a switch to not use a default and fix style violations. llvm-svn: 184186
* [yaml2obj] Add support for sh_link via `Link` key.Sean Silva2013-06-151-0/+1
| | | | llvm-svn: 184022
* Remove the LLVM specific archive index.Rafael Espindola2013-06-141-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Archive files (.a) can have a symbol table indicating which object files in them define which symbols. The purpose of this symbol table is to speed up linking by allowing the linker the read only the .o files it is actually going to use instead of having to parse every object's symbol table. LLVM's archive library currently supports a LLVM specific format for such table. It is hard to see any value in that now that llvm-ld is gone: * System linkers don't use it: GNU ar uses the same plugin as the linker to create archive files with a regular index. The OS X ar creates no symbol table for IL files, I assume the linker just parses all IL files. * It doesn't interact well with archives having both IL and native objects. * We probably don't want to be responsible for yet another archive format variant. This patch then: * Removes support for creating and reading such index from lib/Archive. * Remove llvm-ranlib, since there is nothing left for it to do. We should in the future add support for regular indexes to llvm-ar for both native and IL objects. When we do that, llvm-ranlib should be reimplemented as a symlink to llvm-ar, as it is equivalent to "ar s". llvm-svn: 184019
* [yaml2obj] Add support for sh_addralign via `AddressAlign` key.Sean Silva2013-06-141-0/+1
| | | | | | | For consistency, change the address in the test case from 0xDEADBEEF to 0xCAFEBABE since 0xCAFEBABE that actually has a 2-byte alignment. llvm-svn: 183962
* [yaml2obj] Add support for specifying raw section content.Sean Silva2013-06-131-0/+1
| | | | llvm-svn: 183955
* [yaml2obj] Add sh_addr via `Address` key.Sean Silva2013-06-131-0/+1
| | | | llvm-svn: 183954
* [yaml2obj] Initial ELF section support.Sean Silva2013-06-131-0/+47
| | | | | | | The current functionality is extremely basic and a bit rough around the edges, but it will flesh out in future commits. llvm-svn: 183953
* readobj: Dump PE/COFF optional records.Rui Ueyama2013-06-122-38/+67
| | | | | | | | | | | | These records are mandatory for executables and are used by the loader. Reviewers: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D939 llvm-svn: 183852
* 80-colsSean Silva2013-06-121-1/+2
| | | | | | This slipped in during a hasty renaming. llvm-svn: 183810
* Fix variable name style. Don't cast to and from int.Rafael Espindola2013-06-111-0/+2
| | | | | | | This enables the compiler to see the enum and produce warnings about a switch not being fully covered. Fix one of these warnings. llvm-svn: 183749
* Convert another use of sys::identifyFileType.Rafael Espindola2013-06-111-25/+26
| | | | | | No functionality change. llvm-svn: 183747
* Convert a use of sys::identifyFileType to sys::fs::identify_magic.Rafael Espindola2013-06-111-16/+18
| | | | | | No functionality change. llvm-svn: 183745
* Fix dubious type name similar to member name.Sean Silva2013-06-111-7/+7
| | | | | | Should bring bots back to life. llvm-svn: 183715
* [yaml2obj] Initial ELF support.Sean Silva2013-06-102-0/+229
| | | | | | | | | 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
* Pass a StringRef to sys::identifyFileType.Rafael Espindola2013-06-102-4/+2
| | | | llvm-svn: 183669
* Don't artifically restrict input object size.Sean Silva2013-06-081-2/+0
| | | | | | | | sys::IdentifyFileType is already conscious of the length, and object_error::invalid_file_type is returned below anyway if sys::IdentifyFileType doesn't recognize the file. llvm-svn: 183605
* Use isxdigit.Rafael Espindola2013-06-071-9/+1
| | | | | | Thanks to Benjamin Kramer for the suggestion. llvm-svn: 183540
* Teach llvm-objdump with the -macho parser how to use the data in code tableKevin Enderby2013-06-061-1/+45
| | | | | | | | | | | | | | | from the LC_DATA_IN_CODE load command. And when disassembling print the data in code formatted for the kind of data it and not disassemble those bytes. I added the format specific functionality to the derived class MachOObjectFile since these tables only appears in Mach-O object files. This is my first attempt to modify the libObject stuff so if folks have better suggestions how to fit this in or suggestions on the implementation please let me know. rdar://11791371 llvm-svn: 183424
* Print symbol names in relocations when dumping COFF as YAML.Rafael Espindola2013-06-061-2/+3
| | | | llvm-svn: 183403
* Add writeAsHex(raw_ostream &) method to BinaryRef.Sean Silva2013-06-051-7/+14
| | | | | | | This hides the implementation. A future commit will remove the error-prone getHex() and getBinary() methods. llvm-svn: 183352
* Rename BinaryRef::isBinary to more descriptive DataIsHexString.Sean Silva2013-06-051-1/+1
| | | | | | And add a doxygen comment. llvm-svn: 183350
* Add writeAsBinary(raw_ostream &) method to BinaryRef.Sean Silva2013-06-051-0/+29
| | | | | | | | | | | 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
* Don't print default values for NumberOfAuxSymbols and AuxiliaryData.Rafael Espindola2013-06-051-2/+3
| | | | llvm-svn: 183293
* Move BinaryRef to a new include/llvm/Object/YAML.h file.Rafael Espindola2013-06-053-17/+35
| | | | | | It will be used for ELF dumping too. llvm-svn: 183287
* Handle relocations that don't point to symbols.Rafael Espindola2013-06-053-16/+8
| | | | | | | | In ELF (as in MachO), not all relocations point to symbols. Represent this properly by using a symbol_iterator instead of a SymbolRef. Update llvm-readobj ELF's dumper to handle relocatios without symbols. llvm-svn: 183284
* [Object/COFF] Fix Windows .lib name handling.Rui Ueyama2013-06-031-4/+10
| | | | llvm-svn: 183091
* 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-0/+17
| | | | llvm-svn: 183040
* Change how we iterate over relocations on ELF.Rafael Espindola2013-05-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | For COFF and MachO, sections semantically have relocations that apply to them. That is not the case on ELF. In relocatable objects (.o), a section with relocations in ELF has offsets to another section where the relocations should be applied. In dynamic objects and executables, relocations don't have an offset, they have a virtual address. The section sh_info may or may not point to another section, but that is not actually used for resolving the relocations. This patch exposes that in the ObjectFile API. It has the following advantages: * Most (all?) clients can handle this more efficiently. They will normally walk all relocations, so doing an effort to iterate in a particular order doesn't save time. * llvm-readobj now prints relocations in the same way the native readelf does. * probably most important, relocations that don't point to any section are now visible. This is the case of relocations in the rela.dyn section. See the updated relocation-executable.test for example. llvm-svn: 182908
OpenPOWER on IntegriCloud