summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
Commit message (Collapse)AuthorAgeFilesLines
...
* Object: Have the irsymtab builder take a string table builder. NFCI.Peter Collingbourne2017-06-211-17/+19
| | | | | | | | | This will be needed in order to share the irsymtab string table with the bitcode string table. Differential Revision: https://reviews.llvm.org/D33971 llvm-svn: 305937
* [WebAssembly] Fix build failures introduced in r305769Sam Clegg2017-06-201-0/+1
| | | | | | | | | | | This fixes two build failures that only occur in certain configurations: - error: unused function 'operator<<' - error: control reaches end of non-void function Differential Revision: https://reviews.llvm.org/D34382 llvm-svn: 305770
* [WebAssembly] Add support for weak symbols in the binary formatSam Clegg2017-06-201-5/+83
| | | | | | | | | | | This also introduces the updated format for the "linking" section which can represent extra symbol information. See: https://github.com/WebAssembly/tool-conventions/pull/10 Differential Revision: https://reviews.llvm.org/D34019 llvm-svn: 305769
* Have writeCOFFWriter return Expected<unique_ptr>.Eric Beckmann2017-06-191-16/+14
| | | | | | | | | | | | Summary: Have writeCOFFWriter return Expected<unique_ptr> instead of requiring being passed an uninitialized unique_ptr. Reviewers: zturner, ruiu Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D34307 llvm-svn: 305730
* [WebAssembly] Use __stack_pointer global when writing wasm binarySam Clegg2017-06-161-1/+3
| | | | | | | | | | | | | | | | | | This ensures that symbolic relocations are generated for stack pointer manipulations. These relocations are of type R_WEBASSEMBLY_GLOBAL_INDEX_LEB. This change also adds support for reading relocations of this type in WasmObjectFile.cpp. Since its a globally imported symbol this does mean that the get_global/set_global instruction won't be valid until the objects are linked that global used in no longer an imported global. Differential Revision: https://reviews.llvm.org/D34172 llvm-svn: 305616
* Clean up some things in the WindowsResource changes.Eric Beckmann2017-06-161-102/+93
| | | | llvm-svn: 305596
* [Object] Remove redundant std::move.Benjamin Kramer2017-06-161-1/+1
| | | | | | Found by -Wpessimizing-move. llvm-svn: 305595
* Switch external cvtres.exe for llvm's own resource library.Eric Beckmann2017-06-161-29/+24
| | | | | | | | | | | | | | | | | | | | | | | | In this patch, I flip the switch in DriverUtils from using the external cvtres.exe tool to using the Windows Resource library in llvm. I also fixed a bug where .rsrc sections were marked as discardable memory and therefore were placed in the wrong order in the final PE. Furthermore, I modified WindowsResource to write the coff directly to a memory buffer instead of to file, also had it use the machine types already declared in COFF.h instead creating my own enum. Finally, I flipped the switch to allow all unit tests that had previously run only on windows due to a winres dependency to run cross-platform. Reviewers: zturner, ruiu Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D34265 llvm-svn: 305592
* MC, Object: Reserve a section type, SHT_LLVM_ODRTAB, for the ODR table.Peter Collingbourne2017-06-141-0/+1
| | | | | | | | | | | | | | This is part of the ODR checker proposal: http://lists.llvm.org/pipermail/llvm-dev/2017-June/113820.html Per discussion on the gnu-gabi mailing list [1] the section type range 0x6fff4c00..0x6fff4cff is reserved for LLVM. [1] https://sourceware.org/ml/gnu-gabi/2017-q2/msg00030.html Differential Revision: https://reviews.llvm.org/D33978 llvm-svn: 305407
* Use reference to iterate through string table instead of copying.Eric Beckmann2017-06-131-1/+1
| | | | | | | | | | Summary: just a quick patch Subscribers: ruiu, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D34171 llvm-svn: 305324
* Fix a bug introduced in r305092 on big-endian systems.Eric Beckmann2017-06-131-3/+1
| | | | | | | | | | | | | | Summary: We were writing the length of the string based on system-endianness, and not universally little-endian. This fixes that. Reviewers: zturner Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D34159 llvm-svn: 305322
* Fix alignment complaint.Eric Beckmann2017-06-131-3/+2
| | | | | | | | | | Summary: Apparently we need to write using a void* pointer on some architectures, or else alignment error is caused. Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D34166 llvm-svn: 305320
* Improve error messages in order to help with fixing a big-endian bug.Eric Beckmann2017-06-131-3/+3
| | | | | | | | | | | | Summary: Added output to stderr so that we can actually see what is happening when the test fails on big endian. Reviewers: zturner Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D34155 llvm-svn: 305314
* Revert "Revert "Fix alignment bug in COFF emission.""Eric Beckmann2017-06-131-46/+67
| | | | | | | | | | This revert was done so that my other patch to add test framework could land separately. Now the revert can be reverted and this patch can reland. This reverts commit 18b3c75b2b0d32601fb60a06b9672c33d6f0dff9. llvm-svn: 305259
* Update the test framework for llvm-cvtres to be more comprehensive.Eric Beckmann2017-06-131-15/+21
| | | | | | | | | | Summary: Added test cases for multiple machine types, file merging, multiple languages, and more resource types. Also fixed new bugs these tests exposed. Subscribers: javed.absar, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D34047 llvm-svn: 305258
* Revert "Fix alignment bug in COFF emission."Eric Beckmann2017-06-131-88/+61
| | | | | | | | | I accidentally combined this patch with one for adding more tests, they should be separated. This reverts commit 3da218a523be78df32e637d3446ecf97c9ea0465. llvm-svn: 305257
* Fix alignment bug in COFF emission.Eric Beckmann2017-06-131-61/+88
| | | | | | | | | | | | Summary: Fix alignment issue in D34020, by aligning all sections to 8 bytes. Reviewers: zturner Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D34072 llvm-svn: 305256
* IR: Replace the "Linker Options" module flag with "llvm.linker.options" ↵Peter Collingbourne2017-06-121-3/+3
| | | | | | | | | | named metadata. The new metadata is easier to manipulate than module flags. Differential Revision: https://reviews.llvm.org/D31349 llvm-svn: 305227
* [llvm-ar] Make llvm-lib behave more like the MSVC archiverReid Kleckner2017-06-121-6/+8
| | | | | | | | | | | | | | | | | | | | | | Summary: Use the filepath used to open the archive member as the archive member name instead of the file basename. This path might be absolute or relative. This is important because the archive member name will show up in the PDB, and we want our PDBs to look as much like MSVC's as possible. This also helps avoid an issue in our PDB module descriptor writing code, which assumes that all module names are unique. Relative paths still aren't guaranteed to be unique, but they're much better than basenames, which definitely aren't unique. Reviewers: ruiu, zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33575 llvm-svn: 305223
* Fix a ubsan failure introduced by r305092Vedant Kumar2017-06-101-2/+2
| | | | | | | | | | | | lib/Object/WindowsResource.cpp:578:3: runtime error: store to misaligned address 0x7fa09aedebbe for type 'unsigned int', which requires 4 byte alignment 0x7fa09aedebbe: note: pointer points here 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ llvm-svn: 305149
* Implement COFF emission for parsed Windows Resource ( .res) files.Eric Beckmann2017-06-091-9/+507
| | | | | | | | | | | | Summary: Add the WindowsResourceCOFFWriter class for producing the final COFF after all parsing is done. Reviewers: hiraditya!, zturner, ruiu Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34020 llvm-svn: 305092
* Fixed warning: dereferencing type-punned pointer will break strict-aliasing ↵Galina Kistanova2017-06-081-7/+7
| | | | | | | | | rules. No need in reinterpret_cast<StringTableOffset &> here, as struct coff_symbol Name is a unin with the member StringTableOffset Offset. This union member could be accessed directly. llvm-svn: 305029
* Object: Move datalayout check into irsymtab::build. NFCI.Peter Collingbourne2017-06-081-4/+4
| | | | | | | | | This check is a requirement of the irsymtab builder, not of any particular caller. Differential Revision: https://reviews.llvm.org/D33970 llvm-svn: 305023
* Bitcode: Introduce a BitcodeFileContents data type. NFCI.Peter Collingbourne2017-06-082-10/+18
| | | | | | | | | | This data type includes the contents of a bitcode file. Right now a bitcode file can only contain modules, but a later change will add a symbol table. Differential Revision: https://reviews.llvm.org/D33969 llvm-svn: 305019
* Object: Factor out the code for creating the irsymtab for an arbitrary ↵Peter Collingbourne2017-06-082-0/+57
| | | | | | | | | | | bitcode file. This code now lives in lib/Object. The idea is that it can now be reused by IRObjectFile among other things. Differential Revision: https://reviews.llvm.org/D31921 llvm-svn: 304958
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-0713-123/+129
| | | | | | | | | | | | This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
* Sort the remaining #include lines in include/... and lib/....Chandler Carruth2017-06-0610-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). llvm-svn: 304787
* [DWARF] Adding support for the DWARF v5 string offsets table ↵Wolfgang Pieb2017-06-061-0/+6
| | | | | | | | | | (consumer/reader part only). Reviewers: dblaikie, aprantl Differential Revision: https://reviews.llvm.org/D32779 llvm-svn: 304759
* Re-land "COFF: migrate def parser from LLD to LLVM"Reid Kleckner2017-06-023-0/+848
| | | | | | | | | | | | | | | | | | | | | | This reverts commit r304561 and re-lands r303490 & co. The fix was to use "SymbolName" when translating LLD's internal export list to lib/Object's short export struct. The SymbolName reflects the actual symbol name, which may include fastcall and stdcall mangling bits not included in the /EXPORT or .def file EXPORTS name: @@ -434,8 +434,7 @@ std::vector<COFFShortExport> createCOFFShortExportFromConfig() { std::vector<COFFShortExport> Exports; for (Export &E1 : Config->Exports) { COFFShortExport E2; - E2.Name = E1.Name; + // Use SymbolName, which will have any stdcall or fastcall qualifiers. + E2.Name = E1.SymbolName; E2.ExtName = E1.ExtName; E2.Ordinal = E1.Ordinal; E2.Noname = E1.Noname; llvm-svn: 304573
* Revert "COFF: migrate def parser from LLD to LLVM"Reid Kleckner2017-06-023-848/+0
| | | | | | | | | | This reverts commits r303490, r303491, r303493, and r303494. This caused http://crbug.com/728726. Essentially, exporting stdcall functions doesn't appear to work after this change. Reduced test case soon. llvm-svn: 304561
* [MachOObject] Fix bind opcode parser error on valid opcode sequenceSteven Wu2017-05-311-1/+1
| | | | | | | BIND_OPCODE_SET_DYLIB_SPECIAL_IMM(0) is a valid way to setp library ordinal. MachOObject should set LibraryOrdinalSet even when IMM is zero. llvm-svn: 304362
* Fix bug on Big-Endian system, due to reference to vector out of scope.Eric Beckmann2017-05-301-1/+1
| | | | llvm-svn: 304255
* This patch should fix various clang warnings and a use of to_stringEric Beckmann2017-05-301-1/+2
| | | | | | which isn't support before c++11. llvm-svn: 304252
* [Object] Remove unused field + constructor.Benjamin Kramer2017-05-301-2/+0
| | | | llvm-svn: 304233
* [Object] Fix pessimizing move.Benjamin Kramer2017-05-301-1/+1
| | | | | | | Returning the Error by value triggers copy elision, the move is more expensive. Clang rightfully warns about it. llvm-svn: 304232
* Adding parsing ability for .res file.Eric Beckmann2017-05-301-12/+145
| | | | | | | | Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33566 llvm-svn: 304225
* Recommit "[DWARF] - Make collectAddressRanges() return section index in ↵George Rimar2017-05-273-0/+12
| | | | | | | | | | | | | | | | | | | | | | addition to Low/High PC" With fix of uninitialized variable. Original commit message: This change is intended to use for LLD in D33183. Problem we have in LLD when building .gdb_index is that we need to know section which address range belongs to. Previously it was solved on LLD side by providing fake section addresses with use of llvm::LoadedObjectInfo interface. We assigned file offsets as addressed. Then after obtaining ranges lists, for each range we had to find section ID's. That not only was slow, but also complicated implementation and was the reason of incorrect behavior when sections share the same offsets, like D33176 shows. This patch makes DWARF parsers to return section index as well. That solves problem mentioned above. Differential revision: https://reviews.llvm.org/D33184 llvm-svn: 304078
* Revert r304002 "[DWARF] - Make collectAddressRanges() return section index ↵George Rimar2017-05-263-12/+0
| | | | | | | | in addition to Low/High PC" Revert it again. Now another bot unhappy: http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/8750 llvm-svn: 304011
* [DWARF] - Make collectAddressRanges() return section index in addition to ↵George Rimar2017-05-263-0/+12
| | | | | | | | | | | | | | | | | | Low/High PC This change is intended to use for LLD in D33183. Problem we have in LLD when building .gdb_index is that we need to know section which address range belongs to. Previously it was solved on LLD side by providing fake section addresses with use of llvm::LoadedObjectInfo interface. We assigned file offsets as addressed. Then after obtaining ranges lists, for each range we had to find section ID's. That not only was slow, but also complicated implementation and was the reason of incorrect behavior when sections share the same offsets, like D33176 shows. This patch makes DWARF parsers to return section index as well. That solves problem mentioned above. Differential revision: https://reviews.llvm.org/D33184 llvm-svn: 304002
* Revert "[DWARF] - Make collectAddressRanges() return section index in ↵George Rimar2017-05-263-12/+0
| | | | | | | | | | | | addition to Low/High PC" Broked BB again: TEST 'LLVM :: DebugInfo/X86/dbg-value-regmask-clobber.ll' FAILED ... LLVM ERROR: Section was outside of section table. llvm-svn: 303984
* Recommit r303978 "[DWARF] - Make collectAddressRanges() return section index ↵George Rimar2017-05-263-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | in addition to Low/High PC" With fix of test compilation. Initial commit message: This change is intended to use for LLD in D33183. Problem we have in LLD when building .gdb_index is that we need to know section which address range belongs to. Previously it was solved on LLD side by providing fake section addresses with use of llvm::LoadedObjectInfo interface. We assigned file offsets as addressed. Then after obtaining ranges lists, for each range we had to find section ID's. That not only was slow, but also complicated implementation and was the reason of incorrect behavior when sections share the same offsets, like D33176 shows. This patch makes DWARF parsers to return section index as well. That solves problem mentioned above. Differential revision: https://reviews.llvm.org/D33184 llvm-svn: 303983
* Revert r303978 "[DWARF] - Make collectAddressRanges() return section index ↵George Rimar2017-05-263-12/+0
| | | | | | | | in addition to Low/High PC" It failed BB. llvm-svn: 303981
* [DWARF] - Make collectAddressRanges() return section index in addition to ↵George Rimar2017-05-263-0/+12
| | | | | | | | | | | | | | | | | | | | | | Low/High PC This change is intended to use for LLD in D33183. Problem we have in LLD when building .gdb_index is that we need to know section which address range belongs to. Previously it was solved on LLD side by providing fake section addresses with use of llvm::LoadedObjectInfo interface. We assigned file offsets as addressed. Then after obtaining ranges lists, for each range we had to find section ID's. That not only was slow, but also complicated implementation and was the reason of incorrect behavior when sections share the same offsets, like D33176 shows. This patch makes DWARF parsers to return section index as well. That solves problem mentioned above. Differential revision: https://reviews.llvm.org/D33184 llvm-svn: 303978
* COFF: Fix another StringRef return errorMartell Malone2017-05-201-1/+1
| | | | | | | This should appease the lld build bot regression Following up on rL303493 llvm-svn: 303494
* COFF: Fix single StringRef return errorMartell Malone2017-05-201-2/+2
| | | | | | | This should appease the lld build bot regression Intrroduced by rL303490 llvm-svn: 303493
* COFF: migrate def parser from LLD to LLVM [1/2]Martell Malone2017-05-203-0/+848
| | | | | | | | | | | | This is split up into two commits. The will create the DEF parser in LLVM. Check the following commit to see the removal from LLD Reviewers: ruiu Differential Revision: https://reviews.llvm.org/D32689 llvm-svn: 303490
* Fix -Wunneeded-internal-declaration by removing constant arrays only used in ↵David Blaikie2017-05-201-6/+4
| | | | | | sizeof expressions, in favor of constants containing the size directly llvm-svn: 303483
* Add functionality to cvtres to parse all entries in res file.Eric Beckmann2017-05-203-1/+96
| | | | | | | | | | | Summary: Added the new modules in the Object/ folder. Updated the llvm-cvtres interface as well, and added additional tests. Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D33180 llvm-svn: 303480
* [lib/Object] - Minor API update for llvm::Decompressor.George Rimar2017-05-181-5/+0
| | | | | | | | | | | | | | | | | I revisited Decompressor API (issue with it was triggered during D32865 review) and found it is probably provides more then we really need. Issue was about next method's signature: Error decompress(SmallString<32> &Out); It is too strict. At first I wanted to change it to decompress(SmallVectorImpl<char> &Out), but then found it is still not flexible because sticks to SmallVector. During reviews was suggested to use templating to simplify code. Patch do that. Differential revision: https://reviews.llvm.org/D33200 llvm-svn: 303331
* [COFF] Gracefully handle empty .drectve sectionsShoaib Meenai2017-05-141-1/+1
| | | | | | | | | | | | | | | | | | Running `llvm-readobj -coff-directives msvcrt.lib` resulted in this error: Invalid data was encountered while parsing the file This happened because some of the object files in the archive have empty `.drectve` sections. These empty sections result in a `parse_failed` error being returned from `COFFObjectFile::getSectionContents()`, which in turn caused `llvm-readobj` to stop. With this change, `getSectionContents` now returns success, and like before the resulting array is empty. Patch by Dave Lee. Differential Revision: https://reviews.llvm.org/D32652 llvm-svn: 303014
OpenPOWER on IntegriCloud