aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object
AgeCommit message (Collapse)AuthorFilesLines
2013-08-27Revert "Fix the build broken by r189315." and "Move everything depending on ↵Charles Davis2-403/+397
Object/MachOFormat.h over to Support/MachO.h." This reverts commits r189319 and r189315. r189315 broke some tests on what I believe are big-endian platforms. llvm-svn: 189321
2013-08-27Move everything depending on Object/MachOFormat.h over to Support/MachO.h.Charles Davis2-397/+403
llvm-svn: 189315
2013-08-27Support/MachO: Add a bunch of defines.Charles Davis1-26/+26
Right now we have two headers for the Mach-O format. I'd like to get rid of one. Since the other object formats are all in Support, I chose to keep the Mach-O header in Support, and discard the other one. llvm-svn: 189314
2013-08-21Move #includes from .h to .cpp file.Jakub Staszak1-0/+2
llvm-svn: 188852
2013-08-09Add back missing PPC relocation types.Ulrich Weigand1-0/+36
llvm-svn: 188064
2013-08-08Add missing PPC64 relocation types.Michael J. Spencer1-0/+42
llvm-svn: 188031
2013-08-08[Object] Split the ELF interface into 3 parts.Michael J. Spencer3-2/+625
* 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
2013-08-08initial draft of PPCMachObjectWriter.cppDavid Fang1-3/+4
this records relocation entries in the mach-o object file for PIC code generation. tested on powerpc-darwin8, validated against darwin otool -rvV llvm-svn: 188004
2013-08-07YAMLTraits.h: replace DenseMap that used a bad implementation of DenseMapInfoDmitri Gribenko1-0/+1
for StringRef with a StringMap The bug is that the empty key compares equal to the tombstone key. Also added an assertion to DenseMap to catch similar bugs in future. llvm-svn: 187866
2013-08-03MachObjectFile: Don't leak on error.Benjamin Kramer1-7/+9
llvm-svn: 187698
2013-07-29Add support for the 's' operation to llvm-ar.Rafael Espindola1-2/+6
If no other operation is specified, 's' becomes an operation instead of an modifier. The s operation just creates a symbol table. It is the same as running ranlib. We assume the archive was created by a sane ar (like llvm-ar or gnu ar) and if the symbol table is present, then it is current. We use that to optimize the most common case: a broken build system that thinks it has to run ranlib. llvm-svn: 187353
2013-07-25Remove the mblaze backend from llvm.Rafael Espindola1-2/+0
Approval in here http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-July/064169.html llvm-svn: 187145
2013-07-24Delete the buffer in createObjectFile if it fails.Rafael Espindola1-1/+4
The Binary constructor takes ownership of the memory buffer. This is a fairly unfortunate interface, but for now make createObjectFile consistent with it by also deleting the buffer if it fails. Fixes a leak in llvm-ar found by the valgrind bots. llvm-svn: 187039
2013-07-22Typo.Eric Christopher1-1/+1
llvm-svn: 186886
2013-07-2280-column tidying. Formatting choices by clang-format.Eric Christopher1-14/+16
llvm-svn: 186885
2013-07-19Retry submitting r186623: COFFDumper: Dump data directory entries.Rui Ueyama1-37/+49
The original change was rolled back in r186627 because of test failures on the big endian machine. I believe I fixed the issue so re-submitting. llvm-svn: 186734
2013-07-18Revert "COFFDumper: Dump data directory entries."Rui Ueyama1-46/+36
Because it broke s390x and ppc64-linux buildbots. This reverts commit r186623. llvm-svn: 186627
2013-07-18COFFDumper: Dump data directory entries.Rui Ueyama1-36/+46
Summary: Dump optional data directory entries in the PE/COFF header, so that we can test the output of LLD linker. This patch updates the test binary file, but the source of the binary is the same. I just re-linked the file. I don't know how the previous file was linked, but the previous file did not have any data directory entries for some reason. Reviewers: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1148 llvm-svn: 186623
2013-07-16Add 'const' qualifiers to static const char* variables.Craig Topper1-1/+1
llvm-svn: 186371
2013-07-12Change llvm-ar to use lib/Object.Rafael Espindola1-26/+23
This fixes two bugs is lib/Object that the use in llvm-ar found: * In OS X created archives, the name can be padded with nulls. Strip them. * In the constructor, remember the first non special member and use that in begin_children. This makes sure we skip all special members, not just the first one. The change to llvm-ar itself consist of * Using lib/Object for reading archives instead of ArchiveReader.cpp. * Writing the modified archive directly, instead of creating an in memory representation. The old Archive library was way more general than what is needed, as can be seen by the diffstat of this patch. Having llvm-ar using lib/Object now opens the way for creating regular symbol tables for both native objects and bitcode files so that we can use those archives for LTO. llvm-svn: 186197
2013-07-12Don't reject an empty archive.Rafael Espindola1-4/+6
llvm-svn: 186159
2013-07-10Find the symbol table on archives created on OS X.Rafael Espindola1-3/+14
llvm-svn: 186041
2013-07-10Don't crash in 'llvm -s' when an archive has no symtab.Rafael Espindola1-1/+7
llvm-svn: 186029
2013-07-09Add missing getters. They will be used in llvm-ar.Rafael Espindola1-0/+32
llvm-svn: 185937
2013-07-09Archive members cannot be larger than 4GB. Return a uint32_t.Rafael Espindola1-5/+5
llvm-svn: 185936
2013-07-09Add getHeader helper and move ToHeader to the cpp file.Rafael Espindola1-2/+6
llvm-svn: 185933
2013-07-09Compute the size of an archive member in the constructor.Rafael Espindola1-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
2013-07-09Move some code out of line. No functionality change.Rafael Espindola1-0/+70
llvm-svn: 185901
2013-07-09Make BinaryRef output correctly in case of empty data.Sean Silva1-0/+4
Previously, it would simply output nothing, but it should output an empty string `""`. llvm-svn: 185894
2013-07-05Remove a useless declarations (found by scan-build)Sylvestre Ledru1-1/+0
llvm-svn: 185709
2013-07-05Use the raw member names in Archive::Archive.Rafael Espindola1-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
2013-07-04Add support for archives with no symbol table or string table.Rafael Espindola1-1/+1
llvm-svn: 185664
2013-07-03Add support for gnu archives with a string table and no symtab.Rafael Espindola1-27/+52
While there, use early returns to reduce nesting. llvm-svn: 185547
2013-06-28Make a switch in createBinary fully-covered. Add forgotten ↵Alexey Samsonov1-2/+7
macho_dsym_companion case. llvm-svn: 185139
2013-06-22[yaml2obj][ELF] Make symbol table top-level key.Sean Silva1-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
2013-06-21[yaml2obj][ELF] Don't explicitly set `Binding` with STB_*Sean Silva1-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
2013-06-20[yaml2obj][ELF] Add support for st_value and st_size.Sean Silva1-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
2013-06-20[yaml2obj][ELF] Allow symbols to reference sections.Sean Silva1-0/+1
llvm-svn: 184468
2013-06-19MachOUniversal.cpp: Fix abuse of Twine. It would be sufficient to use ↵NAKAMURA Takumi1-3/+3
std::string instead. llvm-svn: 184291
2013-06-19[yaml2obj][ELF] Support ELFOSABI_* enum.Sean Silva1-0/+28
llvm-svn: 184268
2013-06-19[yaml2obj][ELF] Support st_info through `Binding` and `Type` YAML keys.Sean Silva1-0/+25
llvm-svn: 184263
2013-06-18[yaml2obj][ELF] Rudimentary symbol table support.Sean Silva1-0/+10
Currently, we only output the name. llvm-svn: 184255
2013-06-18Basic support for parsing Mach-O universal binaries in LLVMObject libraryAlexey Samsonov6-2/+156
llvm-svn: 184191
2013-06-18Don't convert object_error's enum to and from int.Rafael Espindola1-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
2013-06-15[yaml2obj] Add support for sh_link via `Link` key.Sean Silva1-0/+1
llvm-svn: 184022
2013-06-14Remove the LLVM specific archive index.Rafael Espindola1-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
2013-06-14[yaml2obj] Add support for sh_addralign via `AddressAlign` key.Sean Silva1-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
2013-06-13[yaml2obj] Add support for specifying raw section content.Sean Silva1-0/+1
llvm-svn: 183955
2013-06-13[yaml2obj] Add sh_addr via `Address` key.Sean Silva1-0/+1
llvm-svn: 183954
2013-06-13[yaml2obj] Initial ELF section support.Sean Silva1-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