From 33c4130e2601663463c777aefeedfdb0e5279226 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Wed, 9 Oct 2019 08:27:48 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374144 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../dsymutil/Inputs/private/tmp/common/com | Bin 4680 -> 0 bytes .../dsymutil/Inputs/private/tmp/common/com1.o | Bin 2104 -> 0 bytes .../dsymutil/Inputs/private/tmp/common/com2.o | Bin 2096 -> 0 bytes test/tools/dsymutil/X86/common-sym-multi.test | 39 ------------------ tools/dsymutil/MachODebugMapParser.cpp | 35 +--------------- 5 files changed, 2 insertions(+), 72 deletions(-) delete mode 100755 test/tools/dsymutil/Inputs/private/tmp/common/com delete mode 100644 test/tools/dsymutil/Inputs/private/tmp/common/com1.o delete mode 100644 test/tools/dsymutil/Inputs/private/tmp/common/com2.o delete mode 100644 test/tools/dsymutil/X86/common-sym-multi.test diff --git a/test/tools/dsymutil/Inputs/private/tmp/common/com b/test/tools/dsymutil/Inputs/private/tmp/common/com deleted file mode 100755 index 3aec9758a0cba31c7cd6e2b3e8493433ae550011..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4680 zcmeHL&ubG=5T0#PEVY<=@E3|MQp5^oHB=M?X{5narPltyQYer7*wTe=Qj(3fw_H4^ z2tA1CLCDdg{tX@kFa80Z1wlM|5fQ&{_dTbl07v9j8jQY7e|xRe81bIt=~wz0vX50}8pRCDQb+ zyypu*shRvzK4!yx2HsPD2)P28R)8;+nbx@Cy_&rS=W9z=-?b*3og_&9N z26kUvy6;7ONydrCI*qS~>8*)9a7UbJ7#QX#Py|1W{q;eS4)*=PJV1de1nWNp#Pfmv zlN^AT4U7R!tJ!ciy|Po?*{p(7jsvXYtM~o!c<$=8-RB?t%*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sS6<`n<{ diff --git a/test/tools/dsymutil/Inputs/private/tmp/common/com2.o b/test/tools/dsymutil/Inputs/private/tmp/common/com2.o deleted file mode 100644 index a22d1afd7db2d9d90d66f73886b6e76e6ab69a89..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2096 zcma)6OK%fF4EAgu4c)R01PKrb1t<~^(WIrc<=qI1QmH~!Ti!y$X0zKaN;a!xTV9t4 zBm{y(&m4e10OG_S;0JKw23I65NE|rvD)y|GhEPNtdF=7n-+F9M-hBP^vkO4P02kyq za+8)UGSX(`6z%^(0~Cn#jD4a#Vghjw9U@5?*f)Yu5BIa<7iL%Xk(OqK@CfoPB}cY6 zG)Y7xW!Ww*%*jSjS0*V>oi9wEj*cP1dBT>LoZoK;0IfyG{6ajlRI1yHl<%K-FWC7i z%QK1AXr-@;=Xy?!PTTPebt!Hi~x+-4Pv=n4J-W|qc0Xvfa%g^-viY+~} zYByHN?=AyfV3?g9;?+vmEDCAQ?;YdyG2ZPC@l<}kX|>}mx8XhQ5HGmtuX^8|Ty2N* zd;MQLt5(Il0=eK_cfGQdlczXTi6zF%vN6wn{SwXdU-M_rOQ(+A2m_@2^L@NzyfMa` zTA34N(E;Z9NQr2kE3T&y+w1q4@d_NYgm^^X|B)Z{O}(k!ZskYen~>wF@FIOE>8)cP zFooPo)T)SE?Vadniw`~&AF9Xka4df1wN){_x$L4{Z@4utJCN_kUv~F=5crM5x!jx^ z%rBJsu{F6$Wied#`}Nv2+X}J=h7UQ;pgB^uNAiwc9vwbl4IOmy19>YybZB&7*ep2* z%g*5F9>Dm)ehYGb-CZ;TI~P>_9NMZi4_t7)0H?b!JzcmcXC^L<%h`)l<5GfCtASW2 zb{UyO%t&wCVyqMEafq}bh#3=^6Ppj~M|2HK787D3gN54;6PXdbSfURdj_W#BE=j7c zA4j#TA1HooQ_P@10>Ev4Q7~6zIk82+<5eU4EIzE zssrKEZE4Jrs3v5hV>Y4IO6o0yPOWB$J}z!egSe3v>7K6C5<(HmR^^d^6UPpiGcOG?%yqSVPxUlu2}VKTpJxM>P$-(L}vOdF*m1 klOv%t6e>;`Zs|O^k0r(Q(!xXzxQ##SWrL*ImM-mn0dL3PRR910 diff --git a/test/tools/dsymutil/X86/common-sym-multi.test b/test/tools/dsymutil/X86/common-sym-multi.test deleted file mode 100644 index 008362e1c9d..00000000000 --- a/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/tools/dsymutil/MachODebugMapParser.cpp b/tools/dsymutil/MachODebugMapParser.cpp index 487fbfff50c..27379c232de 100644 --- a/tools/dsymutil/MachODebugMapParser.cpp +++ b/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 namespace { using namespace llvm; @@ -52,8 +51,6 @@ private: StringRef MainBinaryStrings; /// The constructed DebugMap. std::unique_ptr Result; - /// List of common symbols that need to be added to the debug map. - std::vector CommonSymbols; /// Map of the currently processed object file symbol addresses. StringMap> 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 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; - } } } -- 2.40.0