summaryrefslogtreecommitdiffstats
path: root/llvm/test/Object
Commit message (Collapse)AuthorAgeFilesLines
...
* [Object][ELF] Support dumping hash-tables from files with no section table.Michael J. Spencer2015-07-092-0/+8
| | | | | | This time without breaking the bots. llvm-svn: 241869
* Create BSD archives by default on OS X.Rafael Espindola2015-07-091-1/+1
| | | | | | | | | They should probably be created on anything that is not windows or linux, but I will test on freebsd before changing that. With this it is possible to bootstrap with llvm-ar instead of ar+ranlib on OS X. llvm-svn: 241849
* llvm-ar: Pad the symbol table to 4 bytes.Rafael Espindola2015-07-091-0/+8
| | | | | | | It looks like ld64 requires it. With this we seem to be able to bootstrap using llvm-ar+/usr/bin/true instead of ar+ranlib (currently on stage2). llvm-svn: 241842
* [yaml2obj] Initialize sh_addralign field for the .symtab sectionSimon Atanasyan2015-07-091-0/+3
| | | | llvm-svn: 241835
* [ELF] Explicitly configure sections alignment in the tests. NFCSimon Atanasyan2015-07-092-0/+2
| | | | llvm-svn: 241834
* Add missing file from previous commit.Rafael Espindola2015-07-091-0/+0
| | | | llvm-svn: 241815
* Basic support for BSD symbol tables in archives.Rafael Espindola2015-07-091-0/+21
| | | | | | | This could be optimized and for now we only produce __.SYMDEF and not "__.SYMDEF SORTED". llvm-svn: 241814
* Temporarily reverting 241765, 241768, and 241772 to unbreak the build bots.Adrian Prantl2015-07-092-8/+0
| | | | llvm-svn: 241781
* [Object][ELF] Support dumping hash-tables from files with no section table.Michael J. Spencer2015-07-092-0/+8
| | | | llvm-svn: 241765
* Don't reject an archive with just a symbol table.Rafael Espindola2015-07-082-0/+4
| | | | | | It is pretty unambiguous how to interpret it and gnu ar accepts it too. llvm-svn: 241750
* Start adding support for writing archives in BSD format.Rafael Espindola2015-07-081-0/+10
| | | | | | | | No support for the symbol table yet (but will hopefully add it today). We always use the long filename format so that we can align the member, which is an advantage of the BSD format. llvm-svn: 241721
* [yaml2obj] Align section content using AddressAlign field's valueSimon Atanasyan2015-07-081-0/+53
| | | | | | | | Use AddressAlign field's value to properly align sections content in the yaml2obj tool. Before this change the yaml2obj ignored AddressAlign and always aligned section on 16 bytes boundary. llvm-svn: 241674
* [yaml2obj] Use regex to match sections offsets. NFCSimon Atanasyan2015-07-082-3/+3
| | | | llvm-svn: 241669
* Delete UnknownAddress. It is a perfectly valid symbol value.Rafael Espindola2015-07-071-0/+3
| | | | | | | | | | | getSymbolValue now returns a value that in convenient for most callers: * 0 for undefined * symbol size for common symbols * offset/address for symbols the rest Code that needs something more specific can check getSymbolFlags. llvm-svn: 241605
* Common symbols are not undefined, at least for ObjectFile.Rafael Espindola2015-07-071-0/+9
| | | | | | | | | They are implemented like that in some object formats, but for the interface provided by lib/Object, SF_Undefined and SF_Common are different things. This matches the ELF and COFF implementation and fixes llvm-nm for MachO. llvm-svn: 241587
* llvm-nm: treat weak undefined as undefined.Rafael Espindola2015-07-062-2/+11
| | | | | | This matches the behavior of gnu ld. llvm-svn: 241512
* When sorting by address, undefined symbols go first.Rafael Espindola2015-07-061-16/+17
| | | | | | This matches gnu nm. llvm-svn: 241488
* Fix printing of common symbols.Rafael Espindola2015-07-061-0/+3
| | | | | | Printing the symbol size matches the behavior or both gnu nm and freebsd nm. llvm-svn: 241480
* Check that COFF .obj files have sections with zero virtual address spaces.Rafael Espindola2015-07-062-0/+13
| | | | | | | | | | | | | When talking about the virtual address of sections the coff spec says: ... for simplicity, compilers should set this to zero. Otherwise, it is an arbitrary value that is subtracted from offsets during relocation. We don't currently subtract it, so check that it is zero. If some producer does create such files, we can change getRelocationOffset instead. llvm-svn: 241447
* Fix handling of ELF::R_MIPS_32 on Mips64.Rafael Espindola2015-07-062-0/+6
| | | | | | Thanks to Aboud, Amjad for reporting the regression and providing the testcase. llvm-svn: 241440
* [ELFYAML] Fix handling SHT_NOBITS sections by obj2yaml/yaml2obj toolsSimon Atanasyan2015-07-032-3/+2
| | | | | | | | | | SHT_NOBITS sections do not have content in an object file. Now the yaml2obj tool does not accept `Content` field for such sections, and the obj2yaml tool does not attempt to read the section content from a file. Restore r241350 and r241352. llvm-svn: 241377
* This reverts commit r241350 and r241352.Rafael Espindola2015-07-032-2/+3
| | | | | | | | | | | r241350 broke lld tests. r241352 depends on r241350. Original messages: "[ELFYAML] Fix handling SHT_NOBITS sections by obj2yaml/yaml2obj tools" "[ELFYAML] Make the Size field for .bss section optional" llvm-svn: 241354
* [ELFYAML] Make the Size field for .bss section optionalSimon Atanasyan2015-07-031-1/+0
| | | | | | It's a common case to have a zero-size .bss section in an object file. llvm-svn: 241352
* [ELFYAML] Fix handling SHT_NOBITS sections by obj2yaml/yaml2obj toolsSimon Atanasyan2015-07-032-3/+3
| | | | | | | | SHT_NOBITS sections do not have content in an object file. Now yaml2obj tool does not accept `Content` field for such sections, and obj2yaml tool does not attempt to read the section content from a file. llvm-svn: 241350
* Improve error message.Rafael Espindola2015-07-021-1/+1
| | | | | | Thanks to Sean Silva for the suggestion. llvm-svn: 241255
* Return ErrorOr from getSection.Rafael Espindola2015-07-011-1/+1
| | | | | | | | | | | | | | This also improves the logic of what is an error: * getSection(uint_32): only return an error if the index is out of bounds. The index 0 corresponds to a perfectly valid entry. * getSection(Elf_Sym): Returns null for symbols that normally don't have sections and error for out of bound indexes. In many places this just moves the report_fatal_error up the stack, but those can then be fixed in smaller patches. llvm-svn: 241156
* Remove Elf_Shdr_Iter. Diagnose files with invalid section header sizes.Rafael Espindola2015-06-302-0/+3
| | | | llvm-svn: 241109
* Add a test of an elf file with an invalid section index.Rafael Espindola2015-06-302-0/+4
| | | | | | We were already checking, but were missing a test. llvm-svn: 241094
* Report an error on invalid sh_entsize.Rafael Espindola2015-06-302-0/+32
| | | | llvm-svn: 241070
* Factor out the checking of string tables.Rafael Espindola2015-06-292-0/+1
| | | | | | | | | | This moves the error checking for string tables to getStringTable which returns an ErrorOr<StringRef>. This improves error checking, makes it uniform across all string tables and makes it possible to check them once instead of once per name. llvm-svn: 240950
* Add a testcase for an invalid file.Rafael Espindola2015-06-292-0/+3
| | | | | | We were already checking this, but had no tests. llvm-svn: 240945
* Convert an assert that can fail into error checking.Rafael Espindola2015-06-292-0/+1
| | | | llvm-svn: 240944
* [Stackmap] Pre-assemble the stackmap parser test case. (Fix builders).Lang Hames2015-06-273-52/+1
| | | | | | | | This case had been failing on testers that didn't have x86 support. Rather than XFAIL it on testers without x86 support, I've just assembled it and used the raw object as the test input. llvm-svn: 240875
* [StackMaps] Add a lightweight parser for stackmap version 1 sections.Lang Hames2015-06-262-0/+67
| | | | | | | | | | The parser provides a convenient interface for reading llvm stackmap v1 sections in object files. This patch also includes a new option for llvm-readobj, '-stackmap', which uses the parser to pretty-print stackmap sections for debugging/testing purposes. llvm-svn: 240860
* [Object][ELF] Add support for dumping dynamic relocations when sections are ↵Michael J. Spencer2015-06-251-0/+11
| | | | | | stripped. llvm-svn: 240703
* llvm-nm: Don't print mapping symbols.Rafael Espindola2015-06-251-0/+11
| | | | | | This matches the behavior of gnu nm. Fixes pr23930. llvm-svn: 240695
* llvm-nm: print 'n' instead of '?'Rafael Espindola2015-06-251-1/+6
| | | | | | This matches gnu nm and has the advantage that there is a upper case N. llvm-svn: 240655
* Object: Add XFAILed test case for r239560.Peter Collingbourne2015-06-241-0/+14
| | | | | | | We ought to also emit unmangled references to dllimported functions, but no existing linker needs this. llvm-svn: 240562
* Change how symbol sizes are handled in lib/Object.Rafael Espindola2015-06-242-1/+8
| | | | | | | | | | | | | | COFF and MachO only define symbol sizes for common symbols. Reflect that in the class hierarchy by having a method for common symbols only in the base and a general one in ELF. This avoids the need of using a magic value for the size, which had a few problems * Most callers didn't check for it. * The ones that did could not tell the magic value from a file actually having that value. llvm-svn: 240529
* objdump: Don't print a (always 0) size for MachO symbols.Rafael Espindola2015-06-231-3/+3
| | | | | | | | | | | Only common symbol on MachO and COFF have a size. For COFF we already had a custom format. For MachO, there is no native objdump and we were printing it as ELF. Now we only print the sizes for symbols that actually have them. llvm-svn: 240422
* Improve error handling of getRelocationAddend.Rafael Espindola2015-06-192-0/+2
| | | | | | | | | | | | | | | | | | This patch changes getRelocationAddend to use ErrorOr and considers it an error to try to get the addend of a REL section. If, for example, a x86_64 file has a REL section, that file is corrupted and we should reject it. Using ErrorOr is not ideal since we check the section type once per relocation instead of once per section. Checking once per section would involve getRelocationAddend just asserting and callers checking the section before iterating over the relocations. In any case, this is an improvement and includes a test. llvm-svn: 240176
* Object: Prepend __imp_ when mangling a dllimport symbol in IRObjectFile.Peter Collingbourne2015-06-111-0/+17
| | | | | | | | | | | | | | | | | We cannot prepend __imp_ in the IR mangler because a function reference may be emitted unmangled in a constant initializer. The linker is expected to resolve such references to thunks. This is covered by the new test case. Strictly speaking we ought to emit two undefined symbols, one with __imp_ and one without, as we cannot know which symbol the final object file will refer to. However, this would require rather intrusive changes to IRObjectFile, and lld works fine without it for now. This reimplements r239437, which was reverted in r239502. Differential Revision: http://reviews.llvm.org/D10400 llvm-svn: 239560
* Revert "Move dllimport name mangling to IR mangler."Reid Kleckner2015-06-111-17/+0
| | | | | | | | | This reverts commit r239437. This broke clang-cl self-hosts. We'd end up calling the __imp_ symbol directly instead of using it to do an indirect function call. llvm-svn: 239502
* Move dllimport name mangling to IR mangler.Peter Collingbourne2015-06-091-0/+17
| | | | | | | | This ensures that LTO clients see the correct external symbol name. Differential Revision: http://reviews.llvm.org/D10318 llvm-svn: 239437
* LibDriver, llvm-lib: introduce.Peter Collingbourne2015-06-091-0/+9
| | | | | | | | | | llvm-lib is intended to be a lib.exe compatible utility that also understands bitcode. The implementation lives in a library so that lld can use it to implement /lib. Differential Revision: http://reviews.llvm.org/D10297 llvm-svn: 239434
* [Object, MachO] Don't crash on incomplete MachO segment load commands.Alexey Samsonov2015-06-042-0/+3
| | | | | | | | Report proper error code from MachOObjectFile constructor if we can't parse another segment load command (we already return a proper error if segment load command contents is suspicious). llvm-svn: 239109
* [Object, MachO] Don't crash on invalid MachO segment load commands.Alexey Samsonov2015-06-041-2/+2
| | | | | | | | | | | | | | | Summary: Properly report the error in segment load commands from MachOObjectFile constructor instead of crashing the program. Adjust the test case accordingly. Test Plan: regression test suite Reviewers: rafael, filcab Subscribers: llvm-commits llvm-svn: 239081
* [Object, MachO] Don't crash on invalid MachO load commands.Alexey Samsonov2015-06-041-2/+2
| | | | | | | | | | | | | | | Summary: Currently all load commands are parsed in MachOObjectFile constructor. If the next load command cannot be parsed, or if command size is too small, properly report it through the error code and fail to construct the object, instead of crashing the program. Test Plan: regression test suite Reviewers: rafael, filcab Subscribers: llvm-commits llvm-svn: 239080
* [Object, MachO] Don't crash on parsing invalid MachO header.Alexey Samsonov2015-06-042-0/+3
| | | | | | | | | | | Summary: Instead, properly report this error from MachOObjectFile constructor. Test Plan: regression test suite Reviewers: rafael Subscribers: llvm-commits llvm-svn: 239078
* Make test case more readable: move CHECK-lines next to corresponding RUN-lines.Alexey Samsonov2015-06-041-8/+6
| | | | llvm-svn: 239068
OpenPOWER on IntegriCloud