summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-cvtres] Add support for ARM64Martin Storsjo2017-11-101-14/+5
| | | | | | | | | | | Also change some default cases into llvm_unreachable in WindowsResourceCOFFWriter, to make it easier to find if they are triggerd from within e.g. lld, which supported ARM64 earlier than llvm-cvtres did. Differential Revision: https://reviews.llvm.org/D39892 llvm-svn: 317942
* Revert r317046, "Object: Move some code from ELF.h into ELF.cpp."Peter Collingbourne2017-11-031-263/+0
| | | | | | | This change resulted in a measured 1.5-2% perf regression linking chrome. llvm-svn: 317371
* Reland "Add support for writing 64-bit symbol tables for archives when ↵Jake Ehrlich2017-11-031-9/+55
| | | | | | | | | | | | | | | | | | offsets become too large for 32-bit" Tests were failing because some bots were running out of address space and memory. Additionally the test was very slow. These issues were solved by changing the test to take advantage of sparse filse and restricting the test to run only on 64-bit systems. This should fix https://bugs.llvm.org//show_bug.cgi?id=34189 This change makes it so that if writing a K_GNU style archive, you need to output a > 32-bit offset it should output in K_GNU64 style instead. Differential Revision: https://reviews.llvm.org/D36812 llvm-svn: 317352
* Fix warnings discovered by rL317076. [-Wunused-private-field]NAKAMURA Takumi2017-11-011-1/+1
| | | | llvm-svn: 317091
* Object: Move some code from ELF.h into ELF.cpp.Peter Collingbourne2017-10-311-0/+263
| | | | | | Differential Revision: https://reviews.llvm.org/D39271 llvm-svn: 317046
* Revert "Add support for writing 64-bit symbol tables for archives when ↵Jake Ehrlich2017-10-271-55/+9
| | | | | | | | offsets become too large for 32-bit" This reverts commit r316805. llvm-svn: 316813
* Add support for writing 64-bit symbol tables for archives when offsets ↵Jake Ehrlich2017-10-271-9/+55
| | | | | | | | | | | | | become too large for 32-bit This should fix https://bugs.llvm.org//show_bug.cgi?id=34189 This change makes it so that if writing a K_GNU style archive, you need to output a > 32-bit offset it should output in K_GNU64 style instead. Differential Revision: https://reviews.llvm.org/D36812 llvm-svn: 316805
* Make 32-bit member offset in Archive::Symbol::getMember 64-bitJake Ehrlich2017-10-271-1/+1
| | | | | | | | | | | | When accessing a member for a symbol with an offset greater than 2^32 - 1 the current Archive::Symbol::getMember implementation will overflow and cause unexpected behavior. This change simply fixes that. In particular if you call "llvm-nm --print-armap" on an archive that has this behavior you'll get an error. Differential Revision: https://reviews.llvm.org/D39379 llvm-svn: 316801
* ELF: Add support for emitting dynamic relocations in the Android relocation ↵Peter Collingbourne2017-10-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | packing format. The Android relocation packing format is a more compact format for dynamic relocations in executables and DSOs that is based on delta encoding and SLEBs. An overview of the format can be found in the Android source code: https://android.googlesource.com/platform/bionic/+/refs/heads/master/tools/relocation_packer/src/delta_encoder.h This patch implements relocation packing using that format. This implementation uses a more intelligent algorithm for compressing relative relocations than Android's own relocation packer. As a result it can generally create smaller relocation sections than that packer. If I link Chromium for Android targeting ARM32 I get a .rel.dyn of size 174693 bytes, as compared to 371832 bytes with gold and the Android packer. Differential Revision: https://reviews.llvm.org/D39152 llvm-svn: 316775
* [COFF] Support ordinals in def files with space between @ and the numberMartin Storsjo2017-10-261-3/+8
| | | | | | | | | | Both GNU ld and MS link.exe support declaring ordinals this way. A test will be added in lld. Differential Revision: https://reviews.llvm.org/D39327 llvm-svn: 316690
* llvm-readobj: Add support for reading relocations in the Android packed format.Peter Collingbourne2017-10-251-0/+90
| | | | | | | | | | | This is in preparation for testing lld's upcoming relocation packing feature (D39152). I have verified that this implementation correctly unpacks the relocations from a Chromium DSO built with gold and the Android relocation packer for ARM32 and ARM64. Differential Revision: https://reviews.llvm.org/D39272 llvm-svn: 316543
* [wasm] readSection: Avoid reading past eof (fixes oss-fuzz #3219)Vedant Kumar2017-10-231-3/+5
| | | | | | | | | | | | | A wasm file crafted with a bogus section size can trigger an ASan issue in the DWARFObjInMemory constructor. Nip the problem in the bud when we read the wasm section. Found by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3219 Differential Revision: https://reviews.llvm.org/D38777 llvm-svn: 316357
* [COFF] Improve the check for functions that should get an extra underscoreMartin Storsjo2017-10-231-3/+21
| | | | | | | | | | | This fixes exporting functions starting with an underscore, and fully decorated fastcall/vectorcall functions. Tests will be added in the lld repo. Differential Revision: https://reviews.llvm.org/D39168 llvm-svn: 316316
* Untabify.NAKAMURA Takumi2017-10-181-3/+3
| | | | llvm-svn: 316079
* Fix typo in checkTwoLevelHintsCommandJessica Paquette2017-10-171-1/+1
| | | | | | BigSize had a copy/paste typo in it. This fixes that. llvm-svn: 316027
* Revert "[ADT] Make Twine's copy constructor private."Zachary Turner2017-10-111-3/+2
| | | | | | | | | | This reverts commit 4e4ee1c507e2707bb3c208e1e1b6551c3015cbf5. This is failing due to some code that isn't built on MSVC so I didn't catch. Not immediately obvious how to fix this at first glance, so I'm reverting for now. llvm-svn: 315536
* [ADT] Make Twine's copy constructor private.Zachary Turner2017-10-111-2/+3
| | | | | | | | | | | | | | | | | There's a lot of misuse of Twine scattered around LLVM. This ranges in severity from benign (returning a Twine from a function by value that is just a string literal) to pretty sketchy (storing a Twine by value in a class). While there are some uses for copying Twines, most of the very compelling ones are confined to the Twine class implementation itself, and other uses are either dubious or easily worked around. This patch makes Twine's copy constructor private, and fixes up all callsites. Differential Revision: https://reviews.llvm.org/D38767 llvm-svn: 315530
* Convert the last uses of ErrorOr in include/llvm/Object.Rafael Espindola2017-10-112-12/+16
| | | | llvm-svn: 315483
* Convert the last uses of ErrorOr in COFF.h.Rafael Espindola2017-10-111-7/+6
| | | | llvm-svn: 315480
* Convert a couple of ErrorOr to Expected. NFC.Rafael Espindola2017-10-111-8/+10
| | | | llvm-svn: 315475
* Make the ELFObjectFile constructor private.Rafael Espindola2017-10-101-12/+14
| | | | | | | This forces every user to use the new create method that returns an Expected. This in turn propagates better error messages. llvm-svn: 315371
* Simplify. NFC.Rafael Espindola2017-10-101-4/+4
| | | | llvm-svn: 315364
* Convert two uses of ErrorOr to Expected.Rafael Espindola2017-10-103-10/+10
| | | | llvm-svn: 315354
* Pre-compute the tail of the archiveRafael Espindola2017-10-031-177/+184
| | | | | | | | | | | | | | | | | | | | | | | | An archive looks like <header> <symbol table> <tail> The symbol table refers to offsets in the tail. A complication is that we would like to support symbol tables that use 64 bit offsets if it turns out that any of the offsets is too big. This patch changes the archive writer to first compute the tail. We cannot just compute one big StringRef since that would require reading every member upfront, but we can represent it as a series of StringRefs. Having done that it is much easier to compute the symbol table and all offsets are computed before it is written. With this if there is an accounting problem it will show up with a regular symbol table, not just when a 64 bit one is needed. llvm-svn: 314844
* [WebAssembly] Allow each data segment to specify its own alignmentSam Clegg2017-09-291-6/+7
| | | | | | | | | Also, add a flags field as we will almost certainly be needing that soon too. Differential Revision: https://reviews.llvm.org/D38296 llvm-svn: 314534
* [WebAssembly] Model weakly defined symbols as wasm exportsSam Clegg2017-09-261-13/+5
| | | | | | | | | | | | | Previously these were being included as both imports and exports, with the import being satisfied by the export (or some strong symbol) at runtime. However proved unnecessary and actually complicated linking as it meant there was not a 1-to-1 mapping between a wasm function /global index and a linker symbol. Differential Revision: https://reviews.llvm.org/D38246 llvm-svn: 314245
* [WebAssembly] Use function/global index space in WasmSymbolSam Clegg2017-09-261-11/+9
| | | | | | | | | | | | | | | | | | | It is useful for the symbol to contain the index of the function of global it represents in the function/global index space. For imports we also store the import index so that the linker can find, for example, the signature of the corresponding function, which is defined by the import In the long run we need to decide whether this API surface should be closer to binary (where imported functions are seperate) or the wasm spec (where the function index space is unified). Differential Revision: https://reviews.llvm.org/D38189 llvm-svn: 314230
* [dwarfdump] Skip 'stripped' sectionsJonas Devlieghere2017-09-262-0/+8
| | | | | | | | | | | | | | | | | | | When dsymutil generates the companion file, its strips all unnecessary sections by omitting their body and setting the offset in their corresponding load command to zero. One such section is the .eh_frame section, as it contains runtime information rather than debug information and is part of the __TEXT segment. When reading this section, we would just read the number of bytes specified in the load command, starting from offset 0 (i.e. the beginning of the file). Rather than trying to parse this obviously invalid section, dwarfdump now skips this. Differential revision: https://reviews.llvm.org/D38135 llvm-svn: 314208
* [Support] Rename tool_output_file to ToolOutputFile, NFCReid Kleckner2017-09-231-1/+1
| | | | | | | This class isn't similar to anything from the STL, so it shouldn't use the STL naming conventions. llvm-svn: 314050
* Move code to a helper function. NFC.Rafael Espindola2017-09-221-7/+13
| | | | | | Part of a patch by Jake Ehrlich! llvm-svn: 314012
* llvm-ar: align the first archive member consistently.Rafael Espindola2017-09-221-3/+5
| | | | | | | Before we were aligning the member after the symbol table to 4 but other members to 8. llvm-svn: 314010
* llvm-ar: Don't add an unnecessary alignment in gnu mode.Rafael Espindola2017-09-221-1/+2
| | | | | | | This is mostly for getting stricter testing in preparation for future changes. llvm-svn: 314000
* Convert the archive writer to use Error.Rafael Espindola2017-09-212-19/+18
| | | | | | This found one place in lld that was not checking the error. llvm-svn: 313937
* Use raw_ostream in functions that don't need to seek. NFC.Rafael Espindola2017-09-211-5/+5
| | | | llvm-svn: 313935
* Simplify the logic for truncating UID and GID. NFC.Rafael Espindola2017-09-211-12/+9
| | | | llvm-svn: 313933
* Use ArrayRef. NFC.Rafael Espindola2017-09-211-1/+1
| | | | llvm-svn: 313895
* [WebAssembly] Weak symbols should be defined in SF_GlobalSam Clegg2017-09-201-1/+1
| | | | | | | | | | | | Summary: This manifested itself in lld since it meant that weak symbols were not appearing in archive symbol tables. Subscribers: jfb, dschuff, jgravelle-google, aheejin Differential Revision: https://reviews.llvm.org/D38111 llvm-svn: 313838
* [WebAssembly] Add support for local symbol bindingsSam Clegg2017-09-201-5/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D38096 llvm-svn: 313817
* Reland "[WebAssembly] Add support for naming wasm data segments"Sam Clegg2017-09-201-0/+9
| | | | | | | | | Add adds support for naming data segments. This is useful useful linkers so that they can merge similar sections. Differential Revision: https://reviews.llvm.org/D37886 llvm-svn: 313795
* Rename K_MIPS64 to K_GNU64Jake Ehrlich2017-09-202-9/+9
| | | | | | | This patch renames K_MIPS64 to K_GNU64 as part of a change to add support for writing archives with 64-bit indexes in the symbol table. llvm-svn: 313787
* Reverting due to Green Dragon bot failure.Mike Edwards2017-09-201-9/+0
| | | | | | http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/42594/ llvm-svn: 313706
* [WebAssembly] Add support for naming wasm data segmentsSam Clegg2017-09-191-0/+9
| | | | | | | | | Add adds support for naming data segments. This is useful useful linkers so that they can merge similar sections. Differential Revision: https://reviews.llvm.org/D37886 llvm-svn: 313692
* Allow public Triple deduction from ObjectFiles.Vlad Tsyrklevich2017-09-191-0/+25
| | | | | | | | | | | | | | | Move logic that allows for Triple deduction from an ObjectFile object out of llvm-objdump.cpp into a public factory, found in the ObjectFile class. This should allow other tools in the future to use this logic without reimplementation. Patch by Mitch Phillips Differential Revision: https://reviews.llvm.org/D37719 llvm-svn: 313605
* [MachO] Prevent heap overflow when load command extends past EOFJonas Devlieghere2017-09-131-1/+4
| | | | | | | | | | | This patch fixes a heap-buffer-overflow when a malformed Mach-O has a load command who's size extends past the end of the binary. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3225 Differential revision: https://reviews.llvm.org/D37439 llvm-svn: 313145
* [ARC] Prepare the implementation of relocation for LLDLeslie Zhai2017-09-131-0/+8
| | | | | | | | | | | | Reviewers: ruiu, kparzysz, petecoup, rafael Reviewed By: kparzysz Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37556 llvm-svn: 313109
* Object: Downgrade invalid weak externals from an assert fail to an ↵Peter Collingbourne2017-09-071-3/+6
| | | | | | | | llvm::Error when creating an irsymtab. This fixes bitcode emission for modules containing invalid weak externals. llvm-svn: 312686
* [WebAssembly] Only treat imports/exports as symbols when reading relocatable ↵Sam Clegg2017-09-061-33/+67
| | | | | | | | | | | | | | | | | | | object files This change only treats imported and exports functions and globals as symbol table entries the object has a "linking" section (i.e. it is relocatable object file). In this case all globals must be of type I32 and initialized with i32.const. This was previously being assumed but not checked for and was causing a failure on big endian machines due to using the wrong value of then union. See: https://bugs.llvm.org/show_bug.cgi?id=34487 Differential Revision: https://reviews.llvm.org/D37497 llvm-svn: 312674
* Revert "[Decompression] Fail gracefully when out of memory"Vedant Kumar2017-09-051-11/+3
| | | | | | | | | | | | | This reverts commit r312526. Revert "Fix test/DebugInfo/dwarfdump-decompression-invalid-size.test" This reverts commit r312527. It causes an ASan failure: http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_check/4150 llvm-svn: 312582
* [Decompression] Fail gracefully when out of memoryJonas Devlieghere2017-09-051-3/+11
| | | | | | | | | | | | This patch adds failing gracefully when running out of memory when allocating a buffer for decompression. This provides a work-around for: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3224 Differential revision: https://reviews.llvm.org/D37447 llvm-svn: 312526
* [WebAssembly] Update relocation names to match specSam Clegg2017-09-011-3/+3
| | | | | | | | Summary: See https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md Differential Revision: https://reviews.llvm.org/D37385 llvm-svn: 312342
OpenPOWER on IntegriCloud