diff options
| author | Jeremy Morse <jeremy.morse.llvm@gmail.com> | 2019-10-09 08:27:48 +0000 |
|---|---|---|
| committer | Jeremy Morse <jeremy.morse.llvm@gmail.com> | 2019-10-09 08:27:48 +0000 |
| commit | e9c8f6fea6d6c7a18ce97768c4b457e85421d10c (patch) | |
| tree | 8395b864bd0066054dbb0f37ee9ef35a94b68f24 | |
| parent | 2caa3a265c53e303fedebc89d2bcc776ed6e6ff3 (diff) | |
| download | bcm5719-llvm-e9c8f6fea6d6c7a18ce97768c4b457e85421d10c.tar.gz bcm5719-llvm-e9c8f6fea6d6c7a18ce97768c4b457e85421d10c.zip | |
Revert r374139, "[dsymutil] Fix handling of common symbols in multiple object files."
The added test files ("com", "com1.o", "com2.o") are reserved names on
Windows, and makes 'git checkout' fail with a filesystem error.
llvm-svn: 374144
| -rwxr-xr-x | llvm/test/tools/dsymutil/Inputs/private/tmp/common/com | bin | 4680 -> 0 bytes | |||
| -rw-r--r-- | llvm/test/tools/dsymutil/Inputs/private/tmp/common/com1.o | bin | 2104 -> 0 bytes | |||
| -rw-r--r-- | llvm/test/tools/dsymutil/Inputs/private/tmp/common/com2.o | bin | 2096 -> 0 bytes | |||
| -rw-r--r-- | llvm/test/tools/dsymutil/X86/common-sym-multi.test | 39 | ||||
| -rw-r--r-- | llvm/tools/dsymutil/MachODebugMapParser.cpp | 35 |
5 files changed, 2 insertions, 72 deletions
diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/common/com b/llvm/test/tools/dsymutil/Inputs/private/tmp/common/com Binary files differdeleted file mode 100755 index 3aec9758a0c..00000000000 --- a/llvm/test/tools/dsymutil/Inputs/private/tmp/common/com +++ /dev/null diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/common/com1.o b/llvm/test/tools/dsymutil/Inputs/private/tmp/common/com1.o Binary files differdeleted file mode 100644 index 32c05ad662a..00000000000 --- a/llvm/test/tools/dsymutil/Inputs/private/tmp/common/com1.o +++ /dev/null diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/common/com2.o b/llvm/test/tools/dsymutil/Inputs/private/tmp/common/com2.o Binary files differdeleted file mode 100644 index a22d1afd7db..00000000000 --- a/llvm/test/tools/dsymutil/Inputs/private/tmp/common/com2.o +++ /dev/null diff --git a/llvm/test/tools/dsymutil/X86/common-sym-multi.test b/llvm/test/tools/dsymutil/X86/common-sym-multi.test deleted file mode 100644 index 008362e1c9d..00000000000 --- a/llvm/test/tools/dsymutil/X86/common-sym-multi.test +++ /dev/null @@ -1,39 +0,0 @@ -RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/common/com -f -o - | llvm-dwarfdump -debug-info - | FileCheck %s -RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/common/com -dump-debug-map | FileCheck %s --check-prefix DEBUGMAP - -The test was compiled from two source files: -$ cd /private/tmp/common -$ cat com1.c -int i[1000]; -int main() { - return i[1]; -} -$ cat com2.c -extern int i[1000]; -int bar() { - return i[0]; -} -$ clang -fcommon -g -c com1.c -o com1.o -$ clang -fcommon -g -c com2.c -o com2.o -$ clang -fcommon -g com1.o com2.o -o com - -CHECK: DW_TAG_compile_unit -CHECK: DW_TAG_variable -CHECK-NOT: {{NULL|DW_TAG}} -CHECK: DW_AT_name{{.*}}"i" -CHECK-NOT: {{NULL|DW_TAG}} -CHECK: DW_AT_location{{.*}}DW_OP_addr 0x100001000) - -CHECK: DW_TAG_compile_unit -CHECK: DW_TAG_variable -CHECK-NOT: {{NULL|DW_TAG}} -CHECK: DW_AT_name{{.*}}"i" -CHECK-NOT: {{NULL|DW_TAG}} -CHECK: DW_AT_location{{.*}}DW_OP_addr 0x100001000) - -DEBUGMAP: filename:{{.*}}com1.o -DEBUGMAP: symbols: -DEBUGMAP: sym: _i, binAddr: 0x0000000100001000, size: 0x00000000 -DEBUGMAP: filename:{{.*}}com2.o -DEBUGMAP: symbols: -DEBUGMAP: sym: _i, binAddr: 0x0000000100001000, size: 0x00000000 diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp index 487fbfff50c..27379c232de 100644 --- a/llvm/tools/dsymutil/MachODebugMapParser.cpp +++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp @@ -14,7 +14,6 @@ #include "llvm/Support/Path.h" #include "llvm/Support/WithColor.h" #include "llvm/Support/raw_ostream.h" -#include <vector> namespace { using namespace llvm; @@ -52,8 +51,6 @@ private: StringRef MainBinaryStrings; /// The constructed DebugMap. std::unique_ptr<DebugMap> Result; - /// List of common symbols that need to be added to the debug map. - std::vector<std::string> CommonSymbols; /// Map of the currently processed object file symbol addresses. StringMap<Optional<uint64_t>> CurrentObjectAddresses; @@ -84,8 +81,6 @@ private: STE.n_value); } - void addCommonSymbols(); - /// Dump the symbol table output header. void dumpSymTabHeader(raw_ostream &OS, StringRef Arch); @@ -127,32 +122,11 @@ void MachODebugMapParser::resetParserState() { CurrentDebugMapObject = nullptr; } -/// Commons symbols won't show up in the symbol map but might need to be -/// relocated. We can add them to the symbol table ourselves by combining the -/// information in the object file (the symbol name) and the main binary (the -/// address). -void MachODebugMapParser::addCommonSymbols() { - for (auto &CommonSymbol : CommonSymbols) { - uint64_t CommonAddr = getMainBinarySymbolAddress(CommonSymbol); - if (CommonAddr == 0) { - // The main binary doesn't have an address for the given symbol. - continue; - } - if (!CurrentDebugMapObject->addSymbol(CommonSymbol, None /*ObjectAddress*/, - CommonAddr, 0 /*size*/)) { - // The symbol is already present. - continue; - } - } - CommonSymbols.clear(); -} - /// Create a new DebugMapObject. This function resets the state of the /// parser that was referring to the last object file and sets /// everything up to add symbols to the new one. void MachODebugMapParser::switchToNewDebugMapObject( StringRef Filename, sys::TimePoint<std::chrono::seconds> Timestamp) { - addCommonSymbols(); resetParserState(); SmallString<80> Path(PathPrefix); @@ -492,15 +466,10 @@ void MachODebugMapParser::loadCurrentObjectFileSymbols( // relocations will use the symbol itself, and won't need an // object file address. The object file address field is optional // in the DebugMap, leave it unassigned for these symbols. - uint32_t Flags = Sym.getFlags(); - if (Flags & SymbolRef::SF_Absolute) { - CurrentObjectAddresses[*Name] = None; - } else if (Flags & SymbolRef::SF_Common) { + if (Sym.getFlags() & (SymbolRef::SF_Absolute | SymbolRef::SF_Common)) CurrentObjectAddresses[*Name] = None; - CommonSymbols.push_back(*Name); - } else { + else CurrentObjectAddresses[*Name] = Addr; - } } } |

