summaryrefslogtreecommitdiffstats
path: root/llvm/tools/dsymutil/DwarfLinker.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Replace "fallthrough" comments with LLVM_FALLTHROUGHJustin Bogner2016-08-171-1/+1
| | | | | | | This is a mechanical change of comments in switches like fallthrough, fall-through, or fall-thru to use the LLVM_FALLTHROUGH macro instead. llvm-svn: 278902
* MC] Provide an MCTargetOptions to implementors of MCAsmBackendCtorTy, NFCJoel Jones2016-07-251-1/+2
| | | | | | | | | | | | | | | Some targets, notably AArch64 for ILP32, have different relocation encodings based upon the ABI. This is an enabling change, so a future patch can use the ABIName from MCTargetOptions to chose which relocations to use. Tested using check-llvm. The corresponding change to clang is in: http://reviews.llvm.org/D16538 Patch by: Joel Jones Differential Revision: https://reviews.llvm.org/D16213 llvm-svn: 276654
* Fix r276380 for targets without REALPATH.Pete Cooper2016-07-221-1/+1
| | | | | | This was a mistake in the layout of the code from r276380. I moved the appropriate lines out of the #ifdef to fix it. llvm-svn: 276382
* Avoid dsymutil calls to getFileNameByIndex.Pete Cooper2016-07-221-5/+8
| | | | | | | | | | | | This change adds a hasFileAtIndex method. getChildDeclContext can first call this method, and if it returns true it knows it can then lookup the resolved path cache for the given file index. If we hit that cache then we don't even have to call getFileNameByIndex. Running dsymutil against the swift executable built from github gives a 20% performance improvement without any change in the binary. Differential Revision: https://reviews.llvm.org/D22655 Reviewed by friss. llvm-svn: 276380
* Apply most suggestions of clang-tidy's performance-unnecessary-value-paramBenjamin Kramer2016-06-081-4/+5
| | | | | | | Avoids unnecessary copies. All changes audited & pass tests with asan. No functional change intended. llvm-svn: 272190
* [MC] Rename EmitFill to emitFillPetr Hosek2016-06-011-1/+1
| | | | | | | | This is to match the overloaded variants as well as the new style. Differential Revision: http://reviews.llvm.org/D20690 llvm-svn: 271359
* dsymutil/modules: Reword the warning for static libraries without module cachesAdrian Prantl2016-05-201-3/+5
| | | | | | | | | | | | In addition to clarifying the warning message this contains a minor functional change in that it now warns if the *immediate* parent directory in which the missing PCM is expected to be isn't found. This patch also includes a more comprehensive testcase. rdar://problem/25860711 llvm-svn: 270269
* Delete Reloc::Default.Rafael Espindola2016-05-181-1/+2
| | | | | | | | | | | | Having an enum member named Default is quite confusing: Is it distinct from the others? This patch removes that member and instead uses Optional<Reloc> in places where we have a user input that still hasn't been maped to the default value, which is now clear has no be one of the remaining 3 options. llvm-svn: 269988
* Don't pass a Reloc::Model to MC.Rafael Espindola2016-05-181-2/+1
| | | | | | | | | | | | MC only needs to know if the output is PIC or not. It never has to decide about creating GOTs and PLTs for example. The only thing that MC itself uses this information for is expanding "macros" in sparc and mips. The rest I am pretty sure could be moved to CodeGen. This is a cleanup and isolates the code from future changes to Reloc::Model. llvm-svn: 269909
* dsymutil: Fix the DWOId mismatch check for cached modules.Adrian Prantl2016-05-131-5/+13
| | | | | | | | | | | | | | In verbose mode, we emit a warning if the DWOId of a skeleton CU mismatches the DWOId of the referenced module. This patch updates the cached DWOId after a module has been loaded to the DWOId of the module on disk (instead of storing the DWOId we expected to load). This allows us to correctly emit the mismatch warning for all subsequent object files that want to import the same module. This patch also ensures both warnings are only emitted in verbose mode. rdar://problem/26214027 llvm-svn: 269383
* dsymutil: Only warn about clang module DWO id mismatches in verbose mode.Adrian Prantl2016-04-251-1/+4
| | | | | | | | | | Until PR27449 (https://llvm.org/bugs/show_bug.cgi?id=27449) is fixed in clang this warning is pointless, since ASTFileSignatures will change randomly when a module is rebuilt. rdar://problem/25610919 llvm-svn: 267427
* Thread Expected<...> up from libObject’s getName() for symbols to allow ↵Kevin Enderby2016-04-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | llvm-objdump to produce a good error message. Produce another specific error message for a malformed Mach-O file when a symbol’s string index is past the end of the string table. The existing test case in test/Object/macho-invalid.test for macho-invalid-symbol-name-past-eof now reports the error with the message indicating that a symbol at a specific index has a bad sting index and that bad string index value. Again converting interfaces to Expected<> from ErrorOr<> does involve touching a number of places. Where the existing code reported the error with a string message or an error code it was converted to do the same. There is some code for this that could be factored into a routine but I would like to leave that for the code owners post-commit to do as they want for handling an llvm::Error. An example of how this could be done is shown in the diff in lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h which had a Check() routine already for std::error_code so I added one like it for llvm::Error . Also there some were bugs in the existing code that did not deal with the old ErrorOr<> return values.  So now with Expected<> since they must be checked and the error handled, I added a TODO and a comment: “// TODO: Actually report errors helpfully” and a call something like consumeError(NameOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error. Note there fixes needed to lld that goes along with this that I will commit right after this. So expect lld not to built after this commit and before the next one. llvm-svn: 266919
* Always cache resolved paths as it even saves on StringMap lookups.Pete Cooper2016-03-181-4/+2
| | | | | | | | | | | Now that the resolved path cache stores the StringRef's, its best to just always cache the results, even when realpath isn't used. This way we'll still avoid the StringMap hashing and lookup. This also conveniently reorganises this code in a way I need for a future patch. llvm-svn: 263777
* Use StringRef's in resolved path cache to avoid extra internString lookups. ↵Pete Cooper2016-03-181-11/+16
| | | | | | | | | | | | | | | | NFC. ResolvedPaths was storing std::string's as a cache. We would then take those strings and look them up in the internString pool to get a unique StringRef for each path. This patch changes ResolvedPaths to store the StringRef pointing in to the internString pool itself. This way, when getResolvedPath returns a string, we know we have the StringRef we would find in the pool anyway. We can avoid the duplicate memory of the std::string's, and also the time from the lookup. Unfortunately my profiles show no runtime change here, but it should still save memory allocations which is nice. Reviewed by Frederic Riss. Differential Revision: http://reviews.llvm.org/D18259 llvm-svn: 263774
* [dsymutil] Skip mach-o paired relocationsFrederic Riss2016-02-011-0/+34
| | | | | | | | | Noticed while working on scattered relocations. I do not think these relocs can actually happen in the debug_info section, but if they happen the code would mishandle them. Explicitely skip them and warn if we encounter one. llvm-svn: 259341
* [dsymutil] Support scattered relocs.Frederic Riss2016-02-011-2/+15
| | | | | | | | | | Although it seems like clang will never emit scattered relocations in the debug information (at least I couldn't find a way), we have too support them for the benefit of other compilers. As clang doesn't generate them, the included testcase was produced from hacked up assembly. llvm-svn: 259339
* [dsymutil] Allow debug map mappings with no object file address. NFCFrederic Riss2016-01-311-8/+10
| | | | | | | | | | | This change just changes the data structure that ties symbol names, object file address and linked binary addresses to accept mappings with no object file address. Such symbol mappings are not fed into the debug map yet, so this patch is NFC. A subsequent patch will make use of this functionality for common symbols. llvm-svn: 259317
* dsymutil: Provide better warnings when clang modules cannot be found.Adrian Prantl2016-01-141-1/+34
| | | | | | rdar://problem/22823264 llvm-svn: 257784
* dsymutil: Only warn about missing clang modules once.Adrian Prantl2016-01-131-3/+1
| | | | | | rdar://problem/22269336 llvm-svn: 257664
* [MC, COFF] Support link /incremental conditionallyDavid Majnemer2015-12-211-3/+6
| | | | | | | | | | | | | | | | Today, we always take into account the possibility that object files produced by MC may be consumed by an incremental linker. This results in us initialing fields which vary with time (TimeDateStamp) which harms hermetic builds (e.g. verifying a self-host went well) and produces sub-optimal code because we cannot assume anything about the relative position of functions within a section (call sites can get redirected through incremental linker thunks). Let's provide an MCTargetOption which controls this behavior so that we can disable this functionality if we know a-priori that the build will not rely on /incremental. llvm-svn: 256203
* fix 'the the '; NFCSanjay Patel2015-12-071-1/+1
| | | | llvm-svn: 254928
* Generalize ownership/passing semantics to allow dsymutil to own ↵David Blaikie2015-11-181-10/+6
| | | | | | | | | | | | | abbreviations via unique_ptr While still allowing CodeGen/AsmPrinter in llvm to own them using a bump ptr allocator. (might be nice to replace the pointers there with something that at least automatically calls their dtors, if that's necessary/useful, rather than having it done explicitly (I think a typed BumpPtrAllocator already does this, or maybe a unique_ptr with a custom deleter, etc)) llvm-svn: 253409
* dsymutil: Prune module forward decl DIEs if a uniquable definition wasAdrian Prantl2015-11-101-6/+18
| | | | | | | | | | already emitted and fix a latent bug in DIECloner where the DW_CHILDREN_yes flag is set based on the number of children in the input DIE rather than the number of children that are actually being cloned. rdar://problem/23439845 llvm-svn: 252649
* Test commit: fix typo in comment.Oleg Ranevskyy2015-10-231-1/+1
| | | | llvm-svn: 251122
* dsymutil: Don't prune forward declarations inside of an imported TAG_moduleAdrian Prantl2015-10-051-6/+11
| | | | | | | | if there exists not definition for the type. For this to work, we need to clone the imported modules before building the decl context chains of the DIEs in the non-skeleton CUs. llvm-svn: 249362
* dsymutil: Also ignore the ByteSize when building the DeclContext cache forAdrian Prantl2015-10-021-59/+54
| | | | | | | | clang modules. Forward decls of ObjC interfaces don't have a bytesize. llvm-svn: 249110
* dsymutil: Fix the condition to distinguish module imports form definitions.Adrian Prantl2015-09-241-1/+1
| | | | llvm-svn: 248512
* dsymutil: Don't prune forward declarations inside a module definition.Adrian Prantl2015-09-231-6/+9
| | | | llvm-svn: 248428
* dsymutil: Resolve forward decls for types defined in clang modules.Adrian Prantl2015-09-231-33/+91
| | | | | | | | | This patch extends llvm-dsymutil's ODR type uniquing machinery to also resolve forward decls for types defined in clang modules. http://reviews.llvm.org/D13038 llvm-svn: 248398
* dsymutil: print a warning when there is a module hash mismatch.Adrian Prantl2015-09-231-13/+34
| | | | | | | This also updates the module binaries in the test directory because their module hash mismatched. llvm-svn: 248396
* [dsymutil] Plug a memory leak.Benjamin Kramer2015-09-231-2/+2
| | | | llvm-svn: 248372
* dsymutil: Follow references to clang modules and recursively clone theAdrian Prantl2015-09-221-7/+135
| | | | | | | | debug info. This does not yet resolve external type references. llvm-svn: 248331
* dsymutil: Make resolveDIEReference and getUnitForOffset static functions.Adrian Prantl2015-09-221-16/+12
| | | | | | NFC. llvm-svn: 248311
* dsymutil: Make DwarfLinker::reportWarning() public. (NFC)Adrian Prantl2015-09-221-3/+3
| | | | llvm-svn: 248310
* Fix a typo.Adrian Prantl2015-09-221-4/+4
| | | | llvm-svn: 248283
* Revert r247692: Replace Triple with a new TargetTuple in MCTargetDesc/* and ↵Daniel Sanders2015-09-151-2/+2
| | | | | | | | related. NFC. Eric has replied and has demanded the patch be reverted. llvm-svn: 247702
* Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* ↵Daniel Sanders2015-09-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | and related. NFC. Summary: This is the first patch in the series to migrate Triple's (which are ambiguous) to TargetTuple's (which aren't). For the moment, TargetTuple simply passes all requests to the Triple object it holds. Once it has replaced Triple, it will start to implement the interface in a more suitable way. This change makes some changes to the public C++ API. In particular, InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer() now take TargetTuples instead of Triples. The other public C++ API's have been left as-is for the moment to reduce patch size. This commit also contains a trivial patch to clang to account for the C++ API change. Thanks go to Pavel Labath for fixing LLDB for me. Reviewers: rengolin Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin Differential Revision: http://reviews.llvm.org/D10969 llvm-svn: 247692
* Revert r247684 - Replace Triple with a new TargetTuple ...Daniel Sanders2015-09-151-2/+2
| | | | | | LLDB needs to be updated in the same commit. llvm-svn: 247686
* Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.Daniel Sanders2015-09-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first patch in the series to migrate Triple's (which are ambiguous) to TargetTuple's (which aren't). For the moment, TargetTuple simply passes all requests to the Triple object it holds. Once it has replaced Triple, it will start to implement the interface in a more suitable way. This change makes some changes to the public C++ API. In particular, InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer() now take TargetTuples instead of Triples. The other public C++ API's have been left as-is for the moment to reduce patch size. This commit also contains a trivial patch to clang to account for the C++ API change. Reviewers: rengolin Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin Differential Revision: http://reviews.llvm.org/D10969 llvm-svn: 247683
* dsymutil: Remove the now obsolete RelocMgr argument from cloneDIE. (NFC)Adrian Prantl2015-09-141-8/+6
| | | | llvm-svn: 247636
* dsymutil: Factor out the DIE cloning into a DIECloner class. (NFC)Adrian Prantl2015-09-141-161/+169
| | | | llvm-svn: 247577
* dsymutil: Factor out the relocation handling into a RelocationManager (NFC)Adrian Prantl2015-09-111-125/+176
| | | | llvm-svn: 247490
* [dsymutil] Discard useless location attributes.Frederic Riss2015-09-111-4/+68
| | | | | | | | | | | | | | When cloning the debug info for a function that hasn't been linked, strip the DIEs from all location attributes that wouldn't contain any meaningful information anyway. This kind of situation can happen when a function got discarded by the linker, but its debug information is still wanted in the final link because it was marked as required as some other DIE dependency. The easiest way to get into that situation is to have using directives. They get linked unconditionally, but their targets might not always be present. llvm-svn: 247386
* [dsymutil] Rename some variables NFC.Frederic Riss2015-09-111-11/+11
| | | | | | | lldb doesn't like having variables named as an existing type. In order to ease debugging, rename those variables to avoid that conflict. llvm-svn: 247385
* Reapply r246012 [dsymutil] Emit real dSYM companion binaries.Frederic Riss2015-09-021-3/+7
| | | | | | | | | | | | | | | | | | | | | | | With a fix for big endian machines. Thanks to Daniel Sanders for the debugging! Original commit message: The binaries containing the linked DWARF generated by dsymutil are not standard relocatable object files like emitted did previsously. They should be dSYM companion files, which means they have a different file type in the header, but also a couple other peculiarities: - they contain the segments and sections from the original binary in their load commands, but not the actual contents. This means they get an address and a size, but their offset is always 0 (but these are not virtual sections) - they also conatin all the defined symbols from the original binary This makes MC a really bad fit to emit these kind of binaries. The approach that was used in this patch is to leverage MC's section layout for the debug sections, but to use a replacement for MachObjectWriter that lives in MachOUtils.cpp. Some of the low-level helpers from MachObjectWriter were reused too. llvm-svn: 246673
* [dsymutil] Do not mistakenly reuse the current object file when the next one ↵Frederic Riss2015-08-311-1/+3
| | | | | | isn't found. llvm-svn: 246412
* [dsymutil] Do not crash on empty debug_range range.Frederic Riss2015-08-311-9/+11
| | | | | | | | | | The fix is trivial (The actual patch is 2 lines, but as it changes indentation it looks like more). clang does not produce this kind of (slightly bogus) debug info anymore, thus I had to rely on a hand-crafted assembly test to trigger that case. llvm-svn: 246410
* [dsymutil] Fix caching of current range. NFC.Frederic Riss2015-08-311-2/+3
| | | | | | | The current range cache will will just be hit more often, no visible external change. llvm-svn: 246409
* [dsymutil] Fix handling of inlined_subprogram low_pcsFrederic Riss2015-08-311-3/+14
| | | | | | | | | The value of an inlined subprogram low_pc attribute should not get relocated, but it can happen that it matches the enclosing function's start address and thus gets the generic treatment. Special case it to avoid applying the PC offset twice. llvm-svn: 246406
* Revert "[dsymutil] Emit real dSYM companion binaries."Frederic Riss2015-08-261-7/+3
| | | | | | | This reverts commit r246012. Some bots do not like it (mips/s390). llvm-svn: 246019
OpenPOWER on IntegriCloud