summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] Fix getSymbolValue for exported globalsSam Clegg2017-09-011-1/+1
| | | | | | | | | | | | The code wasn't previously taking into account that the global index space is not same as the into in the Globals array since the latter does not include imported globals. This fixes the WebAssembly waterfall failures. Differential Revision: https://reviews.llvm.org/D37384 llvm-svn: 312340
* [WebAssembly] Fix getSymbolValue() for data symbolsSam Clegg2017-08-311-1/+6
| | | | | | | | | | This is mostly a fix for the output of `llvm-nm` See Bug 34392: https://bugs.llvm.org//show_bug.cgi?id=34392 Differential Revision: https://reviews.llvm.org/D37359 llvm-svn: 312294
* [WebAssembly] Validate exports when parsing object filesSam Clegg2017-08-311-0/+8
| | | | | | | | Subscribers: jfb, dschuff, jgravelle-google, aheejin Differential Revision: https://reviews.llvm.org/D37358 llvm-svn: 312286
* [Object] Verify object sizes before handing out StringRefs pointing outBenjamin Kramer2017-08-311-12/+3
| | | | | | | | | of bounds. This can only happen on corrupt input. Found by OSS-FUZZ! https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3228 llvm-svn: 312235
* Simplify writeArchive return type.Rui Ueyama2017-08-302-11/+8
| | | | | | | | | | writeArchive returned a pair, but the first element of the pair is always its first argument on failure, so it doesn't make sense to return it from the function. This patch change the return type so that it does't return it. Differential Revision: https://reviews.llvm.org/D37313 llvm-svn: 312177
* Untabify.NAKAMURA Takumi2017-08-281-12/+12
| | | | llvm-svn: 311875
* Fix bug 34051 by handling empty .res files gracefully.Eric Beckmann2017-08-241-12/+27
| | | | | | | | | | | | Summary: Previously, llvm-cvtres crashes on .res files which are empty except for the null header. This allows the library to simply pass over them. Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D37044 llvm-svn: 311625
* [WebAssembly] Fix overflow for input with missing versionJonas Devlieghere2017-08-231-1/+9
| | | | | | Differential revision: https://reviews.llvm.org/D37070 llvm-svn: 311605
* [MachO] Use Twines more efficiently.Benjamin Kramer2017-08-201-183/+229
| | | | llvm-svn: 311291
* [COFF] Make the weak aliases optionalMartin Storsjo2017-08-161-2/+2
| | | | | | | | | | | | | | | | When creating an import library from lld, the cases with Name != ExtName shouldn't end up as a weak alias, but as a real export of the new name, which is what actually is exported from the DLL. This restores the behaviour of renamed exports to what it was in 4.0. The other half of this commit, including test, goes into lld. Differential Revision: https://reviews.llvm.org/D36633 llvm-svn: 310991
* [llvm-dlltool] Fix creating stdcall/fastcall import libraries for i386Martin Storsjo2017-08-161-1/+7
| | | | | | | | | | | | | | | | | | | | | Hook up the -k option (that in the original GNU dlltool removes the @n suffix from the symbol that the final executable ends up linked to). In llvm-dlltool, make sure that functions end up with the undecorate name type if this option is set and they are decorated. In mingw, when creating import libraries from def files instead of creating an import library as a side effect of linking a DLL, the symbol names in the def contain the stdcall/fastcall decoration (but no leading underscore). By setting the undecorate name type, a linker linking to the import library will omit the decoration from the DLL import entry. With this in place, mingw-w64 for i386 built with llvm-dlltool/clang produces import libraries that actually work. Differential Revision: https://reviews.llvm.org/D36548 llvm-svn: 310990
* [COFF] Add SymbolName as a distinct field in COFFImportFileMartin Storsjo2017-08-161-1/+1
| | | | | | | | | | | The previous Name and ExtName aren't enough to convey all the nuances between weak aliases and stdcall decorated function names. A test for this will be added in LLD. Differential Revision: https://reviews.llvm.org/D36544 llvm-svn: 310988
* [Triple] Add isThumb and isARM functions.Florian Hahn2017-08-121-2/+1
| | | | | | | | | | | | | | | | | | | Summary: isThumb returns true for Thumb triples (little and big endian), isARM returns true for ARM triples (little and big endian). There are a few more checks using arm/thumb that are not covered by those functions, e.g. that the architecture is either ARM or Thumb (little endian) or ARM/Thumb little endian only. Reviewers: javed.absar, rengolin, kristof.beyls, t.p.northover Reviewed By: rengolin Subscribers: llvm-commits, aemerson Differential Revision: https://reviews.llvm.org/D34682 llvm-svn: 310781
* Don't pass the code model to MCRafael Espindola2017-08-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I was surprised to see the code model being passed to MC. After all, it assembles code, it doesn't create it. The one place it is used is in the expansion of .cfi directives to handle .eh_frame being more that 2gb away from the code. As far as I can tell, gnu assembler doesn't even have an option to enable this. Compiling a c file with gcc -mcmodel=large produces a regular looking .eh_frame. This is probably because in practice linker parse and recreate .eh_frames. In llvm this is used because the JIT can place the code and .eh_frame very far apart. Ideally we would fix the jit and delete this option. This is hard. Apart from confusion another problem with the current interface is that most callers pass CodeModel::Default, which is bad since MC has no way to map it to the target default if it actually needed to. This patch then replaces the argument with a boolean with a default value. The vast majority of users don't ever need to look at it. In fact, only CodeGen and llvm-mc use it and llvm-mc just to enable more testing. llvm-svn: 309884
* [llvm-dlltool] Write correct weak externalsMartin Storsjo2017-07-311-8/+5
| | | | | | | | | | | | | Previously, the created object files for the import library were broken. Write the symbol table before the string table. Simplify the code by using a separate variable Prefix instead of duplicating a few lines. Also update the coff-weak-exports to actually check that the generated weak symbols can be found as intended. Differential Revision: https://reviews.llvm.org/D36065 llvm-svn: 309555
* [llvm] Update MachOObjectFile::exports interfaceAlexander Shaposhnikov2017-07-291-3/+2
| | | | | | | | | | This diff removes the second argument of the method MachOObjectFile::exports. In all in-tree uses this argument is equal to "this" and without this argument the interface seems to be cleaner. Test plan: make check-all llvm-svn: 309462
* [LTO] Prevent dead stripping and internalization of symbols with sectionsTeresa Johnson2017-07-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | Summary: ELF linkers generate __start_<secname> and __stop_<secname> symbols when there is a value in a section <secname> where the name is a valid C identifier. If dead stripping determines that the values declared in section <secname> are dead, and we then internalize (and delete) such a symbol, programs that reference the corresponding start and end section symbols will get undefined reference linking errors. To fix this, add the section name to the IRSymtab entry when a symbol is defined in a specific section. Then use this in the gold-plugin to mark the symbol as external and visible from outside the summary when the section name is a valid C identifier. Reviewers: pcc Subscribers: mehdi_amini, inglorion, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D35639 llvm-svn: 309009
* [COFF] ARM64 support for COFFImportFileMartin Storsjo2017-07-251-0/+3
| | | | | | | | A test will be committed separately in the lld repo. Differential Revision: https://reviews.llvm.org/D35766 llvm-svn: 308951
* Small tweak to one check in error handling to the dyld compact exportKevin Enderby2017-07-241-2/+2
| | | | | | | | | | entries in libObject (done in r308690). In the case when the last node has no children setting State.Current = Children + 1; where that would be past Trie.end() is actually ok since the pointer is not used with zero children. rdar://33490512 llvm-svn: 308924
* Add error handling to the dyld compact export entries in libObject.Kevin Enderby2017-07-201-22/+154
| | | | | | | | | | | | | | | | | | | | | lld needs a matching change for this will be my next commit. Expect it to fail build until that matching commit is picked up by the bots. Like the changes in r296527 for dyld bind entires and the changes in r298883 for lazy bind, weak bind and rebase entries the export entries are the last of the dyld compact info to have error handling added. This follows the model of iterators that can fail that Lang Hanes designed when fixing the problem for bad archives r275316 (or r275361). So that iterating through the exports now terminates if there is an error and returns an llvm::Error with an error message in all cases for malformed input. This change provides the plumbing for the error handling, all the needed testing of error conditions and test cases for all of the unique error messages. llvm-svn: 308690
* Object: preserve more information about DEF fileSaleem Abdulrasool2017-07-191-4/+8
| | | | | | | | | | | | Preserve the actual library name as provided by the user. This is required to properly replicate link's behaviour about the module import name handling. This requires an associated change to lld for updating the tests for the proper behaviour for the import library module name handling in various cases. Associated tests will be part of the lld change. llvm-svn: 308406
* Object: rename parameter from DLLName to ImportNameSaleem Abdulrasool2017-07-181-16/+16
| | | | | | | | | | When I originally wrote this code, I neglected the fact that the import library may be created for executables. This name is not the name of the DLL, but rather the name for the imported module. It will be embedded into the IAT/ILT reference. Rename it to make it more obvious. NFC. llvm-svn: 308384
* Object: handle extensions properly in def filesSaleem Abdulrasool2017-07-181-3/+3
| | | | | | | | | | | | When given an extension as part of the `library` directive in a def file, the extension is preserved/honoured by link/lib. Behave similarly when parsing the def file. This requires checking if a native extension is provided as a keyword parameter. If no extension is present, append a standard `.dll` or `.exe` extension. This is best tested via lld, and I will add tests there as a follow up. llvm-svn: 308383
* llvm: add llvm-dlltool support to the archiverMartell Malone2017-07-184-22/+122
| | | | | | | | | | | | | | | | A PE COFF spec compliant import library generator. Intended to be used with mingw-w64. Supports: PE COFF spec (section 8, Import Library Format) PE COFF spec (Aux Format 3: Weak Externals) Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D29892 This reapplies rL308329, which was reverted in rL308374 llvm-svn: 308379
* Revert r308329: llvm: add llvm-dlltool support to the archiverRui Ueyama2017-07-184-122/+22
| | | | | | This reverts commit r308329 because it broke buildbots. llvm-svn: 308374
* llvm: fix -Wcast gcc warn error from rL308329Martell Malone2017-07-181-6/+3
| | | | llvm-svn: 308360
* llvm: add llvm-dlltool support to the archiverMartell Malone2017-07-184-22/+125
| | | | | | | | | | | | | | | A PE COFF spec compliant import library generator. Intended to be used with mingw-w64. Supports: PE COFF spec (section 8, Import Library Format) PE COFF spec (Aux Format 3: Weak Externals) Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D29892 llvm-svn: 308329
* [WebAssembly] Expose the offset of each data segmentSam Clegg2017-07-121-4/+6
| | | | | | | | | | | | | | Summary: This allows tools like lld that process relocations to apply data relocation correctly. This information is required because relocation are stored as section offset. Subscribers: jfb, dschuff, jgravelle-google, aheejin Differential Revision: https://reviews.llvm.org/D35234 llvm-svn: 307741
* Revert "Revert "Revert "Revert "Switch external cvtres.exe for llvm's own ↵Eric Beckmann2017-07-081-16/+9
| | | | | | | | | | | | | | | | | | | | resource library."""" This reverts commit 147f45ff24456aea59575fa4ac16c8fa554df46a. Revert "Revert "Revert "Revert "Replace trivial use of external rc.exe by writing our own .res file."""" This reverts commit 61a90a67ed54a1f0dfeab457b65abffa129569e4. The patches were intially reverted because they were causing a failure on CrWinClangLLD. Unfortunately, this was done haphazardly and didn't compile, so the revert was reverted again quickly to fix this. One that was done, the revert of the revert was itself reverted. This allowed me to finally fix the actual bug in r307452. This patch re-enables the code path that had originally been causing the bug, now that it (should) be fixed. llvm-svn: 307460
* Add name offset flags, for parity with cvtres.exe.Eric Beckmann2017-07-071-2/+2
| | | | | | | | | | | | | | | | | | | Summary: The original cvtres.exe sets the high bit when an identifier offset points to a string. Even though this is not mentioned in the spec, and in fact does not seem to cause errors with most cases, for some reason this causes a failure in Chromium where the new resource file is not verified as a new version. This patch sets this high bit flag, and also adds a test case to check that the output of our library is always identical to original cvtres. Reviewers: zturner, ruiu Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D35099 llvm-svn: 307452
* [WebAssembly] Support weak defined symbolsSam Clegg2017-07-071-10/+20
| | | | | | | | | | | | Model weakly defined symbols as symbols that are both exports and imported and marked as weak. Local references to the symbols refer to the import but the linker can resolve this to the weak export if not strong symbol is found at link time. Differential Revision: https://reviews.llvm.org/D35029 llvm-svn: 307348
* Revert "Revert "Revert "Switch external cvtres.exe for llvm's own resource ↵Eric Beckmann2017-07-051-1/+0
| | | | | | | | | | | | | | library.""" This reverts commit ae21ee0b6cacbc1efaf4d42502e71da2f0eb45c3. The initial revert was done in order to prevent ongoing errors on chromium bots such as CrWinClangLLD. However, this was done haphazardly and I didn't realize there were test and compilation failures, so this revert was reverted. Now that those have been fixed, we can revert the revert of the revert. llvm-svn: 307227
* Revert "Revert "Revert "Replace trivial use of external rc.exe by writing ↵Eric Beckmann2017-07-051-8/+16
| | | | | | | | | | | | | | our own .res file.""" This reverts commit 5fecbbbe5049665d86834cf69d8f75db4f392308. The initial revert was done in order to prevent ongoing errors on chromium bots such as CrWinClangLLD. However, this was done haphazardly and I didn't realize there were test and compilation failures, so this revert was reverted. Now that those have been fixed, we can revert the revert of the revert. llvm-svn: 307226
* Revert "Revert "Replace trivial use of external rc.exe by writing our own ↵Eric Beckmann2017-07-051-16/+8
| | | | | | | | .res file."" This reverts commit 8c8dce3b8f15d6ebaefc35ce88f15a85c8cdbd6e. llvm-svn: 307191
* Revert "Revert "Switch external cvtres.exe for llvm's own resource library.""Eric Beckmann2017-07-051-1/+2
| | | | | | | | This reverts commit 165e578e47f1cd38191120aad23a9020fb5476dd. Forgot to run tests on this. llvm-svn: 307190
* Revert "Switch external cvtres.exe for llvm's own resource library."Eric Beckmann2017-07-051-2/+1
| | | | | | | | | This reverts commit 600d52c278e123dd08bee24c1f00932b55add8de. This patch still seems to break CrWinClangLLD, reverting until I can find root problem. llvm-svn: 307189
* Revert "Replace trivial use of external rc.exe by writing our own .res file."Eric Beckmann2017-07-051-8/+16
| | | | | | | | | This patch still seems to break CrWinClangLLD, reverting this once more until I can discover root problem. This reverts commit 3dbbc8ce43be50ffde2b1c655c6d3a25796fe78b. llvm-svn: 307188
* Revert "Revert "Replace trivial use of external rc.exe by writing our own ↵Eric Beckmann2017-07-011-17/+8
| | | | | | | | | | | | | | | | | | .res file."" Summary: This reverts commit 51931072a7c9a52540baf76fc30ef391d2529a2f. This revert was originally done because the integrations of the new WindowsResource library into LLD was causing error in chromium, due to bugs in how resource sections were handled. These bugs were fixed, meaning that the features may be reintegrated. Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D34922 llvm-svn: 306941
* Fix bug in symbol generation for resource COFFEric Beckmann2017-06-301-1/+1
| | | | | | | | | | | | Symbols in the resource COFF file should be for .rsrc$02, where the actual resource data is, not .rsrc$01, which contains the directory tree. Differential Revision: https://reviews.llvm.org/D34832 Patch by Joe Ranieri. llvm-svn: 306853
* [llvm-readobj] Improve printouts for COFF ARM64 binariesMartin Storsjo2017-06-301-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D34835 llvm-svn: 306795
* Revert "Replace trivial use of external rc.exe by writing our own .res file."Eric Beckmann2017-06-291-8/+17
| | | | | | | | | | | | | | | This reverts commit d4c7e9fc63c10dbab0c30186ef8575474a704496. This is done in order to address the failure of CrWinClangLLD etc. bots. These throw an error of "side-by-side configuration is incorrect" during compilation, which sounds suspiciously related to these manifest changes. Revert "Switch external cvtres.exe for llvm's own resource library." This reverts commit 71fe8ef283a9dab9a3f21432c98466cbc23990d1. llvm-svn: 306618
* [COFF, ARM64] Add support for Windows ARM64 COFF formatMandeep Singh Grang2017-06-271-0/+23
| | | | | | | | | | | | | | | | Summary: This is the llvm part of the initial implementation to support Windows ARM64 COFF format. I will gradually add more functionality in subsequent patches. Reviewers: ruiu, rnk, t.p.northover, compnerd Reviewed By: ruiu, compnerd Subscribers: aemerson, mgorny, javed.absar, llvm-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D34705 llvm-svn: 306490
* Object: Teach irsymtab::read() to try to use the irsymtab that we wrote to disk.Peter Collingbourne2017-06-271-3/+27
| | | | | | | | Fixes PR27551. Differential Revision: https://reviews.llvm.org/D33974 llvm-svn: 306488
* Bitcode: Write the irsymtab to disk.Peter Collingbourne2017-06-271-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D33973 llvm-svn: 306487
* Object: Add version and producer fields to the irsymtab header. NFCI.Peter Collingbourne2017-06-271-0/+18
| | | | | | | | | These will be necessary in order to handle upgrades from old bitcode files. Differential Revision: https://reviews.llvm.org/D33972 llvm-svn: 306486
* [WebAssembly] Add support for printing relocations with llvm-objdumpSam Clegg2017-06-271-1/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D34658 llvm-svn: 306461
* [WebAssembly] Add data size and alignement to linking sectionSam Clegg2017-06-271-1/+10
| | | | | | | | | The overal size of the data section (including BSS) is otherwise not included in the wasm binary. Differential Revision: https://reviews.llvm.org/D34657 llvm-svn: 306459
* Replace trivial use of external rc.exe by writing our own .res file.Eric Beckmann2017-06-261-16/+8
| | | | | | | | | This patch removes the dependency on the external rc.exe tool by writing a simple .res file using our own library. In this patch I also added an explicit definition for the .res file magic. Furthermore, I added a unittest for embeded manifests and fixed a bug exposed by the test. llvm-svn: 306311
* Updated llvm-objdump symbolic disassembly with x86_64 Mach-O MH_KEXT_BUNDLEKevin Enderby2017-06-221-9/+30
| | | | | | | | | file types so it symbolically disassembles operands using the external relocation entries. rdar://31521343 llvm-svn: 306037
* [llvm-readobj] Dump the COFF image load configReid Kleckner2017-06-221-0/+20
| | | | | | | | This includes the safe SEH tables and the control flow guard function table. LLD will emit the guard table soon, and I need a tool that dumps them for testing. llvm-svn: 305979
OpenPOWER on IntegriCloud