From fb939bec253e73f395f679b54357709fc8227ea7 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 18 Apr 2024 19:48:58 +0000 Subject: [PATCH] Bug 1892128 - Simplify the llvm-symbolizer patch for bug 1798613. r=firefox-build-system-reviewers,sergesanspaille Reverting the entire commit that is causing problems has caused a number of conflicts with further changes in LLVM in the past year and a half, making us have to revert a bunch of other patches. Instead of doing that, we just revert the small part of the original change that is causing the problem, avoiding conflicts with newer changes. This also gives us a better hint at what's really going on. Differential Revision: https://phabricator.services.mozilla.com/D207829 --- build/build-clang/llvm-symbolizer-17.json | 4 +- build/build-clang/llvm-symbolizer-18.json | 4 +- build/build-clang/llvm-symbolizer-trunk.json | 11 +- ...-llvmorg-15-init-11205-gcead4eceb01b.patch | 35 + ...15-init-11205-gcead4eceb01b_clang_18.patch | 35 + ...-llvmorg-17-init-17713-gc8e055d485ea.patch | 33 - ...15-init-11205-gcead4eceb01b_clang_16.patch | 1027 ------- ...15-init-11205-gcead4eceb01b_clang_18.patch | 972 ------ ...t-llvmorg-17-init-4120-g02e8eb1a438b.patch | 118 - ...-17-init-4120-g02e8eb1a438b_clang_18.patch | 115 - ...t-llvmorg-19-init-6891-ga4de589d117a.patch | 547 ---- ...t-llvmorg-19-init-6898-g60deb8b39afe.patch | 66 - ...t-llvmorg-19-init-6902-gbdb60e6f0c8e.patch | 24 - ...t-llvmorg-19-init-7044-g30fd099d5062.patch | 58 - ...t-llvmorg-19-init-7501-g27b2d7d4bb79.patch | 2696 ----------------- ...t-llvmorg-19-init-7619-gf139387fb6e7.patch | 29 - ...t-llvmorg-19-init-7807-gf04452de1986.patch | 273 -- 17 files changed, 73 insertions(+), 5974 deletions(-) create mode 100644 build/build-clang/partial-revert-llvmorg-15-init-11205-gcead4eceb01b.patch create mode 100644 build/build-clang/partial-revert-llvmorg-15-init-11205-gcead4eceb01b_clang_18.patch delete mode 100644 build/build-clang/partial-revert-llvmorg-17-init-17713-gc8e055d485ea.patch delete mode 100644 build/build-clang/revert-llvmorg-15-init-11205-gcead4eceb01b_clang_16.patch delete mode 100644 build/build-clang/revert-llvmorg-15-init-11205-gcead4eceb01b_clang_18.patch delete mode 100644 build/build-clang/revert-llvmorg-17-init-4120-g02e8eb1a438b.patch delete mode 100644 build/build-clang/revert-llvmorg-17-init-4120-g02e8eb1a438b_clang_18.patch delete mode 100644 build/build-clang/revert-llvmorg-19-init-6891-ga4de589d117a.patch delete mode 100644 build/build-clang/revert-llvmorg-19-init-6898-g60deb8b39afe.patch delete mode 100644 build/build-clang/revert-llvmorg-19-init-6902-gbdb60e6f0c8e.patch delete mode 100644 build/build-clang/revert-llvmorg-19-init-7044-g30fd099d5062.patch delete mode 100644 build/build-clang/revert-llvmorg-19-init-7501-g27b2d7d4bb79.patch delete mode 100644 build/build-clang/revert-llvmorg-19-init-7619-gf139387fb6e7.patch delete mode 100644 build/build-clang/revert-llvmorg-19-init-7807-gf04452de1986.patch diff --git a/build/build-clang/llvm-symbolizer-17.json b/build/build-clang/llvm-symbolizer-17.json index 211c613d3db0..b33b2081c57e 100644 --- a/build/build-clang/llvm-symbolizer-17.json +++ b/build/build-clang/llvm-symbolizer-17.json @@ -1,7 +1,5 @@ { "patches": [ - "partial-revert-llvmorg-17-init-17713-gc8e055d485ea.patch", - "revert-llvmorg-17-init-4120-g02e8eb1a438b.patch", - "revert-llvmorg-15-init-11205-gcead4eceb01b_clang_16.patch" + "partial-revert-llvmorg-15-init-11205-gcead4eceb01b.patch" ] } diff --git a/build/build-clang/llvm-symbolizer-18.json b/build/build-clang/llvm-symbolizer-18.json index 357eab9792ac..1afe63ef95f3 100644 --- a/build/build-clang/llvm-symbolizer-18.json +++ b/build/build-clang/llvm-symbolizer-18.json @@ -1,7 +1,5 @@ { "patches": [ - "partial-revert-llvmorg-17-init-17713-gc8e055d485ea.patch", - "revert-llvmorg-17-init-4120-g02e8eb1a438b.patch", - "revert-llvmorg-15-init-11205-gcead4eceb01b_clang_18.patch" + "partial-revert-llvmorg-15-init-11205-gcead4eceb01b_clang_18.patch" ] } diff --git a/build/build-clang/llvm-symbolizer-trunk.json b/build/build-clang/llvm-symbolizer-trunk.json index 5d0f0170f815..1afe63ef95f3 100644 --- a/build/build-clang/llvm-symbolizer-trunk.json +++ b/build/build-clang/llvm-symbolizer-trunk.json @@ -1,14 +1,5 @@ { "patches": [ - "revert-llvmorg-19-init-7807-gf04452de1986.patch", - "revert-llvmorg-19-init-7619-gf139387fb6e7.patch", - "revert-llvmorg-19-init-7501-g27b2d7d4bb79.patch", - "revert-llvmorg-19-init-7044-g30fd099d5062.patch", - "revert-llvmorg-19-init-6902-gbdb60e6f0c8e.patch", - "revert-llvmorg-19-init-6898-g60deb8b39afe.patch", - "revert-llvmorg-19-init-6891-ga4de589d117a.patch", - "partial-revert-llvmorg-17-init-17713-gc8e055d485ea.patch", - "revert-llvmorg-17-init-4120-g02e8eb1a438b.patch", - "revert-llvmorg-15-init-11205-gcead4eceb01b_clang_18.patch" + "partial-revert-llvmorg-15-init-11205-gcead4eceb01b_clang_18.patch" ] } diff --git a/build/build-clang/partial-revert-llvmorg-15-init-11205-gcead4eceb01b.patch b/build/build-clang/partial-revert-llvmorg-15-init-11205-gcead4eceb01b.patch new file mode 100644 index 000000000000..85621ab4507b --- /dev/null +++ b/build/build-clang/partial-revert-llvmorg-15-init-11205-gcead4eceb01b.patch @@ -0,0 +1,35 @@ +This partially reverts commit cead4eceb01b935fae07bf4a7e91911b344d2fec for +causing timeouts on some webrtc tests under TSan (bug 1798613), presumably +because the change made llvm-symbolizer too slow. + +diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +index 33168abbdc38..7729d2b91c8a 100644 +--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp ++++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +@@ -1173,25 +1173,7 @@ DWARFCompileUnit *DWARFContext::getCompileUnitForCodeAddress(uint64_t Address) { + + DWARFCompileUnit *DWARFContext::getCompileUnitForDataAddress(uint64_t Address) { + uint64_t CUOffset = getDebugAranges()->findAddress(Address); +- if (DWARFCompileUnit *OffsetCU = getCompileUnitForOffset(CUOffset)) +- return OffsetCU; +- +- // Global variables are often missed by the above search, for one of two +- // reasons: +- // 1. .debug_aranges may not include global variables. On clang, it seems we +- // put the globals in the aranges, but this isn't true for gcc. +- // 2. Even if the global variable is in a .debug_arange, global variables +- // may not be captured in the [start, end) addresses described by the +- // parent compile unit. +- // +- // So, we walk the CU's and their child DI's manually, looking for the +- // specific global variable. +- for (std::unique_ptr &CU : compile_units()) { +- if (DWARFDie Die = CU->getVariableForAddress(Address)) { +- return static_cast(CU.get()); +- } +- } +- return nullptr; ++ return getCompileUnitForOffset(CUOffset); + } + + DWARFContext::DIEsForAddress DWARFContext::getDIEsForAddress(uint64_t Address) { diff --git a/build/build-clang/partial-revert-llvmorg-15-init-11205-gcead4eceb01b_clang_18.patch b/build/build-clang/partial-revert-llvmorg-15-init-11205-gcead4eceb01b_clang_18.patch new file mode 100644 index 000000000000..457120e78d21 --- /dev/null +++ b/build/build-clang/partial-revert-llvmorg-15-init-11205-gcead4eceb01b_clang_18.patch @@ -0,0 +1,35 @@ +This partially reverts commit cead4eceb01b935fae07bf4a7e91911b344d2fec for +causing timeouts on some webrtc tests under TSan (bug 1798613), presumably +because the change made llvm-symbolizer too slow. + +diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +index 792df53d304a..75692d56ee55 100644 +--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp ++++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +@@ -1520,25 +1520,7 @@ DWARFCompileUnit *DWARFContext::getCompileUnitForCodeAddress(uint64_t Address) { + + DWARFCompileUnit *DWARFContext::getCompileUnitForDataAddress(uint64_t Address) { + uint64_t CUOffset = getDebugAranges()->findAddress(Address); +- if (DWARFCompileUnit *OffsetCU = getCompileUnitForOffset(CUOffset)) +- return OffsetCU; +- +- // Global variables are often missed by the above search, for one of two +- // reasons: +- // 1. .debug_aranges may not include global variables. On clang, it seems we +- // put the globals in the aranges, but this isn't true for gcc. +- // 2. Even if the global variable is in a .debug_arange, global variables +- // may not be captured in the [start, end) addresses described by the +- // parent compile unit. +- // +- // So, we walk the CU's and their child DI's manually, looking for the +- // specific global variable. +- for (std::unique_ptr &CU : compile_units()) { +- if (CU->getVariableForAddress(Address)) { +- return static_cast(CU.get()); +- } +- } +- return nullptr; ++ return getCompileUnitForOffset(CUOffset); + } + + DWARFContext::DIEsForAddress DWARFContext::getDIEsForAddress(uint64_t Address, diff --git a/build/build-clang/partial-revert-llvmorg-17-init-17713-gc8e055d485ea.patch b/build/build-clang/partial-revert-llvmorg-17-init-17713-gc8e055d485ea.patch deleted file mode 100644 index 96ac98838086..000000000000 --- a/build/build-clang/partial-revert-llvmorg-17-init-17713-gc8e055d485ea.patch +++ /dev/null @@ -1,33 +0,0 @@ -Revert the parts of c8e055d485eabf1c8830d77797e3686ced0f7754 that require -cead4eceb01b935fae07bf4a7e91911b344d2fec, which we revert. - -diff --git a/llvm/include/llvm/DebugInfo/BTF/BTFContext.h b/llvm/include/llvm/DebugInfo/BTF/BTFContext.h -index c16bee613322..7b0412b91c2e 100644 ---- a/llvm/include/llvm/DebugInfo/BTF/BTFContext.h -+++ b/llvm/include/llvm/DebugInfo/BTF/BTFContext.h -@@ -34,9 +34,6 @@ public: - object::SectionedAddress Address, - DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; - -- DILineInfo -- getLineInfoForDataAddress(object::SectionedAddress Address) override; -- - DILineInfoTable getLineInfoForAddressRange( - object::SectionedAddress Address, uint64_t Size, - DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; -diff --git a/llvm/lib/DebugInfo/BTF/BTFContext.cpp b/llvm/lib/DebugInfo/BTF/BTFContext.cpp -index 24898739b824..da0f9982881f 100644 ---- a/llvm/lib/DebugInfo/BTF/BTFContext.cpp -+++ b/llvm/lib/DebugInfo/BTF/BTFContext.cpp -@@ -34,11 +34,6 @@ DILineInfo BTFContext::getLineInfoForAddress(SectionedAddress Address, - return Result; - } - --DILineInfo BTFContext::getLineInfoForDataAddress(SectionedAddress Address) { -- // BTF does not convey such information. -- return {}; --} -- - DILineInfoTable - BTFContext::getLineInfoForAddressRange(SectionedAddress Address, uint64_t Size, - DILineInfoSpecifier Specifier) { diff --git a/build/build-clang/revert-llvmorg-15-init-11205-gcead4eceb01b_clang_16.patch b/build/build-clang/revert-llvmorg-15-init-11205-gcead4eceb01b_clang_16.patch deleted file mode 100644 index 93c7e7d7673b..000000000000 --- a/build/build-clang/revert-llvmorg-15-init-11205-gcead4eceb01b_clang_16.patch +++ /dev/null @@ -1,1027 +0,0 @@ -From cb411520cb7cd5e6e25966911ca55feb5de779e0 Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Fri, 4 Nov 2022 14:51:38 +0900 -Subject: [PATCH] Revert "[symbolizer] Parse DW_TAG_variable DIs to show line - info for globals" - -This reverts commit cead4eceb01b935fae07bf4a7e91911b344d2fec for causing -yet unidentified problems on some webrtc tests under TSan (bug 1798613). ---- - llvm/include/llvm/DebugInfo/DIContext.h | 4 - - .../llvm/DebugInfo/DWARF/DWARFContext.h | 2 - - llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h | 7 - - llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h | 14 - - llvm/include/llvm/DebugInfo/PDB/PDBContext.h | 2 - - llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 97 ++-- - llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 60 --- - llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 97 ---- - llvm/lib/DebugInfo/PDB/PDBContext.cpp | 7 - - llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp | 4 - - .../Symbolize/SymbolizableObjectFile.cpp | 8 - - .../Symbolize/ELF/data-command-symtab.yaml | 3 - - .../tools/llvm-symbolizer/data-location.yaml | 450 ------------------ - llvm/test/tools/llvm-symbolizer/data.s | 3 - - 14 files changed, 61 insertions(+), 697 deletions(-) - delete mode 100644 llvm/test/tools/llvm-symbolizer/data-location.yaml - -diff --git a/llvm/include/llvm/DebugInfo/DIContext.h b/llvm/include/llvm/DebugInfo/DIContext.h -index 9b278b696073..a9f98588cf2d 100644 ---- a/llvm/include/llvm/DebugInfo/DIContext.h -+++ b/llvm/include/llvm/DebugInfo/DIContext.h -@@ -114,8 +114,6 @@ struct DIGlobal { - std::string Name; - uint64_t Start = 0; - uint64_t Size = 0; -- std::string DeclFile; -- uint64_t DeclLine = 0; - - DIGlobal() : Name(DILineInfo::BadString) {} - }; -@@ -241,8 +239,6 @@ public: - virtual DILineInfo getLineInfoForAddress( - object::SectionedAddress Address, - DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0; -- virtual DILineInfo -- getLineInfoForDataAddress(object::SectionedAddress Address) = 0; - virtual DILineInfoTable getLineInfoForAddressRange( - object::SectionedAddress Address, uint64_t Size, - DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0; -diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h -index bf591ed554c6..3365ef8d8ee3 100644 ---- a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h -+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h -@@ -364,8 +364,6 @@ public: - DILineInfo getLineInfoForAddress( - object::SectionedAddress Address, - DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; -- DILineInfo -- getLineInfoForDataAddress(object::SectionedAddress Address) override; - DILineInfoTable getLineInfoForAddressRange( - object::SectionedAddress Address, uint64_t Size, - DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; -diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h -index 149c5ef4e493..4a4d105a2b23 100644 ---- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h -+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h -@@ -280,13 +280,6 @@ public: - /// \returns an iterator range for the attributes of the current DIE. - iterator_range attributes() const; - -- /// Gets the type size (in bytes) for this DIE. -- /// -- /// \param PointerSize the pointer size of the containing CU. -- /// \returns if this is a type DIE, or this DIE contains a DW_AT_type, returns -- /// the size of the type. -- std::optional getTypeSize(uint64_t PointerSize); -- - class iterator; - - iterator begin() const; -diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h -index 9188865b4d77..0341344bc7b8 100644 ---- a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h -+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h -@@ -9,7 +9,6 @@ - #ifndef LLVM_DEBUGINFO_DWARF_DWARFUNIT_H - #define LLVM_DEBUGINFO_DWARF_DWARFUNIT_H - --#include "llvm/ADT/DenseSet.h" - #include "llvm/ADT/STLExtras.h" - #include "llvm/ADT/SmallVector.h" - #include "llvm/ADT/StringRef.h" -@@ -28,7 +27,6 @@ - #include - #include - #include --#include - #include - #include - -@@ -242,11 +240,6 @@ class DWARFUnit { - /// std::map::upper_bound for address range lookup. - std::map> AddrDieMap; - -- /// Map from the location (interpreted DW_AT_location) of a DW_TAG_variable, -- /// to the end address and the corresponding DIE. -- std::map> VariableDieMap; -- DenseSet RootsParsedForVariables; -- - using die_iterator_range = - iterator_range::iterator>; - -@@ -329,9 +322,6 @@ public: - /// Recursively update address to Die map. - void updateAddressDieMap(DWARFDie Die); - -- /// Recursively update address to variable Die map. -- void updateVariableDieMap(DWARFDie Die); -- - void setRangesSection(const DWARFSection *RS, uint64_t Base) { - RangeSection = RS; - RangeSectionBase = Base; -@@ -446,10 +436,6 @@ public: - /// cleared. - DWARFDie getSubroutineForAddress(uint64_t Address); - -- /// Returns variable DIE for the address provided. The pointer is alive as -- /// long as parsed compile unit DIEs are not cleared. -- DWARFDie getVariableForAddress(uint64_t Address); -- - /// getInlinedChainForAddress - fetches inlined chain for a given address. - /// Returns empty chain if there is no subprogram containing address. The - /// chain is valid as long as parsed compile unit DIEs are not cleared. -diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBContext.h b/llvm/include/llvm/DebugInfo/PDB/PDBContext.h -index 3163c0a1dae0..7b6793f0a639 100644 ---- a/llvm/include/llvm/DebugInfo/PDB/PDBContext.h -+++ b/llvm/include/llvm/DebugInfo/PDB/PDBContext.h -@@ -45,8 +45,6 @@ namespace pdb { - DILineInfo getLineInfoForAddress( - object::SectionedAddress Address, - DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; -- DILineInfo -- getLineInfoForDataAddress(object::SectionedAddress Address) override; - DILineInfoTable getLineInfoForAddressRange( - object::SectionedAddress Address, uint64_t Size, - DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; -diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp -index 19d7d659a86a..1bcfdecfd588 100644 ---- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp -+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp -@@ -1053,25 +1053,7 @@ DWARFCompileUnit *DWARFContext::getCompileUnitForAddress(uint64_t Address) { - // First, get the offset of the compile unit. - uint64_t CUOffset = getDebugAranges()->findAddress(Address); - // Retrieve the compile unit. -- if (DWARFCompileUnit *OffsetCU = getCompileUnitForOffset(CUOffset)) -- return OffsetCU; -- -- // Global variables are often not found by the above search, for one of two -- // reasons: -- // 1. .debug_aranges may not include global variables. On clang, it seems we -- // put the globals in the aranges, but this isn't true for gcc. -- // 2. Even if the global variable is in a .debug_arange, global variables -- // may not be captured in the [start, end) addresses described by the -- // parent compile unit. -- // -- // So, we walk the CU's and their child DI's manually, looking for the -- // specific global variable. -- for (std::unique_ptr &CU : compile_units()) { -- if (DWARFDie Die = CU->getVariableForAddress(Address)) { -- return static_cast(CU.get()); -- } -- } -- return nullptr; -+ return getCompileUnitForOffset(CUOffset); - } - - DWARFContext::DIEsForAddress DWARFContext::getDIEsForAddress(uint64_t Address) { -@@ -1141,6 +1123,64 @@ static bool getFunctionNameAndStartLineForAddress( - return FoundResult; - } - -+static std::optional getTypeSize(DWARFDie Type, uint64_t PointerSize) { -+ if (auto SizeAttr = Type.find(DW_AT_byte_size)) -+ if (std::optional Size = SizeAttr->getAsUnsignedConstant()) -+ return Size; -+ -+ switch (Type.getTag()) { -+ case DW_TAG_pointer_type: -+ case DW_TAG_reference_type: -+ case DW_TAG_rvalue_reference_type: -+ return PointerSize; -+ case DW_TAG_ptr_to_member_type: { -+ if (DWARFDie BaseType = Type.getAttributeValueAsReferencedDie(DW_AT_type)) -+ if (BaseType.getTag() == DW_TAG_subroutine_type) -+ return 2 * PointerSize; -+ return PointerSize; -+ } -+ case DW_TAG_const_type: -+ case DW_TAG_immutable_type: -+ case DW_TAG_volatile_type: -+ case DW_TAG_restrict_type: -+ case DW_TAG_typedef: { -+ if (DWARFDie BaseType = Type.getAttributeValueAsReferencedDie(DW_AT_type)) -+ return getTypeSize(BaseType, PointerSize); -+ break; -+ } -+ case DW_TAG_array_type: { -+ DWARFDie BaseType = Type.getAttributeValueAsReferencedDie(DW_AT_type); -+ if (!BaseType) -+ return std::optional(); -+ std::optional BaseSize = getTypeSize(BaseType, PointerSize); -+ if (!BaseSize) -+ return std::optional(); -+ uint64_t Size = *BaseSize; -+ for (DWARFDie Child : Type) { -+ if (Child.getTag() != DW_TAG_subrange_type) -+ continue; -+ -+ if (auto ElemCountAttr = Child.find(DW_AT_count)) -+ if (std::optional ElemCount = -+ ElemCountAttr->getAsUnsignedConstant()) -+ Size *= *ElemCount; -+ if (auto UpperBoundAttr = Child.find(DW_AT_upper_bound)) -+ if (std::optional UpperBound = -+ UpperBoundAttr->getAsSignedConstant()) { -+ int64_t LowerBound = 0; -+ if (auto LowerBoundAttr = Child.find(DW_AT_lower_bound)) -+ LowerBound = LowerBoundAttr->getAsSignedConstant().value_or(0); -+ Size *= *UpperBound - LowerBound + 1; -+ } -+ } -+ return Size; -+ } -+ default: -+ break; -+ } -+ return std::optional(); -+} -+ - static std::optional - getExpressionFrameOffset(ArrayRef Expr, - std::optional FrameBaseReg) { -@@ -1201,7 +1241,7 @@ void DWARFContext::addLocalsForDie(DWARFCompileUnit *CU, DWARFDie Subprogram, - if (std::optional Name = dwarf::toString(*NameAttr)) - Local.Name = *Name; - if (auto Type = Die.getAttributeValueAsReferencedDie(DW_AT_type)) -- Local.Size = Type.getTypeSize(getCUAddrSize()); -+ Local.Size = getTypeSize(Type, getCUAddrSize()); - if (auto DeclFileAttr = Die.find(DW_AT_decl_file)) { - if (const auto *LT = CU->getContext().getLineTableForUnit(CU)) - LT->getFileNameByIndex( -@@ -1242,6 +1282,7 @@ DWARFContext::getLocalsForAddress(object::SectionedAddress Address) { - DILineInfo DWARFContext::getLineInfoForAddress(object::SectionedAddress Address, - DILineInfoSpecifier Spec) { - DILineInfo Result; -+ - DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); - if (!CU) - return Result; -@@ -1256,22 +1297,6 @@ DILineInfo DWARFContext::getLineInfoForAddress(object::SectionedAddress Address, - Spec.FLIKind, Result); - } - } -- -- return Result; --} -- --DILineInfo --DWARFContext::getLineInfoForDataAddress(object::SectionedAddress Address) { -- DILineInfo Result; -- DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); -- if (!CU) -- return Result; -- -- if (DWARFDie Die = CU->getVariableForAddress(Address.Address)) { -- Result.FileName = Die.getDeclFile(FileLineInfoKind::AbsoluteFilePath); -- Result.Line = Die.getDeclLine(); -- } -- - return Result; - } - -diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp -index 15a2d23c4fd2..9bf15c30f714 100644 ---- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp -+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp -@@ -492,66 +492,6 @@ void DWARFDie::getCallerFrame(uint32_t &CallFile, uint32_t &CallLine, - CallDiscriminator = toUnsigned(find(DW_AT_GNU_discriminator), 0); - } - --std::optional DWARFDie::getTypeSize(uint64_t PointerSize) { -- if (auto SizeAttr = find(DW_AT_byte_size)) -- if (std::optional Size = SizeAttr->getAsUnsignedConstant()) -- return Size; -- -- switch (getTag()) { -- case DW_TAG_pointer_type: -- case DW_TAG_reference_type: -- case DW_TAG_rvalue_reference_type: -- return PointerSize; -- case DW_TAG_ptr_to_member_type: { -- if (DWARFDie BaseType = getAttributeValueAsReferencedDie(DW_AT_type)) -- if (BaseType.getTag() == DW_TAG_subroutine_type) -- return 2 * PointerSize; -- return PointerSize; -- } -- case DW_TAG_const_type: -- case DW_TAG_immutable_type: -- case DW_TAG_volatile_type: -- case DW_TAG_restrict_type: -- case DW_TAG_typedef: { -- if (DWARFDie BaseType = getAttributeValueAsReferencedDie(DW_AT_type)) -- return BaseType.getTypeSize(PointerSize); -- break; -- } -- case DW_TAG_array_type: { -- DWARFDie BaseType = getAttributeValueAsReferencedDie(DW_AT_type); -- if (!BaseType) -- return std::nullopt; -- std::optional BaseSize = BaseType.getTypeSize(PointerSize); -- if (!BaseSize) -- return std::nullopt; -- uint64_t Size = *BaseSize; -- for (DWARFDie Child : *this) { -- if (Child.getTag() != DW_TAG_subrange_type) -- continue; -- -- if (auto ElemCountAttr = Child.find(DW_AT_count)) -- if (std::optional ElemCount = -- ElemCountAttr->getAsUnsignedConstant()) -- Size *= *ElemCount; -- if (auto UpperBoundAttr = Child.find(DW_AT_upper_bound)) -- if (std::optional UpperBound = -- UpperBoundAttr->getAsSignedConstant()) { -- int64_t LowerBound = 0; -- if (auto LowerBoundAttr = Child.find(DW_AT_lower_bound)) -- LowerBound = LowerBoundAttr->getAsSignedConstant().value_or(0); -- Size *= *UpperBound - LowerBound + 1; -- } -- } -- return Size; -- } -- default: -- if (DWARFDie BaseType = getAttributeValueAsReferencedDie(DW_AT_type)) -- return BaseType.getTypeSize(PointerSize); -- break; -- } -- return std::nullopt; --} -- - /// Helper to dump a DIE with all of its parents, but no siblings. - static unsigned dumpParentChain(DWARFDie Die, raw_ostream &OS, unsigned Indent, - DIDumpOptions DumpOpts, unsigned Depth = 0) { -diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp -index 74667fcb92bc..148711f0246f 100644 ---- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp -+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp -@@ -9,7 +9,6 @@ - #include "llvm/DebugInfo/DWARF/DWARFUnit.h" - #include "llvm/ADT/SmallString.h" - #include "llvm/ADT/StringRef.h" --#include "llvm/BinaryFormat/Dwarf.h" - #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h" - #include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h" - #include "llvm/DebugInfo/DWARF/DWARFContext.h" -@@ -19,13 +18,11 @@ - #include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h" - #include "llvm/DebugInfo/DWARF/DWARFDebugRnglists.h" - #include "llvm/DebugInfo/DWARF/DWARFDie.h" --#include "llvm/DebugInfo/DWARF/DWARFExpression.h" - #include "llvm/DebugInfo/DWARF/DWARFFormValue.h" - #include "llvm/DebugInfo/DWARF/DWARFListTable.h" - #include "llvm/DebugInfo/DWARF/DWARFObject.h" - #include "llvm/DebugInfo/DWARF/DWARFSection.h" - #include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h" --#include "llvm/Object/ObjectFile.h" - #include "llvm/Support/DataExtractor.h" - #include "llvm/Support/Errc.h" - #include "llvm/Support/Path.h" -@@ -752,100 +749,6 @@ DWARFDie DWARFUnit::getSubroutineForAddress(uint64_t Address) { - return R->second.second; - } - --void DWARFUnit::updateVariableDieMap(DWARFDie Die) { -- for (DWARFDie Child : Die) { -- if (isType(Child.getTag())) -- continue; -- updateVariableDieMap(Child); -- } -- -- if (Die.getTag() != DW_TAG_variable) -- return; -- -- Expected Locations = -- Die.getLocations(DW_AT_location); -- if (!Locations) { -- // Missing DW_AT_location is fine here. -- consumeError(Locations.takeError()); -- return; -- } -- -- uint64_t Address = UINT64_MAX; -- -- for (const DWARFLocationExpression &Location : *Locations) { -- uint8_t AddressSize = getAddressByteSize(); -- DataExtractor Data(Location.Expr, /*IsLittleEndian=*/true, AddressSize); -- DWARFExpression Expr(Data, AddressSize); -- auto It = Expr.begin(); -- if (It == Expr.end()) -- continue; -- -- // Match exactly the main sequence used to describe global variables: -- // `DW_OP_addr[x] [+ DW_OP_plus_uconst]`. Currently, this is the sequence -- // that LLVM produces for DILocalVariables and DIGlobalVariables. If, in -- // future, the DWARF producer (`DwarfCompileUnit::addLocationAttribute()` is -- // a good starting point) is extended to use further expressions, this code -- // needs to be updated. -- uint64_t LocationAddr; -- if (It->getCode() == dwarf::DW_OP_addr) { -- LocationAddr = It->getRawOperand(0); -- } else if (It->getCode() == dwarf::DW_OP_addrx) { -- uint64_t DebugAddrOffset = It->getRawOperand(0); -- if (auto Pointer = getAddrOffsetSectionItem(DebugAddrOffset)) { -- LocationAddr = Pointer->Address; -- } -- } else { -- continue; -- } -- -- // Read the optional 2nd operand, a DW_OP_plus_uconst. -- if (++It != Expr.end()) { -- if (It->getCode() != dwarf::DW_OP_plus_uconst) -- continue; -- -- LocationAddr += It->getRawOperand(0); -- -- // Probe for a 3rd operand, if it exists, bail. -- if (++It != Expr.end()) -- continue; -- } -- -- Address = LocationAddr; -- break; -- } -- -- // Get the size of the global variable. If all else fails (i.e. the global has -- // no type), then we use a size of one to still allow symbolization of the -- // exact address. -- uint64_t GVSize = 1; -- if (DWARFDie BaseType = Die.getAttributeValueAsReferencedDie(DW_AT_type)) -- if (std::optional Size = Die.getTypeSize(getAddressByteSize())) -- GVSize = *Size; -- -- if (Address != UINT64_MAX) -- VariableDieMap[Address] = {Address + GVSize, Die}; --} -- --DWARFDie DWARFUnit::getVariableForAddress(uint64_t Address) { -- extractDIEsIfNeeded(false); -- -- auto RootDie = getUnitDIE(); -- -- auto RootLookup = RootsParsedForVariables.insert(RootDie.getOffset()); -- if (RootLookup.second) -- updateVariableDieMap(RootDie); -- -- auto R = VariableDieMap.upper_bound(Address); -- if (R == VariableDieMap.begin()) -- return DWARFDie(); -- -- // upper_bound's previous item contains Address. -- --R; -- if (Address >= R->second.first) -- return DWARFDie(); -- return R->second.second; --} -- - void - DWARFUnit::getInlinedChainForAddress(uint64_t Address, - SmallVectorImpl &InlinedChain) { -diff --git a/llvm/lib/DebugInfo/PDB/PDBContext.cpp b/llvm/lib/DebugInfo/PDB/PDBContext.cpp -index e600fb7385f1..0444093d7622 100644 ---- a/llvm/lib/DebugInfo/PDB/PDBContext.cpp -+++ b/llvm/lib/DebugInfo/PDB/PDBContext.cpp -@@ -64,13 +64,6 @@ DILineInfo PDBContext::getLineInfoForAddress(object::SectionedAddress Address, - return Result; - } - --DILineInfo --PDBContext::getLineInfoForDataAddress(object::SectionedAddress Address) { -- // Unimplemented. S_GDATA and S_LDATA in CodeView (used to describe global -- // variables) aren't capable of carrying line information. -- return DILineInfo(); --} -- - DILineInfoTable - PDBContext::getLineInfoForAddressRange(object::SectionedAddress Address, - uint64_t Size, -diff --git a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp -index 877380213f21..496c8149782e 100644 ---- a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp -+++ b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp -@@ -206,10 +206,6 @@ void PlainPrinterBase::print(const Request &Request, const DIGlobal &Global) { - Name = DILineInfo::Addr2LineBadString; - OS << Name << "\n"; - OS << Global.Start << " " << Global.Size << "\n"; -- if (Global.DeclFile.empty()) -- OS << "??:?\n"; -- else -- OS << Global.DeclFile << ":" << Global.DeclLine << "\n"; - printFooter(); - } - -diff --git a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp -index d8ee9264b64f..fcff531895a2 100644 ---- a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp -+++ b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp -@@ -327,14 +327,6 @@ DIGlobal SymbolizableObjectFile::symbolizeData( - std::string FileName; - getNameFromSymbolTable(ModuleOffset.Address, Res.Name, Res.Start, Res.Size, - FileName); -- Res.DeclFile = FileName; -- -- // Try and get a better filename:lineno pair from the debuginfo, if present. -- DILineInfo DL = DebugInfoContext->getLineInfoForDataAddress(ModuleOffset); -- if (DL.Line != 0) { -- Res.DeclFile = DL.FileName; -- Res.DeclLine = DL.Line; -- } - return Res; - } - -diff --git a/llvm/test/DebugInfo/Symbolize/ELF/data-command-symtab.yaml b/llvm/test/DebugInfo/Symbolize/ELF/data-command-symtab.yaml -index 83af3111c5dd..984e444b2fda 100644 ---- a/llvm/test/DebugInfo/Symbolize/ELF/data-command-symtab.yaml -+++ b/llvm/test/DebugInfo/Symbolize/ELF/data-command-symtab.yaml -@@ -7,15 +7,12 @@ - - # CHECK: func - # CHECK-NEXT: 4096 1 --# CHECK-NEXT: ??:? - # CHECK-EMPTY: - # CHECK-NEXT: data - # CHECK-NEXT: 8192 2 --# CHECK-NEXT: ??:? - # CHECK-EMPTY: - # CHECK-NEXT: notype - # CHECK-NEXT: 8194 3 --# CHECK-NEXT: ??:? - # CHECK-EMPTY: - - --- !ELF -diff --git a/llvm/test/tools/llvm-symbolizer/data-location.yaml b/llvm/test/tools/llvm-symbolizer/data-location.yaml -deleted file mode 100644 -index 54f7d9be44a1..000000000000 ---- a/llvm/test/tools/llvm-symbolizer/data-location.yaml -+++ /dev/null -@@ -1,450 +0,0 @@ --## Show that when "DATA" is used with an address, it forces the found location --## to be symbolized as data, including the source information. -- --# RUN: yaml2obj %s -o %t.so -- --# RUN: llvm-symbolizer 'DATA 0x304d0' 'DATA 0x304d1' 'DATA 0x304d3' \ --# RUN: 'DATA 0x304c0' 'DATA 0x304c8' 'DATA 0x304d4' 'DATA 0x304dc' \ --# RUN: 'DATA 0x304d8' --obj=%t.so | FileCheck %s -- --# CHECK: bss_global --# CHECK-NEXT: {{[0-9]+}} 4 --# CHECK-NEXT: /tmp/file.cpp:1 --# CHECK-EMPTY: -- --## Check that lookups in the middle of the symbol are also resolved correctly. --# CHECK: bss_global --# CHECK-NEXT: {{[0-9]+}} 4 --# CHECK-NEXT: /tmp/file.cpp:1 --# CHECK-EMPTY: --# CHECK: bss_global --# CHECK-NEXT: {{[0-9]+}} 4 --# CHECK-NEXT: /tmp/file.cpp:1 --# CHECK-EMPTY: -- --## Now, the remainder of the symbols. --# CHECK-NEXT: data_global --# CHECK-NEXT: {{[0-9]+}} 4 --# CHECK-NEXT: /tmp/file.cpp:2 --# CHECK-EMPTY: --# CHECK-NEXT: str --# CHECK-NEXT: {{[0-9]+}} 8 --# CHECK-NEXT: /tmp/file.cpp:4 --# CHECK-EMPTY: --# CHECK-NEXT: f()::function_global --# CHECK-NEXT: {{[0-9]+}} 4 --# CHECK-NEXT: /tmp/file.cpp:8 --# CHECK-EMPTY: -- --## Including the one that includes an addend. --# CHECK-NEXT: alpha --# CHECK-NEXT: {{[0-9]+}} 4 --# CHECK-NEXT: /tmp/file.cpp:12 --# CHECK-EMPTY: --# CHECK-NEXT: beta --# CHECK-NEXT: {{[0-9]+}} 4 --# CHECK-NEXT: /tmp/file.cpp:13 --# CHECK-EMPTY: -- --## Ensure there's still a global that's offset-based. --# RUN: llvm-dwarfdump --debug-info %t.so | FileCheck %s --check-prefix=OFFSET -- --# OFFSET: DW_AT_location (DW_OP_addrx 0x4, DW_OP_plus_uconst 0x4) -- --################################################################################ --## File below was generated using: --## --## $ clang++ -g -O3 /tmp/file.cpp -shared -fuse-ld=lld -nostdlib \ --## -target aarch64-linux-gnuabi -mllvm -global-merge-ignore-single-use \ --## -o /tmp/file.so --## --## With /tmp/file.cpp as: --## 1: int bss_global; --## 2: int data_global = 2; --## 3: --## 4: const char* str = --## 5: "12345678"; --## 6: --## 7: int* f() { --## 8: static int function_global; --## 9: return &function_global; --## 10: } --## 11: --## 12: static int alpha; --## 13: static int beta; --## 14: int *f(bool b) { return beta ? &alpha : β } --## 15: --## --## ... then, one can get the offsets using `nm`, like: --## $ nm out.so | grep bss_global --## 00000000000038fc B bss_global --## --## Note the use of the aarch64 target (with -nostdlib in order to allow linkage --## without libraries for cross-compilation) as well as -O3 and --## -global-merge-ignore-single-use. This is a specific combination that makes --## the compiler emit the `alpha` global variable with a more complex --## DW_AT_location than just a DW_OP_addr/DW_OP_addrx. In this instance, it --## outputs a `DW_AT_location (DW_OP_addrx 0x4, DW_OP_plus_uconst 0x4)`. --## --## Ideally, this would be tested by invoking clang directly on a C source file, --## but unfortunately there's no way to do that for LLVM tests. The other option --## is to compile IR to an objfile, but llvm-symbolizer doesn't understand that --## two symbols can have the same address in different sections. In the code --## above, for example, we'd have bss_global at .bss+0x0, and data_global at --## .data+0x0, and so the symbolizer would only print one of them. Hence, we have --## the ugly dso-to-yaml blob below. --## --## For now, constant strings don't have a debuginfo entry, and so can't be --## symbolized correctly. In future (if D123534 gets merged), this can be updated --## to include a check that llvm-symbolizer can also symbolize constant strings, --## like `str` above (basically that &"12345678" should be symbolizable) --## to the specific line. Then, you can find the address of the constant string --## from the relocation: --## --## $ nm out.so | grep str --## 00000000000038c0 D str --## $ llvm-objdump -R out.so | grep 38c0 --## 00000000000038c0 R_X86_64_RELATIVE *ABS*+0x4f8 # <-- 0x4f8 --################################################################################ -- ----- !ELF --FileHeader: -- Class: ELFCLASS64 -- Data: ELFDATA2LSB -- Type: ET_DYN -- Machine: EM_AARCH64 --ProgramHeaders: -- - Type: PT_PHDR -- Flags: [ PF_R ] -- VAddr: 0x40 -- Align: 0x8 -- - Type: PT_LOAD -- Flags: [ PF_R ] -- FirstSec: .dynsym -- LastSec: .eh_frame -- Align: 0x10000 -- - Type: PT_LOAD -- Flags: [ PF_X, PF_R ] -- FirstSec: .text -- LastSec: .text -- VAddr: 0x103E4 -- Align: 0x10000 -- - Type: PT_LOAD -- Flags: [ PF_W, PF_R ] -- FirstSec: .dynamic -- LastSec: .dynamic -- VAddr: 0x20410 -- Align: 0x10000 -- - Type: PT_LOAD -- Flags: [ PF_W, PF_R ] -- FirstSec: .data -- LastSec: .bss -- VAddr: 0x304C0 -- Align: 0x10000 -- - Type: PT_DYNAMIC -- Flags: [ PF_W, PF_R ] -- FirstSec: .dynamic -- LastSec: .dynamic -- VAddr: 0x20410 -- Align: 0x8 -- - Type: PT_GNU_RELRO -- Flags: [ PF_R ] -- FirstSec: .dynamic -- LastSec: .dynamic -- VAddr: 0x20410 -- - Type: PT_GNU_EH_FRAME -- Flags: [ PF_R ] -- FirstSec: .eh_frame_hdr -- LastSec: .eh_frame_hdr -- VAddr: 0x37C -- Align: 0x4 -- - Type: PT_GNU_STACK -- Flags: [ PF_W, PF_R ] -- Align: 0x0 --Sections: -- - Name: .dynsym -- Type: SHT_DYNSYM -- Flags: [ SHF_ALLOC ] -- Address: 0x238 -- Link: .dynstr -- AddressAlign: 0x8 -- - Name: .gnu.hash -- Type: SHT_GNU_HASH -- Flags: [ SHF_ALLOC ] -- Address: 0x2C8 -- Link: .dynsym -- AddressAlign: 0x8 -- Header: -- SymNdx: 0x1 -- Shift2: 0x1A -- BloomFilter: [ 0x400188002180000C ] -- HashBuckets: [ 0x1 ] -- HashValues: [ 0xEE8502A, 0xEE85016, 0xC033991C, 0x61F7372E, 0xB88AB7F ] -- - Name: .hash -- Type: SHT_HASH -- Flags: [ SHF_ALLOC ] -- Address: 0x2F8 -- Link: .dynsym -- AddressAlign: 0x4 -- Bucket: [ 5, 0, 4, 0, 3, 0 ] -- Chain: [ 0, 0, 0, 1, 2, 0 ] -- - Name: .dynstr -- Type: SHT_STRTAB -- Flags: [ SHF_ALLOC ] -- Address: 0x330 -- AddressAlign: 0x1 -- - Name: .rela.dyn -- Type: SHT_RELA -- Flags: [ SHF_ALLOC ] -- Address: 0x358 -- Link: .dynsym -- AddressAlign: 0x8 -- Relocations: -- - Offset: 0x304C8 -- Type: R_AARCH64_RELATIVE -- Addend: 880 -- - Name: .rodata -- Type: SHT_PROGBITS -- Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ] -- Address: 0x370 -- AddressAlign: 0x1 -- EntSize: 0x1 -- Content: '313233343536373800' -- - Name: .eh_frame_hdr -- Type: SHT_PROGBITS -- Flags: [ SHF_ALLOC ] -- Address: 0x37C -- AddressAlign: 0x4 -- Content: 011B033B18000000020000006800010034000000740001004C000000 -- - Name: .eh_frame -- Type: SHT_PROGBITS -- Flags: [ SHF_ALLOC ] -- Address: 0x398 -- AddressAlign: 0x8 -- Content: 1400000000000000017A5200017C1E011B0C1F0000000000140000001C0000002C0001000C00000000000000000000001400000034000000200001001C000000000000000000000000000000 -- - Name: .text -- Type: SHT_PROGBITS -- Flags: [ SHF_ALLOC, SHF_EXECINSTR ] -- Address: 0x103E4 -- AddressAlign: 0x4 -- Content: 0001009000501391C0035FD60801009008611391E90308AA2A4540B85F0100710001899AC0035FD6 -- - Name: .dynamic -- Type: SHT_DYNAMIC -- Flags: [ SHF_WRITE, SHF_ALLOC ] -- Address: 0x20410 -- Link: .dynstr -- AddressAlign: 0x8 -- Entries: -- - Tag: DT_RELA -- Value: 0x358 -- - Tag: DT_RELASZ -- Value: 0x18 -- - Tag: DT_RELAENT -- Value: 0x18 -- - Tag: DT_RELACOUNT -- Value: 0x1 -- - Tag: DT_SYMTAB -- Value: 0x238 -- - Tag: DT_SYMENT -- Value: 0x18 -- - Tag: DT_STRTAB -- Value: 0x330 -- - Tag: DT_STRSZ -- Value: 0x28 -- - Tag: DT_GNU_HASH -- Value: 0x2C8 -- - Tag: DT_HASH -- Value: 0x2F8 -- - Tag: DT_NULL -- Value: 0x0 -- - Name: .data -- Type: SHT_PROGBITS -- Flags: [ SHF_WRITE, SHF_ALLOC ] -- Address: 0x304C0 -- AddressAlign: 0x8 -- Content: '02000000000000000000000000000000' -- - Name: .bss -- Type: SHT_NOBITS -- Flags: [ SHF_WRITE, SHF_ALLOC ] -- Address: 0x304D0 -- AddressAlign: 0x4 -- Size: 0x10 -- - Name: .debug_abbrev -- Type: SHT_PROGBITS -- AddressAlign: 0x1 -- Content: 011101252513050325721710171B25111B120673170000023400032549133F193A0B3B0B0218000003240003253E0B0B0B0000040F004913000005260049130000062E01111B120640187A196E2503253A0B3B0B49133F190000073400032549133A0B3B0B02180000083400032549133A0B3B0B02186E25000009050003253A0B3B0B4913000000 -- - Name: .debug_info -- Type: SHT_PROGBITS -- AddressAlign: 0x1 -- Content: AB0000000500010800000000010021000108000000000000000205280000000800000002032E000000000102A1000304050402052E000000000202A101020648000000000402A102044D00000005520000000307080106050C000000016F0D0E0007A500000007082E000000000802A1030008092E000000000D02A1040A080B2E000000000C04A10423040C06061C000000016F0F0E000EA50000000910000EAA00000000042E0000000311020100 -- - Name: .debug_str_offsets -- Type: SHT_PROGBITS -- AddressAlign: 0x1 -- Content: 4C00000005000000A2000000000000002C00000059000000280000001C00000072000000640000008C0000008700000069000000140000007B0000009C0000001A0000000E0000008500000076000000 -- - Name: .comment -- Type: SHT_PROGBITS -- Flags: [ SHF_MERGE, SHF_STRINGS ] -- AddressAlign: 0x1 -- EntSize: 0x1 -- Content: 4C696E6B65723A204C4C442031352E302E300000636C616E672076657273696F6E2031352E302E30202868747470733A2F2F6769746875622E636F6D2F6C6C766D2F6C6C766D2D70726F6A6563742E67697420306462616566363162353666306566306162306366333865613932666663316633356265653366662900 -- - Name: .debug_line -- Type: SHT_PROGBITS -- AddressAlign: 0x1 -- Content: 620000000500080037000000010101FB0E0D00010101010000000100000101011F010E00000003011F020F051E0100000000006C97BBE59F7DC6A9EA956633431DA63E0400000902E4030100000000001805030A140500BF05190A0105120608740204000101 -- - Name: .debug_line_str -- Type: SHT_PROGBITS -- Flags: [ SHF_MERGE, SHF_STRINGS ] -- AddressAlign: 0x1 -- EntSize: 0x1 -- Content: 2F746D702F66696C652E637070002F7573722F6C6F63616C2F676F6F676C652F686F6D652F6D69746368702F6C6C766D2D6275696C642F6F707400 --Symbols: -- - Name: file.cpp -- Type: STT_FILE -- Index: SHN_ABS -- - Name: '$x.0' -- Section: .text -- Value: 0x103E4 -- - Name: _ZZ1fvE15function_global -- Type: STT_OBJECT -- Section: .bss -- Value: 0x304D4 -- Size: 0x4 -- - Name: '$d.1' -- Section: .bss -- Value: 0x304D0 -- - Name: '$d.2' -- Section: .data -- Value: 0x304C0 -- - Name: '$d.3' -- Section: .rodata -- Value: 0x370 -- - Name: '$d.4' -- Section: .debug_abbrev -- - Name: '$d.5' -- Section: .debug_info -- - Name: '$d.6' -- Section: .debug_str_offsets -- - Name: '$d.7' -- Section: .debug_str -- Value: 0xA2 -- - Name: '$d.8' -- Section: .debug_addr -- - Name: _ZL4beta -- Type: STT_OBJECT -- Section: .bss -- Value: 0x304D8 -- Size: 0x4 -- - Name: _ZL5alpha -- Type: STT_OBJECT -- Section: .bss -- Value: 0x304DC -- Size: 0x4 -- - Name: '$d.9' -- Section: .comment -- Value: 0x13 -- - Name: '$d.10' -- Section: .eh_frame -- Value: 0x398 -- - Name: '$d.11' -- Section: .debug_line -- - Name: '$d.12' -- Section: .debug_line_str -- Value: 0xE -- - Name: _DYNAMIC -- Section: .dynamic -- Value: 0x20410 -- Other: [ STV_HIDDEN ] -- - Name: _Z1fv -- Type: STT_FUNC -- Section: .text -- Binding: STB_GLOBAL -- Value: 0x103E4 -- Size: 0xC -- - Name: _Z1fb -- Type: STT_FUNC -- Section: .text -- Binding: STB_GLOBAL -- Value: 0x103F0 -- Size: 0x1C -- - Name: bss_global -- Type: STT_OBJECT -- Section: .bss -- Binding: STB_GLOBAL -- Value: 0x304D0 -- Size: 0x4 -- - Name: data_global -- Type: STT_OBJECT -- Section: .data -- Binding: STB_GLOBAL -- Value: 0x304C0 -- Size: 0x4 -- - Name: str -- Type: STT_OBJECT -- Section: .data -- Binding: STB_GLOBAL -- Value: 0x304C8 -- Size: 0x8 --DynamicSymbols: -- - Name: _Z1fv -- Type: STT_FUNC -- Section: .text -- Binding: STB_GLOBAL -- Value: 0x103E4 -- Size: 0xC -- - Name: _Z1fb -- Type: STT_FUNC -- Section: .text -- Binding: STB_GLOBAL -- Value: 0x103F0 -- Size: 0x1C -- - Name: bss_global -- Type: STT_OBJECT -- Section: .bss -- Binding: STB_GLOBAL -- Value: 0x304D0 -- Size: 0x4 -- - Name: data_global -- Type: STT_OBJECT -- Section: .data -- Binding: STB_GLOBAL -- Value: 0x304C0 -- Size: 0x4 -- - Name: str -- Type: STT_OBJECT -- Section: .data -- Binding: STB_GLOBAL -- Value: 0x304C8 -- Size: 0x8 --DWARF: -- debug_str: -- - '/tmp/file.cpp' -- - _Z1fb -- - alpha -- - f -- - data_global -- - int -- - '/usr/local/google/home/mitchp/llvm-build/opt' -- - bss_global -- - char -- - _ZL4beta -- - str -- - bool -- - _ZL5alpha -- - b -- - beta -- - function_global -- - _Z1fv -- - 'clang version 15.0.0 (https://github.com/llvm/llvm-project.git 0dbaef61b56f0ef0ab0cf38ea92ffc1f35bee3ff)' -- debug_addr: -- - Length: 0x3C -- Version: 0x5 -- AddressSize: 0x8 -- Entries: -- - Address: 0x304D0 -- - Address: 0x304C0 -- - Address: 0x304C8 -- - Address: 0x304D4 -- - Address: 0x304D8 -- - Address: 0x103E4 -- - Address: 0x103F0 --... -diff --git a/llvm/test/tools/llvm-symbolizer/data.s b/llvm/test/tools/llvm-symbolizer/data.s -index cc9503c59141..e8039f146dbd 100644 ---- a/llvm/test/tools/llvm-symbolizer/data.s -+++ b/llvm/test/tools/llvm-symbolizer/data.s -@@ -7,12 +7,9 @@ - - # CHECK: d1 - # CHECK-NEXT: 0 8 --# CHECK-NEXT: ??:? - # CHECK-EMPTY: - # CHECK-NEXT: d2 - # CHECK-NEXT: 8 4 --# CHECK-NEXT: ??:? --# CHECK-EMPTY: - - d1: - .quad 0x1122334455667788 --- -2.38.1.1.g6d9df9d320 - diff --git a/build/build-clang/revert-llvmorg-15-init-11205-gcead4eceb01b_clang_18.patch b/build/build-clang/revert-llvmorg-15-init-11205-gcead4eceb01b_clang_18.patch deleted file mode 100644 index 908374789cd7..000000000000 --- a/build/build-clang/revert-llvmorg-15-init-11205-gcead4eceb01b_clang_18.patch +++ /dev/null @@ -1,972 +0,0 @@ -From cb411520cb7cd5e6e25966911ca55feb5de779e0 Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Fri, 4 Nov 2022 14:51:38 +0900 -Subject: [PATCH] Revert "[symbolizer] Parse DW_TAG_variable DIs to show line - info for globals" - -This reverts commit cead4eceb01b935fae07bf4a7e91911b344d2fec for causing -yet unidentified problems on some webrtc tests under TSan (bug 1798613). ---- - llvm/include/llvm/DebugInfo/DIContext.h | 4 - - .../llvm/DebugInfo/DWARF/DWARFContext.h | 2 - - llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h | 7 - - llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h | 14 - - llvm/include/llvm/DebugInfo/PDB/PDBContext.h | 2 - - llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 97 ++-- - llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 60 --- - llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 97 ---- - llvm/lib/DebugInfo/PDB/PDBContext.cpp | 7 - - llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp | 4 - - .../Symbolize/SymbolizableObjectFile.cpp | 8 - - .../Symbolize/ELF/data-command-symtab.yaml | 3 - - .../tools/llvm-symbolizer/data-location.yaml | 450 ------------------ - llvm/test/tools/llvm-symbolizer/data.s | 3 - - 14 files changed, 61 insertions(+), 697 deletions(-) - delete mode 100644 llvm/test/tools/llvm-symbolizer/data-location.yaml - -diff --git a/llvm/include/llvm/DebugInfo/DIContext.h b/llvm/include/llvm/DebugInfo/DIContext.h -index 9b278b696073..a9f98588cf2d 100644 ---- a/llvm/include/llvm/DebugInfo/DIContext.h -+++ b/llvm/include/llvm/DebugInfo/DIContext.h -@@ -114,8 +114,6 @@ struct DIGlobal { - std::string Name; - uint64_t Start = 0; - uint64_t Size = 0; -- std::string DeclFile; -- uint64_t DeclLine = 0; - - DIGlobal() : Name(DILineInfo::BadString) {} - }; -@@ -241,8 +239,6 @@ public: - virtual DILineInfo getLineInfoForAddress( - object::SectionedAddress Address, - DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0; -- virtual DILineInfo -- getLineInfoForDataAddress(object::SectionedAddress Address) = 0; - virtual DILineInfoTable getLineInfoForAddressRange( - object::SectionedAddress Address, uint64_t Size, - DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0; -diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h -index bf591ed554c6..3365ef8d8ee3 100644 ---- a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h -+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h -@@ -364,8 +364,6 @@ public: - DILineInfo getLineInfoForAddress( - object::SectionedAddress Address, - DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; -- DILineInfo -- getLineInfoForDataAddress(object::SectionedAddress Address) override; - DILineInfoTable getLineInfoForAddressRange( - object::SectionedAddress Address, uint64_t Size, - DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; -diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h -index 149c5ef4e493..4a4d105a2b23 100644 ---- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h -+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h -@@ -280,13 +280,6 @@ public: - /// \returns an iterator range for the attributes of the current DIE. - iterator_range attributes() const; - -- /// Gets the type size (in bytes) for this DIE. -- /// -- /// \param PointerSize the pointer size of the containing CU. -- /// \returns if this is a type DIE, or this DIE contains a DW_AT_type, returns -- /// the size of the type. -- std::optional getTypeSize(uint64_t PointerSize); -- - class iterator; - - iterator begin() const; -diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h -index 9188865b4d77..0341344bc7b8 100644 ---- a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h -+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h -@@ -9,7 +9,6 @@ - #ifndef LLVM_DEBUGINFO_DWARF_DWARFUNIT_H - #define LLVM_DEBUGINFO_DWARF_DWARFUNIT_H - --#include "llvm/ADT/DenseSet.h" - #include "llvm/ADT/STLExtras.h" - #include "llvm/ADT/SmallVector.h" - #include "llvm/ADT/StringRef.h" -@@ -28,7 +27,6 @@ - #include - #include - #include --#include - #include - #include - -@@ -242,11 +240,6 @@ class DWARFUnit { - /// std::map::upper_bound for address range lookup. - std::map> AddrDieMap; - -- /// Map from the location (interpreted DW_AT_location) of a DW_TAG_variable, -- /// to the end address and the corresponding DIE. -- std::map> VariableDieMap; -- DenseSet RootsParsedForVariables; -- - using die_iterator_range = - iterator_range::iterator>; - -@@ -329,9 +322,6 @@ public: - /// Recursively update address to Die map. - void updateAddressDieMap(DWARFDie Die); - -- /// Recursively update address to variable Die map. -- void updateVariableDieMap(DWARFDie Die); -- - void setRangesSection(const DWARFSection *RS, uint64_t Base) { - RangeSection = RS; - RangeSectionBase = Base; -@@ -446,10 +436,6 @@ public: - /// cleared. - DWARFDie getSubroutineForAddress(uint64_t Address); - -- /// Returns variable DIE for the address provided. The pointer is alive as -- /// long as parsed compile unit DIEs are not cleared. -- DWARFDie getVariableForAddress(uint64_t Address); -- - /// getInlinedChainForAddress - fetches inlined chain for a given address. - /// Returns empty chain if there is no subprogram containing address. The - /// chain is valid as long as parsed compile unit DIEs are not cleared. -diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBContext.h b/llvm/include/llvm/DebugInfo/PDB/PDBContext.h -index 3163c0a1dae0..7b6793f0a639 100644 ---- a/llvm/include/llvm/DebugInfo/PDB/PDBContext.h -+++ b/llvm/include/llvm/DebugInfo/PDB/PDBContext.h -@@ -45,8 +45,6 @@ namespace pdb { - DILineInfo getLineInfoForAddress( - object::SectionedAddress Address, - DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; -- DILineInfo -- getLineInfoForDataAddress(object::SectionedAddress Address) override; - DILineInfoTable getLineInfoForAddressRange( - object::SectionedAddress Address, uint64_t Size, - DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; -diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp -index 19d7d659a86a..1bcfdecfd588 100644 ---- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp -+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp -@@ -1053,25 +1053,7 @@ DWARFCompileUnit *DWARFContext::getCompileUnitForAddress(uint64_t Address) { - // First, get the offset of the compile unit. - uint64_t CUOffset = getDebugAranges()->findAddress(Address); - // Retrieve the compile unit. -- if (DWARFCompileUnit *OffsetCU = getCompileUnitForOffset(CUOffset)) -- return OffsetCU; -- -- // Global variables are often not found by the above search, for one of two -- // reasons: -- // 1. .debug_aranges may not include global variables. On clang, it seems we -- // put the globals in the aranges, but this isn't true for gcc. -- // 2. Even if the global variable is in a .debug_arange, global variables -- // may not be captured in the [start, end) addresses described by the -- // parent compile unit. -- // -- // So, we walk the CU's and their child DI's manually, looking for the -- // specific global variable. -- for (std::unique_ptr &CU : compile_units()) { -- if (CU->getVariableForAddress(Address)) { -- return static_cast(CU.get()); -- } -- } -- return nullptr; -+ return getCompileUnitForOffset(CUOffset); - } - - DWARFContext::DIEsForAddress DWARFContext::getDIEsForAddress(uint64_t Address, -@@ -1141,6 +1123,64 @@ static bool getFunctionNameAndStartLineForAddress( - return FoundResult; - } - -+static std::optional getTypeSize(DWARFDie Type, uint64_t PointerSize) { -+ if (auto SizeAttr = Type.find(DW_AT_byte_size)) -+ if (std::optional Size = SizeAttr->getAsUnsignedConstant()) -+ return Size; -+ -+ switch (Type.getTag()) { -+ case DW_TAG_pointer_type: -+ case DW_TAG_reference_type: -+ case DW_TAG_rvalue_reference_type: -+ return PointerSize; -+ case DW_TAG_ptr_to_member_type: { -+ if (DWARFDie BaseType = Type.getAttributeValueAsReferencedDie(DW_AT_type)) -+ if (BaseType.getTag() == DW_TAG_subroutine_type) -+ return 2 * PointerSize; -+ return PointerSize; -+ } -+ case DW_TAG_const_type: -+ case DW_TAG_immutable_type: -+ case DW_TAG_volatile_type: -+ case DW_TAG_restrict_type: -+ case DW_TAG_typedef: { -+ if (DWARFDie BaseType = Type.getAttributeValueAsReferencedDie(DW_AT_type)) -+ return getTypeSize(BaseType, PointerSize); -+ break; -+ } -+ case DW_TAG_array_type: { -+ DWARFDie BaseType = Type.getAttributeValueAsReferencedDie(DW_AT_type); -+ if (!BaseType) -+ return std::optional(); -+ std::optional BaseSize = getTypeSize(BaseType, PointerSize); -+ if (!BaseSize) -+ return std::optional(); -+ uint64_t Size = *BaseSize; -+ for (DWARFDie Child : Type) { -+ if (Child.getTag() != DW_TAG_subrange_type) -+ continue; -+ -+ if (auto ElemCountAttr = Child.find(DW_AT_count)) -+ if (std::optional ElemCount = -+ ElemCountAttr->getAsUnsignedConstant()) -+ Size *= *ElemCount; -+ if (auto UpperBoundAttr = Child.find(DW_AT_upper_bound)) -+ if (std::optional UpperBound = -+ UpperBoundAttr->getAsSignedConstant()) { -+ int64_t LowerBound = 0; -+ if (auto LowerBoundAttr = Child.find(DW_AT_lower_bound)) -+ LowerBound = LowerBoundAttr->getAsSignedConstant().value_or(0); -+ Size *= *UpperBound - LowerBound + 1; -+ } -+ } -+ return Size; -+ } -+ default: -+ break; -+ } -+ return std::optional(); -+} -+ - static std::optional - getExpressionFrameOffset(ArrayRef Expr, - std::optional FrameBaseReg) { -@@ -1201,7 +1241,7 @@ void DWARFContext::addLocalsForDie(DWARFCompileUnit *CU, DWARFDie Subprogram, - if (std::optional Name = dwarf::toString(*NameAttr)) - Local.Name = *Name; - if (auto Type = Die.getAttributeValueAsReferencedDie(DW_AT_type)) -- Local.Size = Type.getTypeSize(getCUAddrSize()); -+ Local.Size = getTypeSize(Type, getCUAddrSize()); - if (auto DeclFileAttr = Die.find(DW_AT_decl_file)) { - if (const auto *LT = CU->getContext().getLineTableForUnit(CU)) - LT->getFileNameByIndex( -@@ -1242,6 +1282,7 @@ DWARFContext::getLocalsForAddress(object::SectionedAddress Address) { - DILineInfo DWARFContext::getLineInfoForAddress(object::SectionedAddress Address, - DILineInfoSpecifier Spec) { - DILineInfo Result; -+ - DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); - if (!CU) - return Result; -@@ -1256,22 +1297,6 @@ DILineInfo DWARFContext::getLineInfoForAddress(object::SectionedAddress Address, - Spec.FLIKind, Result); - } - } -- -- return Result; --} -- --DILineInfo --DWARFContext::getLineInfoForDataAddress(object::SectionedAddress Address) { -- DILineInfo Result; -- DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); -- if (!CU) -- return Result; -- -- if (DWARFDie Die = CU->getVariableForAddress(Address.Address)) { -- Result.FileName = Die.getDeclFile(FileLineInfoKind::AbsoluteFilePath); -- Result.Line = Die.getDeclLine(); -- } -- - return Result; - } - -diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp -index 66492f7bf804..357b172bf99b 100644 ---- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp -+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp -@@ -556,11 +556,6 @@ getTypeSizeImpl(DWARFDie Die, uint64_t PointerSize, - return std::nullopt; - } - --std::optional DWARFDie::getTypeSize(uint64_t PointerSize) { -- SmallPtrSet Visited; -- return getTypeSizeImpl(*this, PointerSize, Visited); --} -- - /// Helper to dump a DIE with all of its parents, but no siblings. - static unsigned dumpParentChain(DWARFDie Die, raw_ostream &OS, unsigned Indent, - DIDumpOptions DumpOpts, unsigned Depth = 0) { -diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp -index 74667fcb92bc..148711f0246f 100644 ---- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp -+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp -@@ -9,7 +9,6 @@ - #include "llvm/DebugInfo/DWARF/DWARFUnit.h" - #include "llvm/ADT/SmallString.h" - #include "llvm/ADT/StringRef.h" --#include "llvm/BinaryFormat/Dwarf.h" - #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h" - #include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h" - #include "llvm/DebugInfo/DWARF/DWARFContext.h" -@@ -19,13 +18,11 @@ - #include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h" - #include "llvm/DebugInfo/DWARF/DWARFDebugRnglists.h" - #include "llvm/DebugInfo/DWARF/DWARFDie.h" --#include "llvm/DebugInfo/DWARF/DWARFExpression.h" - #include "llvm/DebugInfo/DWARF/DWARFFormValue.h" - #include "llvm/DebugInfo/DWARF/DWARFListTable.h" - #include "llvm/DebugInfo/DWARF/DWARFObject.h" - #include "llvm/DebugInfo/DWARF/DWARFSection.h" - #include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h" --#include "llvm/Object/ObjectFile.h" - #include "llvm/Support/DataExtractor.h" - #include "llvm/Support/Errc.h" - #include "llvm/Support/Path.h" -@@ -752,100 +749,6 @@ DWARFDie DWARFUnit::getSubroutineForAddress(uint64_t Address) { - return R->second.second; - } - --void DWARFUnit::updateVariableDieMap(DWARFDie Die) { -- for (DWARFDie Child : Die) { -- if (isType(Child.getTag())) -- continue; -- updateVariableDieMap(Child); -- } -- -- if (Die.getTag() != DW_TAG_variable) -- return; -- -- Expected Locations = -- Die.getLocations(DW_AT_location); -- if (!Locations) { -- // Missing DW_AT_location is fine here. -- consumeError(Locations.takeError()); -- return; -- } -- -- uint64_t Address = UINT64_MAX; -- -- for (const DWARFLocationExpression &Location : *Locations) { -- uint8_t AddressSize = getAddressByteSize(); -- DataExtractor Data(Location.Expr, isLittleEndian(), AddressSize); -- DWARFExpression Expr(Data, AddressSize); -- auto It = Expr.begin(); -- if (It == Expr.end()) -- continue; -- -- // Match exactly the main sequence used to describe global variables: -- // `DW_OP_addr[x] [+ DW_OP_plus_uconst]`. Currently, this is the sequence -- // that LLVM produces for DILocalVariables and DIGlobalVariables. If, in -- // future, the DWARF producer (`DwarfCompileUnit::addLocationAttribute()` is -- // a good starting point) is extended to use further expressions, this code -- // needs to be updated. -- uint64_t LocationAddr; -- if (It->getCode() == dwarf::DW_OP_addr) { -- LocationAddr = It->getRawOperand(0); -- } else if (It->getCode() == dwarf::DW_OP_addrx) { -- uint64_t DebugAddrOffset = It->getRawOperand(0); -- if (auto Pointer = getAddrOffsetSectionItem(DebugAddrOffset)) { -- LocationAddr = Pointer->Address; -- } -- } else { -- continue; -- } -- -- // Read the optional 2nd operand, a DW_OP_plus_uconst. -- if (++It != Expr.end()) { -- if (It->getCode() != dwarf::DW_OP_plus_uconst) -- continue; -- -- LocationAddr += It->getRawOperand(0); -- -- // Probe for a 3rd operand, if it exists, bail. -- if (++It != Expr.end()) -- continue; -- } -- -- Address = LocationAddr; -- break; -- } -- -- // Get the size of the global variable. If all else fails (i.e. the global has -- // no type), then we use a size of one to still allow symbolization of the -- // exact address. -- uint64_t GVSize = 1; -- if (Die.getAttributeValueAsReferencedDie(DW_AT_type)) -- if (std::optional Size = Die.getTypeSize(getAddressByteSize())) -- GVSize = *Size; -- -- if (Address != UINT64_MAX) -- VariableDieMap[Address] = {Address + GVSize, Die}; --} -- --DWARFDie DWARFUnit::getVariableForAddress(uint64_t Address) { -- extractDIEsIfNeeded(false); -- -- auto RootDie = getUnitDIE(); -- -- auto RootLookup = RootsParsedForVariables.insert(RootDie.getOffset()); -- if (RootLookup.second) -- updateVariableDieMap(RootDie); -- -- auto R = VariableDieMap.upper_bound(Address); -- if (R == VariableDieMap.begin()) -- return DWARFDie(); -- -- // upper_bound's previous item contains Address. -- --R; -- if (Address >= R->second.first) -- return DWARFDie(); -- return R->second.second; --} -- - void - DWARFUnit::getInlinedChainForAddress(uint64_t Address, - SmallVectorImpl &InlinedChain) { -diff --git a/llvm/lib/DebugInfo/PDB/PDBContext.cpp b/llvm/lib/DebugInfo/PDB/PDBContext.cpp -index e600fb7385f1..0444093d7622 100644 ---- a/llvm/lib/DebugInfo/PDB/PDBContext.cpp -+++ b/llvm/lib/DebugInfo/PDB/PDBContext.cpp -@@ -64,13 +64,6 @@ DILineInfo PDBContext::getLineInfoForAddress(object::SectionedAddress Address, - return Result; - } - --DILineInfo --PDBContext::getLineInfoForDataAddress(object::SectionedAddress Address) { -- // Unimplemented. S_GDATA and S_LDATA in CodeView (used to describe global -- // variables) aren't capable of carrying line information. -- return DILineInfo(); --} -- - DILineInfoTable - PDBContext::getLineInfoForAddressRange(object::SectionedAddress Address, - uint64_t Size, -diff --git a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp -index 877380213f21..496c8149782e 100644 ---- a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp -+++ b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp -@@ -206,10 +206,6 @@ void PlainPrinterBase::print(const Request &Request, const DIGlobal &Global) { - Name = DILineInfo::Addr2LineBadString; - OS << Name << "\n"; - OS << Global.Start << " " << Global.Size << "\n"; -- if (Global.DeclFile.empty()) -- OS << "??:?\n"; -- else -- OS << Global.DeclFile << ":" << Global.DeclLine << "\n"; - printFooter(); - } - -diff --git a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp -index d8ee9264b64f..fcff531895a2 100644 ---- a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp -+++ b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp -@@ -327,14 +327,6 @@ DIGlobal SymbolizableObjectFile::symbolizeData( - std::string FileName; - getNameFromSymbolTable(ModuleOffset.Address, Res.Name, Res.Start, Res.Size, - FileName); -- Res.DeclFile = FileName; -- -- // Try and get a better filename:lineno pair from the debuginfo, if present. -- DILineInfo DL = DebugInfoContext->getLineInfoForDataAddress(ModuleOffset); -- if (DL.Line != 0) { -- Res.DeclFile = DL.FileName; -- Res.DeclLine = DL.Line; -- } - return Res; - } - -diff --git a/llvm/test/DebugInfo/Symbolize/ELF/data-command-symtab.yaml b/llvm/test/DebugInfo/Symbolize/ELF/data-command-symtab.yaml -index 83af3111c5dd..984e444b2fda 100644 ---- a/llvm/test/DebugInfo/Symbolize/ELF/data-command-symtab.yaml -+++ b/llvm/test/DebugInfo/Symbolize/ELF/data-command-symtab.yaml -@@ -7,15 +7,12 @@ - - # CHECK: func - # CHECK-NEXT: 4096 1 --# CHECK-NEXT: ??:? - # CHECK-EMPTY: - # CHECK-NEXT: data - # CHECK-NEXT: 8192 2 --# CHECK-NEXT: ??:? - # CHECK-EMPTY: - # CHECK-NEXT: notype - # CHECK-NEXT: 8194 3 --# CHECK-NEXT: ??:? - # CHECK-EMPTY: - - --- !ELF -diff --git a/llvm/test/tools/llvm-symbolizer/data-location.yaml b/llvm/test/tools/llvm-symbolizer/data-location.yaml -deleted file mode 100644 -index 54f7d9be44a1..000000000000 ---- a/llvm/test/tools/llvm-symbolizer/data-location.yaml -+++ /dev/null -@@ -1,450 +0,0 @@ --## Show that when "DATA" is used with an address, it forces the found location --## to be symbolized as data, including the source information. -- --# RUN: yaml2obj %s -o %t.so -- --# RUN: llvm-symbolizer 'DATA 0x304d0' 'DATA 0x304d1' 'DATA 0x304d3' \ --# RUN: 'DATA 0x304c0' 'DATA 0x304c8' 'DATA 0x304d4' 'DATA 0x304dc' \ --# RUN: 'DATA 0x304d8' --obj=%t.so | FileCheck %s -- --# CHECK: bss_global --# CHECK-NEXT: {{[0-9]+}} 4 --# CHECK-NEXT: /tmp/file.cpp:1 --# CHECK-EMPTY: -- --## Check that lookups in the middle of the symbol are also resolved correctly. --# CHECK: bss_global --# CHECK-NEXT: {{[0-9]+}} 4 --# CHECK-NEXT: /tmp/file.cpp:1 --# CHECK-EMPTY: --# CHECK: bss_global --# CHECK-NEXT: {{[0-9]+}} 4 --# CHECK-NEXT: /tmp/file.cpp:1 --# CHECK-EMPTY: -- --## Now, the remainder of the symbols. --# CHECK-NEXT: data_global --# CHECK-NEXT: {{[0-9]+}} 4 --# CHECK-NEXT: /tmp/file.cpp:2 --# CHECK-EMPTY: --# CHECK-NEXT: str --# CHECK-NEXT: {{[0-9]+}} 8 --# CHECK-NEXT: /tmp/file.cpp:4 --# CHECK-EMPTY: --# CHECK-NEXT: f()::function_global --# CHECK-NEXT: {{[0-9]+}} 4 --# CHECK-NEXT: /tmp/file.cpp:8 --# CHECK-EMPTY: -- --## Including the one that includes an addend. --# CHECK-NEXT: alpha --# CHECK-NEXT: {{[0-9]+}} 4 --# CHECK-NEXT: /tmp/file.cpp:12 --# CHECK-EMPTY: --# CHECK-NEXT: beta --# CHECK-NEXT: {{[0-9]+}} 4 --# CHECK-NEXT: /tmp/file.cpp:13 --# CHECK-EMPTY: -- --## Ensure there's still a global that's offset-based. --# RUN: llvm-dwarfdump --debug-info %t.so | FileCheck %s --check-prefix=OFFSET -- --# OFFSET: DW_AT_location (DW_OP_addrx 0x4, DW_OP_plus_uconst 0x4) -- --################################################################################ --## File below was generated using: --## --## $ clang++ -g -O3 /tmp/file.cpp -shared -fuse-ld=lld -nostdlib \ --## -target aarch64-linux-gnuabi -mllvm -global-merge-ignore-single-use \ --## -o /tmp/file.so --## --## With /tmp/file.cpp as: --## 1: int bss_global; --## 2: int data_global = 2; --## 3: --## 4: const char* str = --## 5: "12345678"; --## 6: --## 7: int* f() { --## 8: static int function_global; --## 9: return &function_global; --## 10: } --## 11: --## 12: static int alpha; --## 13: static int beta; --## 14: int *f(bool b) { return beta ? &alpha : β } --## 15: --## --## ... then, one can get the offsets using `nm`, like: --## $ nm out.so | grep bss_global --## 00000000000038fc B bss_global --## --## Note the use of the aarch64 target (with -nostdlib in order to allow linkage --## without libraries for cross-compilation) as well as -O3 and --## -global-merge-ignore-single-use. This is a specific combination that makes --## the compiler emit the `alpha` global variable with a more complex --## DW_AT_location than just a DW_OP_addr/DW_OP_addrx. In this instance, it --## outputs a `DW_AT_location (DW_OP_addrx 0x4, DW_OP_plus_uconst 0x4)`. --## --## Ideally, this would be tested by invoking clang directly on a C source file, --## but unfortunately there's no way to do that for LLVM tests. The other option --## is to compile IR to an objfile, but llvm-symbolizer doesn't understand that --## two symbols can have the same address in different sections. In the code --## above, for example, we'd have bss_global at .bss+0x0, and data_global at --## .data+0x0, and so the symbolizer would only print one of them. Hence, we have --## the ugly dso-to-yaml blob below. --## --## For now, constant strings don't have a debuginfo entry, and so can't be --## symbolized correctly. In future (if D123534 gets merged), this can be updated --## to include a check that llvm-symbolizer can also symbolize constant strings, --## like `str` above (basically that &"12345678" should be symbolizable) --## to the specific line. Then, you can find the address of the constant string --## from the relocation: --## --## $ nm out.so | grep str --## 00000000000038c0 D str --## $ llvm-objdump -R out.so | grep 38c0 --## 00000000000038c0 R_X86_64_RELATIVE *ABS*+0x4f8 # <-- 0x4f8 --################################################################################ -- ----- !ELF --FileHeader: -- Class: ELFCLASS64 -- Data: ELFDATA2LSB -- Type: ET_DYN -- Machine: EM_AARCH64 --ProgramHeaders: -- - Type: PT_PHDR -- Flags: [ PF_R ] -- VAddr: 0x40 -- Align: 0x8 -- - Type: PT_LOAD -- Flags: [ PF_R ] -- FirstSec: .dynsym -- LastSec: .eh_frame -- Align: 0x10000 -- - Type: PT_LOAD -- Flags: [ PF_X, PF_R ] -- FirstSec: .text -- LastSec: .text -- VAddr: 0x103E4 -- Align: 0x10000 -- - Type: PT_LOAD -- Flags: [ PF_W, PF_R ] -- FirstSec: .dynamic -- LastSec: .dynamic -- VAddr: 0x20410 -- Align: 0x10000 -- - Type: PT_LOAD -- Flags: [ PF_W, PF_R ] -- FirstSec: .data -- LastSec: .bss -- VAddr: 0x304C0 -- Align: 0x10000 -- - Type: PT_DYNAMIC -- Flags: [ PF_W, PF_R ] -- FirstSec: .dynamic -- LastSec: .dynamic -- VAddr: 0x20410 -- Align: 0x8 -- - Type: PT_GNU_RELRO -- Flags: [ PF_R ] -- FirstSec: .dynamic -- LastSec: .dynamic -- VAddr: 0x20410 -- - Type: PT_GNU_EH_FRAME -- Flags: [ PF_R ] -- FirstSec: .eh_frame_hdr -- LastSec: .eh_frame_hdr -- VAddr: 0x37C -- Align: 0x4 -- - Type: PT_GNU_STACK -- Flags: [ PF_W, PF_R ] -- Align: 0x0 --Sections: -- - Name: .dynsym -- Type: SHT_DYNSYM -- Flags: [ SHF_ALLOC ] -- Address: 0x238 -- Link: .dynstr -- AddressAlign: 0x8 -- - Name: .gnu.hash -- Type: SHT_GNU_HASH -- Flags: [ SHF_ALLOC ] -- Address: 0x2C8 -- Link: .dynsym -- AddressAlign: 0x8 -- Header: -- SymNdx: 0x1 -- Shift2: 0x1A -- BloomFilter: [ 0x400188002180000C ] -- HashBuckets: [ 0x1 ] -- HashValues: [ 0xEE8502A, 0xEE85016, 0xC033991C, 0x61F7372E, 0xB88AB7F ] -- - Name: .hash -- Type: SHT_HASH -- Flags: [ SHF_ALLOC ] -- Address: 0x2F8 -- Link: .dynsym -- AddressAlign: 0x4 -- Bucket: [ 5, 0, 4, 0, 3, 0 ] -- Chain: [ 0, 0, 0, 1, 2, 0 ] -- - Name: .dynstr -- Type: SHT_STRTAB -- Flags: [ SHF_ALLOC ] -- Address: 0x330 -- AddressAlign: 0x1 -- - Name: .rela.dyn -- Type: SHT_RELA -- Flags: [ SHF_ALLOC ] -- Address: 0x358 -- Link: .dynsym -- AddressAlign: 0x8 -- Relocations: -- - Offset: 0x304C8 -- Type: R_AARCH64_RELATIVE -- Addend: 880 -- - Name: .rodata -- Type: SHT_PROGBITS -- Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ] -- Address: 0x370 -- AddressAlign: 0x1 -- EntSize: 0x1 -- Content: '313233343536373800' -- - Name: .eh_frame_hdr -- Type: SHT_PROGBITS -- Flags: [ SHF_ALLOC ] -- Address: 0x37C -- AddressAlign: 0x4 -- Content: 011B033B18000000020000006800010034000000740001004C000000 -- - Name: .eh_frame -- Type: SHT_PROGBITS -- Flags: [ SHF_ALLOC ] -- Address: 0x398 -- AddressAlign: 0x8 -- Content: 1400000000000000017A5200017C1E011B0C1F0000000000140000001C0000002C0001000C00000000000000000000001400000034000000200001001C000000000000000000000000000000 -- - Name: .text -- Type: SHT_PROGBITS -- Flags: [ SHF_ALLOC, SHF_EXECINSTR ] -- Address: 0x103E4 -- AddressAlign: 0x4 -- Content: 0001009000501391C0035FD60801009008611391E90308AA2A4540B85F0100710001899AC0035FD6 -- - Name: .dynamic -- Type: SHT_DYNAMIC -- Flags: [ SHF_WRITE, SHF_ALLOC ] -- Address: 0x20410 -- Link: .dynstr -- AddressAlign: 0x8 -- Entries: -- - Tag: DT_RELA -- Value: 0x358 -- - Tag: DT_RELASZ -- Value: 0x18 -- - Tag: DT_RELAENT -- Value: 0x18 -- - Tag: DT_RELACOUNT -- Value: 0x1 -- - Tag: DT_SYMTAB -- Value: 0x238 -- - Tag: DT_SYMENT -- Value: 0x18 -- - Tag: DT_STRTAB -- Value: 0x330 -- - Tag: DT_STRSZ -- Value: 0x28 -- - Tag: DT_GNU_HASH -- Value: 0x2C8 -- - Tag: DT_HASH -- Value: 0x2F8 -- - Tag: DT_NULL -- Value: 0x0 -- - Name: .data -- Type: SHT_PROGBITS -- Flags: [ SHF_WRITE, SHF_ALLOC ] -- Address: 0x304C0 -- AddressAlign: 0x8 -- Content: '02000000000000000000000000000000' -- - Name: .bss -- Type: SHT_NOBITS -- Flags: [ SHF_WRITE, SHF_ALLOC ] -- Address: 0x304D0 -- AddressAlign: 0x4 -- Size: 0x10 -- - Name: .debug_abbrev -- Type: SHT_PROGBITS -- AddressAlign: 0x1 -- Content: 011101252513050325721710171B25111B120673170000023400032549133F193A0B3B0B0218000003240003253E0B0B0B0000040F004913000005260049130000062E01111B120640187A196E2503253A0B3B0B49133F190000073400032549133A0B3B0B02180000083400032549133A0B3B0B02186E25000009050003253A0B3B0B4913000000 -- - Name: .debug_info -- Type: SHT_PROGBITS -- AddressAlign: 0x1 -- Content: AB0000000500010800000000010021000108000000000000000205280000000800000002032E000000000102A1000304050402052E000000000202A101020648000000000402A102044D00000005520000000307080106050C000000016F0D0E0007A500000007082E000000000802A1030008092E000000000D02A1040A080B2E000000000C04A10423040C06061C000000016F0F0E000EA50000000910000EAA00000000042E0000000311020100 -- - Name: .debug_str_offsets -- Type: SHT_PROGBITS -- AddressAlign: 0x1 -- Content: 4C00000005000000A2000000000000002C00000059000000280000001C00000072000000640000008C0000008700000069000000140000007B0000009C0000001A0000000E0000008500000076000000 -- - Name: .comment -- Type: SHT_PROGBITS -- Flags: [ SHF_MERGE, SHF_STRINGS ] -- AddressAlign: 0x1 -- EntSize: 0x1 -- Content: 4C696E6B65723A204C4C442031352E302E300000636C616E672076657273696F6E2031352E302E30202868747470733A2F2F6769746875622E636F6D2F6C6C766D2F6C6C766D2D70726F6A6563742E67697420306462616566363162353666306566306162306366333865613932666663316633356265653366662900 -- - Name: .debug_line -- Type: SHT_PROGBITS -- AddressAlign: 0x1 -- Content: 620000000500080037000000010101FB0E0D00010101010000000100000101011F010E00000003011F020F051E0100000000006C97BBE59F7DC6A9EA956633431DA63E0400000902E4030100000000001805030A140500BF05190A0105120608740204000101 -- - Name: .debug_line_str -- Type: SHT_PROGBITS -- Flags: [ SHF_MERGE, SHF_STRINGS ] -- AddressAlign: 0x1 -- EntSize: 0x1 -- Content: 2F746D702F66696C652E637070002F7573722F6C6F63616C2F676F6F676C652F686F6D652F6D69746368702F6C6C766D2D6275696C642F6F707400 --Symbols: -- - Name: file.cpp -- Type: STT_FILE -- Index: SHN_ABS -- - Name: '$x.0' -- Section: .text -- Value: 0x103E4 -- - Name: _ZZ1fvE15function_global -- Type: STT_OBJECT -- Section: .bss -- Value: 0x304D4 -- Size: 0x4 -- - Name: '$d.1' -- Section: .bss -- Value: 0x304D0 -- - Name: '$d.2' -- Section: .data -- Value: 0x304C0 -- - Name: '$d.3' -- Section: .rodata -- Value: 0x370 -- - Name: '$d.4' -- Section: .debug_abbrev -- - Name: '$d.5' -- Section: .debug_info -- - Name: '$d.6' -- Section: .debug_str_offsets -- - Name: '$d.7' -- Section: .debug_str -- Value: 0xA2 -- - Name: '$d.8' -- Section: .debug_addr -- - Name: _ZL4beta -- Type: STT_OBJECT -- Section: .bss -- Value: 0x304D8 -- Size: 0x4 -- - Name: _ZL5alpha -- Type: STT_OBJECT -- Section: .bss -- Value: 0x304DC -- Size: 0x4 -- - Name: '$d.9' -- Section: .comment -- Value: 0x13 -- - Name: '$d.10' -- Section: .eh_frame -- Value: 0x398 -- - Name: '$d.11' -- Section: .debug_line -- - Name: '$d.12' -- Section: .debug_line_str -- Value: 0xE -- - Name: _DYNAMIC -- Section: .dynamic -- Value: 0x20410 -- Other: [ STV_HIDDEN ] -- - Name: _Z1fv -- Type: STT_FUNC -- Section: .text -- Binding: STB_GLOBAL -- Value: 0x103E4 -- Size: 0xC -- - Name: _Z1fb -- Type: STT_FUNC -- Section: .text -- Binding: STB_GLOBAL -- Value: 0x103F0 -- Size: 0x1C -- - Name: bss_global -- Type: STT_OBJECT -- Section: .bss -- Binding: STB_GLOBAL -- Value: 0x304D0 -- Size: 0x4 -- - Name: data_global -- Type: STT_OBJECT -- Section: .data -- Binding: STB_GLOBAL -- Value: 0x304C0 -- Size: 0x4 -- - Name: str -- Type: STT_OBJECT -- Section: .data -- Binding: STB_GLOBAL -- Value: 0x304C8 -- Size: 0x8 --DynamicSymbols: -- - Name: _Z1fv -- Type: STT_FUNC -- Section: .text -- Binding: STB_GLOBAL -- Value: 0x103E4 -- Size: 0xC -- - Name: _Z1fb -- Type: STT_FUNC -- Section: .text -- Binding: STB_GLOBAL -- Value: 0x103F0 -- Size: 0x1C -- - Name: bss_global -- Type: STT_OBJECT -- Section: .bss -- Binding: STB_GLOBAL -- Value: 0x304D0 -- Size: 0x4 -- - Name: data_global -- Type: STT_OBJECT -- Section: .data -- Binding: STB_GLOBAL -- Value: 0x304C0 -- Size: 0x4 -- - Name: str -- Type: STT_OBJECT -- Section: .data -- Binding: STB_GLOBAL -- Value: 0x304C8 -- Size: 0x8 --DWARF: -- debug_str: -- - '/tmp/file.cpp' -- - _Z1fb -- - alpha -- - f -- - data_global -- - int -- - '/usr/local/google/home/mitchp/llvm-build/opt' -- - bss_global -- - char -- - _ZL4beta -- - str -- - bool -- - _ZL5alpha -- - b -- - beta -- - function_global -- - _Z1fv -- - 'clang version 15.0.0 (https://github.com/llvm/llvm-project.git 0dbaef61b56f0ef0ab0cf38ea92ffc1f35bee3ff)' -- debug_addr: -- - Length: 0x3C -- Version: 0x5 -- AddressSize: 0x8 -- Entries: -- - Address: 0x304D0 -- - Address: 0x304C0 -- - Address: 0x304C8 -- - Address: 0x304D4 -- - Address: 0x304D8 -- - Address: 0x103E4 -- - Address: 0x103F0 --... -diff --git a/llvm/test/tools/llvm-symbolizer/data.s b/llvm/test/tools/llvm-symbolizer/data.s -index cc9503c59141..e8039f146dbd 100644 ---- a/llvm/test/tools/llvm-symbolizer/data.s -+++ b/llvm/test/tools/llvm-symbolizer/data.s -@@ -7,12 +7,9 @@ - - # CHECK: d1 - # CHECK-NEXT: 0 8 --# CHECK-NEXT: ??:? - # CHECK-EMPTY: - # CHECK-NEXT: d2 - # CHECK-NEXT: 8 4 --# CHECK-NEXT: ??:? --# CHECK-EMPTY: - - d1: - .quad 0x1122334455667788 --- -2.38.1.1.g6d9df9d320 - diff --git a/build/build-clang/revert-llvmorg-17-init-4120-g02e8eb1a438b.patch b/build/build-clang/revert-llvmorg-17-init-4120-g02e8eb1a438b.patch deleted file mode 100644 index 63e59ee68b49..000000000000 --- a/build/build-clang/revert-llvmorg-17-init-4120-g02e8eb1a438b.patch +++ /dev/null @@ -1,118 +0,0 @@ -From 2836e92ea557be53fcd91e38cb05a989ad0167e9 Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Wed, 8 Mar 2023 14:44:58 +0900 -Subject: [PATCH] Revert "Split getCompileUnitFor{Data,Code}Address." - -This reverts commit 02e8eb1a438bdb1dc9a97aea75a8c9c748048039, which -applies on top of cead4eceb01b935fae07bf4a7e91911b344d2fec, that we -revert too. ---- - .../llvm/DebugInfo/DWARF/DWARFContext.h | 11 +-------- - llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 23 ++++++++----------- - 2 files changed, 11 insertions(+), 23 deletions(-) - -diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h -index 4eba79a7215f..df903b967ef6 100644 ---- a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h -+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h -@@ -445,16 +445,7 @@ public: - /// address. - /// TODO: change input parameter from "uint64_t Address" - /// into "SectionedAddress Address" -- DWARFCompileUnit *getCompileUnitForCodeAddress(uint64_t Address); -- -- /// Return the compile unit which contains data with the provided address. -- /// Note: This is more expensive than `getCompileUnitForAddress`, as if -- /// `Address` isn't found in the CU ranges (which is cheap), then it falls -- /// back to an expensive O(n) walk of all CU's looking for data that spans the -- /// address. -- /// TODO: change input parameter from "uint64_t Address" into -- /// "SectionedAddress Address" -- DWARFCompileUnit *getCompileUnitForDataAddress(uint64_t Address); -+ DWARFCompileUnit *getCompileUnitForAddress(uint64_t Address); - - /// Returns whether CU/TU should be populated manually. TU Index populated - /// manually only for DWARF5. -diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp -index f648ef8ff770..dd86144d16e0 100644 ---- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp -+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp -@@ -1118,17 +1118,14 @@ DWARFCompileUnit *DWARFContext::getCompileUnitForOffset(uint64_t Offset) { - NormalUnits.getUnitForOffset(Offset)); - } - --DWARFCompileUnit *DWARFContext::getCompileUnitForCodeAddress(uint64_t Address) { -- uint64_t CUOffset = getDebugAranges()->findAddress(Address); -- return getCompileUnitForOffset(CUOffset); --} -- --DWARFCompileUnit *DWARFContext::getCompileUnitForDataAddress(uint64_t Address) { -+DWARFCompileUnit *DWARFContext::getCompileUnitForAddress(uint64_t Address) { -+ // First, get the offset of the compile unit. - uint64_t CUOffset = getDebugAranges()->findAddress(Address); -+ // Retrieve the compile unit. - if (DWARFCompileUnit *OffsetCU = getCompileUnitForOffset(CUOffset)) - return OffsetCU; - -- // Global variables are often missed by the above search, for one of two -+ // Global variables are often not found by the above search, for one of two - // reasons: - // 1. .debug_aranges may not include global variables. On clang, it seems we - // put the globals in the aranges, but this isn't true for gcc. -@@ -1149,7 +1146,7 @@ DWARFCompileUnit *DWARFContext::getCompileUnitForDataAddress(uint64_t Address) { - DWARFContext::DIEsForAddress DWARFContext::getDIEsForAddress(uint64_t Address) { - DIEsForAddress Result; - -- DWARFCompileUnit *CU = getCompileUnitForCodeAddress(Address); -+ DWARFCompileUnit *CU = getCompileUnitForAddress(Address); - if (!CU) - return Result; - -@@ -1300,7 +1297,7 @@ void DWARFContext::addLocalsForDie(DWARFCompileUnit *CU, DWARFDie Subprogram, - std::vector - DWARFContext::getLocalsForAddress(object::SectionedAddress Address) { - std::vector Result; -- DWARFCompileUnit *CU = getCompileUnitForCodeAddress(Address.Address); -+ DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); - if (!CU) - return Result; - -@@ -1313,7 +1310,7 @@ DWARFContext::getLocalsForAddress(object::SectionedAddress Address) { - DILineInfo DWARFContext::getLineInfoForAddress(object::SectionedAddress Address, - DILineInfoSpecifier Spec) { - DILineInfo Result; -- DWARFCompileUnit *CU = getCompileUnitForCodeAddress(Address.Address); -+ DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); - if (!CU) - return Result; - -@@ -1334,7 +1331,7 @@ DILineInfo DWARFContext::getLineInfoForAddress(object::SectionedAddress Address, - DILineInfo - DWARFContext::getLineInfoForDataAddress(object::SectionedAddress Address) { - DILineInfo Result; -- DWARFCompileUnit *CU = getCompileUnitForDataAddress(Address.Address); -+ DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); - if (!CU) - return Result; - -@@ -1349,7 +1346,7 @@ DWARFContext::getLineInfoForDataAddress(object::SectionedAddress Address) { - DILineInfoTable DWARFContext::getLineInfoForAddressRange( - object::SectionedAddress Address, uint64_t Size, DILineInfoSpecifier Spec) { - DILineInfoTable Lines; -- DWARFCompileUnit *CU = getCompileUnitForCodeAddress(Address.Address); -+ DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); - if (!CU) - return Lines; - -@@ -1405,7 +1402,7 @@ DWARFContext::getInliningInfoForAddress(object::SectionedAddress Address, - DILineInfoSpecifier Spec) { - DIInliningInfo InliningInfo; - -- DWARFCompileUnit *CU = getCompileUnitForCodeAddress(Address.Address); -+ DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); - if (!CU) - return InliningInfo; - --- -2.39.0.1.g6739ec1790 - diff --git a/build/build-clang/revert-llvmorg-17-init-4120-g02e8eb1a438b_clang_18.patch b/build/build-clang/revert-llvmorg-17-init-4120-g02e8eb1a438b_clang_18.patch deleted file mode 100644 index 098c410790ab..000000000000 --- a/build/build-clang/revert-llvmorg-17-init-4120-g02e8eb1a438b_clang_18.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 2836e92ea557be53fcd91e38cb05a989ad0167e9 Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Wed, 8 Mar 2023 14:44:58 +0900 -Subject: [PATCH] Revert "Split getCompileUnitFor{Data,Code}Address." - -This reverts commit 02e8eb1a438bdb1dc9a97aea75a8c9c748048039, which -applies on top of cead4eceb01b935fae07bf4a7e91911b344d2fec, that we -revert too. ---- - .../llvm/DebugInfo/DWARF/DWARFContext.h | 11 +-------- - llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 23 ++++++++----------- - 2 files changed, 11 insertions(+), 23 deletions(-) - -diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h -index 4bd8394e6b4e..3f49fadc2b98 100644 ---- a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h -+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h -@@ -459,16 +459,7 @@ public: - /// address. - /// TODO: change input parameter from "uint64_t Address" - /// into "SectionedAddress Address" -- DWARFCompileUnit *getCompileUnitForCodeAddress(uint64_t Address); -- -- /// Return the compile unit which contains data with the provided address. -- /// Note: This is more expensive than `getCompileUnitForAddress`, as if -- /// `Address` isn't found in the CU ranges (which is cheap), then it falls -- /// back to an expensive O(n) walk of all CU's looking for data that spans the -- /// address. -- /// TODO: change input parameter from "uint64_t Address" into -- /// "SectionedAddress Address" -- DWARFCompileUnit *getCompileUnitForDataAddress(uint64_t Address); -+ DWARFCompileUnit *getCompileUnitForAddress(uint64_t Address); - - /// Returns whether CU/TU should be populated manually. TU Index populated - /// manually only for DWARF5. -diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp -index a45ed0e56553..692304ac6774 100644 ---- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp -+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp -@@ -1492,17 +1492,14 @@ DWARFCompileUnit *DWARFContext::getCompileUnitForOffset(uint64_t Offset) { - State->getNormalUnits().getUnitForOffset(Offset)); - } - --DWARFCompileUnit *DWARFContext::getCompileUnitForCodeAddress(uint64_t Address) { -- uint64_t CUOffset = getDebugAranges()->findAddress(Address); -- return getCompileUnitForOffset(CUOffset); --} -- --DWARFCompileUnit *DWARFContext::getCompileUnitForDataAddress(uint64_t Address) { -+DWARFCompileUnit *DWARFContext::getCompileUnitForAddress(uint64_t Address) { -+ // First, get the offset of the compile unit. - uint64_t CUOffset = getDebugAranges()->findAddress(Address); -+ // Retrieve the compile unit. - if (DWARFCompileUnit *OffsetCU = getCompileUnitForOffset(CUOffset)) - return OffsetCU; - -- // Global variables are often missed by the above search, for one of two -+ // Global variables are often not found by the above search, for one of two - // reasons: - // 1. .debug_aranges may not include global variables. On clang, it seems we - // put the globals in the aranges, but this isn't true for gcc. -@@ -1523,7 +1520,7 @@ DWARFCompileUnit *DWARFContext::getCompileUnitForDataAddress(uint64_t Address) { - bool CheckDWO) { - DIEsForAddress Result; - -- DWARFCompileUnit *CU = getCompileUnitForCodeAddress(Address); -+ DWARFCompileUnit *CU = getCompileUnitForAddress(Address); - if (!CU) - return Result; - -@@ -1674,7 +1671,7 @@ void DWARFContext::addLocalsForDie(DWARFCompileUnit *CU, DWARFDie Subprogram, - std::vector - DWARFContext::getLocalsForAddress(object::SectionedAddress Address) { - std::vector Result; -- DWARFCompileUnit *CU = getCompileUnitForCodeAddress(Address.Address); -+ DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); - if (!CU) - return Result; - -@@ -1687,7 +1684,7 @@ DWARFContext::getLocalsForAddress(object::SectionedAddress Address) { - DILineInfo DWARFContext::getLineInfoForAddress(object::SectionedAddress Address, - DILineInfoSpecifier Spec) { - DILineInfo Result; -- DWARFCompileUnit *CU = getCompileUnitForCodeAddress(Address.Address); -+ DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); - if (!CU) - return Result; - -@@ -1708,7 +1705,7 @@ DILineInfo DWARFContext::getLineInfoForAddress(object::SectionedAddress Address, - DILineInfo - DWARFContext::getLineInfoForDataAddress(object::SectionedAddress Address) { - DILineInfo Result; -- DWARFCompileUnit *CU = getCompileUnitForDataAddress(Address.Address); -+ DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); - if (!CU) - return Result; - -@@ -1723,7 +1720,7 @@ DWARFContext::getLineInfoForDataAddress(object::SectionedAddress Address) { - DILineInfoTable DWARFContext::getLineInfoForAddressRange( - object::SectionedAddress Address, uint64_t Size, DILineInfoSpecifier Spec) { - DILineInfoTable Lines; -- DWARFCompileUnit *CU = getCompileUnitForCodeAddress(Address.Address); -+ DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); - if (!CU) - return Lines; - -@@ -1779,7 +1776,7 @@ DWARFContext::getInliningInfoForAddress(object::SectionedAddress Address, - DILineInfoSpecifier Spec) { - DIInliningInfo InliningInfo; - -- DWARFCompileUnit *CU = getCompileUnitForCodeAddress(Address.Address); -+ DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); - if (!CU) - return InliningInfo; - diff --git a/build/build-clang/revert-llvmorg-19-init-6891-ga4de589d117a.patch b/build/build-clang/revert-llvmorg-19-init-6891-ga4de589d117a.patch deleted file mode 100644 index a54bb501a1a8..000000000000 --- a/build/build-clang/revert-llvmorg-19-init-6891-ga4de589d117a.patch +++ /dev/null @@ -1,547 +0,0 @@ -From 4ec62cd0d0eb38965cac21aca62b6ac01a5b052e Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Fri, 5 Apr 2024 05:59:24 +0900 -Subject: [PATCH 4/4] Revert "[InstallAPI] Add support for parsing dSYMs - (#86852)" - -This reverts commit a4de589d117a4fd52554da3c61ae6eb26c90a0c8. ---- - .../include/clang/InstallAPI/DylibVerifier.h | 20 +--- - clang/include/clang/InstallAPI/MachO.h | 1 - - clang/lib/InstallAPI/CMakeLists.txt | 1 - - clang/lib/InstallAPI/DylibVerifier.cpp | 71 +++-------- - clang/test/InstallAPI/diagnostics-dsym.test | 43 ------- - .../tools/clang-installapi/InstallAPIOpts.td | 2 - - clang/tools/clang-installapi/Options.cpp | 6 +- - clang/tools/clang-installapi/Options.h | 3 - - llvm/include/llvm/TextAPI/DylibReader.h | 9 -- - llvm/include/llvm/TextAPI/Record.h | 17 --- - llvm/lib/TextAPI/BinaryReader/CMakeLists.txt | 1 - - llvm/lib/TextAPI/BinaryReader/DylibReader.cpp | 111 +----------------- - 12 files changed, 22 insertions(+), 263 deletions(-) - delete mode 100644 clang/test/InstallAPI/diagnostics-dsym.test - -diff --git a/clang/include/clang/InstallAPI/DylibVerifier.h b/clang/include/clang/InstallAPI/DylibVerifier.h -index 22cdc234486c..49de24763f1f 100644 ---- a/clang/include/clang/InstallAPI/DylibVerifier.h -+++ b/clang/include/clang/InstallAPI/DylibVerifier.h -@@ -31,7 +31,6 @@ enum class VerificationMode { - class DylibVerifier : llvm::MachO::RecordVisitor { - private: - struct SymbolContext; -- struct DWARFContext; - - public: - enum class Result { NoVerify, Ignore, Valid, Invalid }; -@@ -55,7 +54,7 @@ public: - DiagnosticsEngine *Diag = nullptr; - - // Handle diagnostics reporting for target level violations. -- void emitDiag(llvm::function_ref Report, RecordLoc *Loc = nullptr); -+ void emitDiag(llvm::function_ref Report); - - VerifierContext() = default; - VerifierContext(DiagnosticsEngine *Diag) : Diag(Diag) {} -@@ -64,10 +63,9 @@ public: - DylibVerifier() = default; - - DylibVerifier(llvm::MachO::Records &&Dylib, DiagnosticsEngine *Diag, -- VerificationMode Mode, bool Demangle, StringRef DSYMPath) -+ VerificationMode Mode, bool Demangle) - : Dylib(std::move(Dylib)), Mode(Mode), Demangle(Demangle), -- DSYMPath(DSYMPath), Exports(std::make_unique()), -- Ctx(VerifierContext{Diag}) {} -+ Exports(std::make_unique()), Ctx(VerifierContext{Diag}) {} - - Result verify(GlobalRecord *R, const FrontendAttrs *FA); - Result verify(ObjCInterfaceRecord *R, const FrontendAttrs *FA); -@@ -145,12 +143,6 @@ private: - std::string getAnnotatedName(const Record *R, SymbolContext &SymCtx, - bool ValidSourceLoc = true); - -- /// Extract source location for symbol implementations. -- /// As this is a relatively expensive operation, it is only used -- /// when there is a violation to report and there is not a known declaration -- /// in the interface. -- void accumulateSrcLocForDylibSymbols(); -- - // Symbols in dylib. - llvm::MachO::Records Dylib; - -@@ -160,17 +152,11 @@ private: - // Attempt to demangle when reporting violations. - bool Demangle = false; - -- // File path to DSYM file. -- StringRef DSYMPath; -- - // Valid symbols in final text file. - std::unique_ptr Exports = std::make_unique(); - - // Track current state of verification while traversing AST. - VerifierContext Ctx; -- -- // Track DWARF provided source location for dylibs. -- DWARFContext *DWARFCtx = nullptr; - }; - - } // namespace installapi -diff --git a/clang/include/clang/InstallAPI/MachO.h b/clang/include/clang/InstallAPI/MachO.h -index 827220dbf39f..4961c596fd68 100644 ---- a/clang/include/clang/InstallAPI/MachO.h -+++ b/clang/include/clang/InstallAPI/MachO.h -@@ -34,7 +34,6 @@ using ObjCCategoryRecord = llvm::MachO::ObjCCategoryRecord; - using ObjCIVarRecord = llvm::MachO::ObjCIVarRecord; - using ObjCIFSymbolKind = llvm::MachO::ObjCIFSymbolKind; - using Records = llvm::MachO::Records; --using RecordLoc = llvm::MachO::RecordLoc; - using RecordsSlice = llvm::MachO::RecordsSlice; - using BinaryAttrs = llvm::MachO::RecordsSlice::BinaryAttrs; - using SymbolSet = llvm::MachO::SymbolSet; -diff --git a/clang/lib/InstallAPI/CMakeLists.txt b/clang/lib/InstallAPI/CMakeLists.txt -index e0bc8d969ecb..894db699578f 100644 ---- a/clang/lib/InstallAPI/CMakeLists.txt -+++ b/clang/lib/InstallAPI/CMakeLists.txt -@@ -1,7 +1,6 @@ - set(LLVM_LINK_COMPONENTS - Support - TextAPI -- TextAPIBinaryReader - Demangle - Core - ) -diff --git a/clang/lib/InstallAPI/DylibVerifier.cpp b/clang/lib/InstallAPI/DylibVerifier.cpp -index c0eda1d81b9b..ba25e4183a9b 100644 ---- a/clang/lib/InstallAPI/DylibVerifier.cpp -+++ b/clang/lib/InstallAPI/DylibVerifier.cpp -@@ -10,7 +10,6 @@ - #include "clang/InstallAPI/FrontendRecords.h" - #include "clang/InstallAPI/InstallAPIDiagnostic.h" - #include "llvm/Demangle/Demangle.h" --#include "llvm/TextAPI/DylibReader.h" - - using namespace llvm::MachO; - -@@ -36,14 +35,6 @@ struct DylibVerifier::SymbolContext { - bool Inlined = false; - }; - --struct DylibVerifier::DWARFContext { -- // Track whether DSYM parsing has already been attempted to avoid re-parsing. -- bool ParsedDSYM{false}; -- -- // Lookup table for source locations by symbol name. -- DylibReader::SymbolToSourceLocMap SourceLocs{}; --}; -- - static bool isCppMangled(StringRef Name) { - // InstallAPI currently only supports itanium manglings. - return (Name.starts_with("_Z") || Name.starts_with("__Z") || -@@ -520,16 +511,14 @@ DylibVerifier::Result DylibVerifier::verify(GlobalRecord *R, - return verifyImpl(R, SymCtx); - } - --void DylibVerifier::VerifierContext::emitDiag(llvm::function_ref Report, -- RecordLoc *Loc) { -+void DylibVerifier::VerifierContext::emitDiag( -+ llvm::function_ref Report) { - if (!DiscoveredFirstError) { - Diag->Report(diag::warn_target) - << (PrintArch ? getArchitectureName(Target.Arch) - : getTargetTripleName(Target)); - DiscoveredFirstError = true; - } -- if (Loc && Loc->isValid()) -- llvm::errs() << Loc->File << ":" << Loc->Line << ":" << 0 << ": "; - - Report(); - } -@@ -572,36 +561,26 @@ void DylibVerifier::visitSymbolInDylib(const Record &R, SymbolContext &SymCtx) { - return; - } - -- const bool IsLinkerSymbol = SymbolName.starts_with("$ld$"); -- -- // All checks at this point classify as some kind of violation. -- // The different verification modes dictate whether they are reported to the -- // user. -- if (IsLinkerSymbol || (Mode > VerificationMode::ErrorsOnly)) -- accumulateSrcLocForDylibSymbols(); -- RecordLoc Loc = DWARFCtx->SourceLocs.lookup(SymCtx.SymbolName); -+ // All checks at this point classify as some kind of violation that should be -+ // reported. - - // Regardless of verification mode, error out on mismatched special linker - // symbols. -- if (IsLinkerSymbol) { -- Ctx.emitDiag( -- [&]() { -- Ctx.Diag->Report(diag::err_header_symbol_missing) -- << getAnnotatedName(&R, SymCtx, Loc.isValid()); -- }, -- &Loc); -+ if (SymbolName.starts_with("$ld$")) { -+ Ctx.emitDiag([&]() { -+ Ctx.Diag->Report(diag::err_header_symbol_missing) -+ << getAnnotatedName(&R, SymCtx, /*ValidSourceLoc=*/false); -+ }); - updateState(Result::Invalid); - return; - } - - // Missing declarations for exported symbols are hard errors on Pedantic mode. - if (Mode == VerificationMode::Pedantic) { -- Ctx.emitDiag( -- [&]() { -- Ctx.Diag->Report(diag::err_header_symbol_missing) -- << getAnnotatedName(&R, SymCtx, Loc.isValid()); -- }, -- &Loc); -+ Ctx.emitDiag([&]() { -+ Ctx.Diag->Report(diag::err_header_symbol_missing) -+ << getAnnotatedName(&R, SymCtx, /*ValidSourceLoc=*/false); -+ }); - updateState(Result::Invalid); - return; - } -@@ -609,12 +588,10 @@ void DylibVerifier::visitSymbolInDylib(const Record &R, SymbolContext &SymCtx) { - // Missing declarations for exported symbols are warnings on ErrorsAndWarnings - // mode. - if (Mode == VerificationMode::ErrorsAndWarnings) { -- Ctx.emitDiag( -- [&]() { -- Ctx.Diag->Report(diag::warn_header_symbol_missing) -- << getAnnotatedName(&R, SymCtx, Loc.isValid()); -- }, -- &Loc); -+ Ctx.emitDiag([&]() { -+ Ctx.Diag->Report(diag::warn_header_symbol_missing) -+ << getAnnotatedName(&R, SymCtx, /*ValidSourceLoc=*/false); -+ }); - updateState(Result::Ignore); - return; - } -@@ -645,18 +622,6 @@ void DylibVerifier::visitObjCIVar(const ObjCIVarRecord &R, - visitSymbolInDylib(R, SymCtx); - } - --void DylibVerifier::accumulateSrcLocForDylibSymbols() { -- if (DSYMPath.empty()) -- return; -- -- assert(DWARFCtx != nullptr && "Expected an initialized DWARFContext"); -- if (DWARFCtx->ParsedDSYM) -- return; -- DWARFCtx->ParsedDSYM = true; -- DWARFCtx->SourceLocs = -- DylibReader::accumulateSourceLocFromDSYM(DSYMPath, Ctx.Target); --} -- - void DylibVerifier::visitObjCInterface(const ObjCInterfaceRecord &R) { - if (R.isVerified()) - return; -@@ -690,8 +655,6 @@ DylibVerifier::Result DylibVerifier::verifyRemainingSymbols() { - return Result::NoVerify; - assert(!Dylib.empty() && "No binary to verify against"); - -- DWARFContext DWARFInfo; -- DWARFCtx = &DWARFInfo; - Ctx.DiscoveredFirstError = false; - Ctx.PrintArch = true; - for (std::shared_ptr Slice : Dylib) { -diff --git a/clang/test/InstallAPI/diagnostics-dsym.test b/clang/test/InstallAPI/diagnostics-dsym.test -deleted file mode 100644 -index ee2c8b32df29..000000000000 ---- a/clang/test/InstallAPI/diagnostics-dsym.test -+++ /dev/null -@@ -1,43 +0,0 @@ --; REQUIRES: system-darwin -- --; RUN: rm -rf %t --; RUN: split-file %s %t -- --// Build a simple dylib with debug info. --; RUN: %clang --target=arm64-apple-macos13 -g -dynamiclib %t/foo.c \ --; RUN: -current_version 1 -compatibility_version 1 -L%t/usr/lib \ --; RUN: -save-temps \ --; RUN: -o %t/foo.dylib -install_name %t/foo.dylib --; RUN: dsymutil %t/foo.dylib -o %t/foo.dSYM -- --; RUN: not clang-installapi -x c++ --target=arm64-apple-macos13 \ --; RUN: -install_name %t/foo.dylib \ --; RUN: -current_version 1 -compatibility_version 1 \ --; RUN: -o %t/output.tbd \ --; RUN: --verify-against=%t/foo.dylib --dsym=%t/foo.dSYM \ --; RUN: --verify-mode=Pedantic 2>&1 | FileCheck %s -- --; CHECK: violations found for arm64 --; CHECK: foo.c:5:0: error: no declaration found for exported symbol 'bar' in dynamic library --; CHECK: foo.c:1:0: error: no declaration found for exported symbol 'foo' in dynamic library -- --;--- foo.c --int foo(void) { -- return 1; --} --extern char bar; --char bar = 'a'; -- --;--- usr/lib/libSystem.tbd --{ -- "main_library": { -- "install_names": [ -- {"name": "/usr/lib/libSystem.B.dylib"} -- ], -- "target_info": [ -- {"target": "arm64-macos"} -- ] -- }, -- "tapi_tbd_version": 5 --} -- -diff --git a/clang/tools/clang-installapi/InstallAPIOpts.td b/clang/tools/clang-installapi/InstallAPIOpts.td -index 010f2507a1d1..71532c9cf24d 100644 ---- a/clang/tools/clang-installapi/InstallAPIOpts.td -+++ b/clang/tools/clang-installapi/InstallAPIOpts.td -@@ -29,8 +29,6 @@ def verify_mode_EQ : Joined<["--"], "verify-mode=">, - HelpText<"Specify the severity and extend of the validation. Valid modes are ErrorsOnly, ErrorsAndWarnings, and Pedantic.">; - def demangle : Flag<["--", "-"], "demangle">, - HelpText<"Demangle symbols when printing warnings and errors">; --def dsym: Joined<["--"], "dsym=">, -- MetaVarName<"">, HelpText<"Specify dSYM path for enriched diagnostics.">; - - // Additional input options. - def extra_project_header : Separate<["-"], "extra-project-header">, -diff --git a/clang/tools/clang-installapi/Options.cpp b/clang/tools/clang-installapi/Options.cpp -index c4f39b7c8417..8e4a1b019fd8 100644 ---- a/clang/tools/clang-installapi/Options.cpp -+++ b/clang/tools/clang-installapi/Options.cpp -@@ -241,9 +241,6 @@ Options::processAndFilterOutInstallAPIOptions(ArrayRef Args) { - if (const Arg *A = ParsedArgs.getLastArg(OPT_verify_against)) - DriverOpts.DylibToVerify = A->getValue(); - -- if (const Arg *A = ParsedArgs.getLastArg(OPT_dsym)) -- DriverOpts.DSYMPath = A->getValue(); -- - // Handle exclude & extra header directories or files. - auto handleAdditionalInputArgs = [&](PathSeq &Headers, - clang::installapi::ID OptID) { -@@ -525,8 +522,7 @@ InstallAPIContext Options::createContext() { - } - - Ctx.Verifier = std::make_unique( -- std::move(*Slices), Diags, DriverOpts.VerifyMode, DriverOpts.Demangle, -- DriverOpts.DSYMPath); -+ std::move(*Slices), Diags, DriverOpts.VerifyMode, DriverOpts.Demangle); - return Ctx; - } - -diff --git a/clang/tools/clang-installapi/Options.h b/clang/tools/clang-installapi/Options.h -index 82e04b49d125..3671e4c8274b 100644 ---- a/clang/tools/clang-installapi/Options.h -+++ b/clang/tools/clang-installapi/Options.h -@@ -67,9 +67,6 @@ struct DriverOptions { - /// \brief Output path. - std::string OutputPath; - -- /// \brief DSYM path. -- std::string DSYMPath; -- - /// \brief File encoding to print. - FileType OutFT = FileType::TBD_V5; - -diff --git a/llvm/include/llvm/TextAPI/DylibReader.h b/llvm/include/llvm/TextAPI/DylibReader.h -index 6861d3cb1591..b556fbf6832a 100644 ---- a/llvm/include/llvm/TextAPI/DylibReader.h -+++ b/llvm/include/llvm/TextAPI/DylibReader.h -@@ -13,7 +13,6 @@ - #ifndef LLVM_TEXTAPI_DYLIBREADER_H - #define LLVM_TEXTAPI_DYLIBREADER_H - --#include "llvm/ADT/StringMap.h" - #include "llvm/Support/Error.h" - #include "llvm/Support/MemoryBuffer.h" - #include "llvm/TextAPI/ArchitectureSet.h" -@@ -44,14 +43,6 @@ Expected readFile(MemoryBufferRef Buffer, const ParseOption &Opt); - /// \param Buffer Data that points to dylib. - Expected> get(MemoryBufferRef Buffer); - --using SymbolToSourceLocMap = llvm::StringMap; --/// Get the source location for each symbol from dylib. --/// --/// \param DSYM Path to DSYM file. --/// \param T Requested target slice for dylib. --SymbolToSourceLocMap accumulateSourceLocFromDSYM(const StringRef DSYM, -- const Target &T); -- - } // namespace llvm::MachO::DylibReader - - #endif // LLVM_TEXTAPI_DYLIBREADER_H -diff --git a/llvm/include/llvm/TextAPI/Record.h b/llvm/include/llvm/TextAPI/Record.h -index 7d721988ec3d..ef152ce43387 100644 ---- a/llvm/include/llvm/TextAPI/Record.h -+++ b/llvm/include/llvm/TextAPI/Record.h -@@ -27,23 +27,6 @@ LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE(); - - class RecordsSlice; - --// Defines lightweight source location for records. --struct RecordLoc { -- RecordLoc() = default; -- RecordLoc(std::string File, unsigned Line) -- : File(std::move(File)), Line(Line) {} -- -- /// Whether there is source location tied to the RecordLoc object. -- bool isValid() const { return !File.empty(); } -- -- bool operator==(const RecordLoc &O) const { -- return std::tie(File, Line) == std::tie(O.File, O.Line); -- } -- -- const std::string File; -- const unsigned Line = 0; --}; -- - // Defines a list of linkage types. - enum class RecordLinkage : uint8_t { - // Unknown linkage. -diff --git a/llvm/lib/TextAPI/BinaryReader/CMakeLists.txt b/llvm/lib/TextAPI/BinaryReader/CMakeLists.txt -index c4535310d91c..cbdf7b2c9696 100644 ---- a/llvm/lib/TextAPI/BinaryReader/CMakeLists.txt -+++ b/llvm/lib/TextAPI/BinaryReader/CMakeLists.txt -@@ -2,7 +2,6 @@ add_llvm_component_library(LLVMTextAPIBinaryReader - DylibReader.cpp - - LINK_COMPONENTS -- DebugInfoDWARF - Support - Object - TextAPI -diff --git a/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp b/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp -index f92a2d19a63f..2e36d4a8b98c 100644 ---- a/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp -+++ b/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp -@@ -12,8 +12,7 @@ - - #include "llvm/TextAPI/DylibReader.h" - #include "llvm/ADT/STLExtras.h" --#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h" --#include "llvm/DebugInfo/DWARF/DWARFContext.h" -+#include "llvm/ADT/StringMap.h" - #include "llvm/Object/Binary.h" - #include "llvm/Object/MachOUniversal.h" - #include "llvm/Support/Endian.h" -@@ -433,111 +432,3 @@ DylibReader::get(MemoryBufferRef Buffer) { - - return convertToInterfaceFile(*SlicesOrErr); - } -- --static void DWARFErrorHandler(Error Err) { /**/ } -- --static SymbolToSourceLocMap --accumulateLocs(MachOObjectFile &Obj, -- const std::unique_ptr &DiCtx) { -- SymbolToSourceLocMap LocMap; -- for (const auto &Symbol : Obj.symbols()) { -- Expected FlagsOrErr = Symbol.getFlags(); -- if (!FlagsOrErr) { -- consumeError(FlagsOrErr.takeError()); -- continue; -- } -- -- if (!(*FlagsOrErr & SymbolRef::SF_Exported)) -- continue; -- -- Expected AddressOrErr = Symbol.getAddress(); -- if (!AddressOrErr) { -- consumeError(AddressOrErr.takeError()); -- continue; -- } -- const uint64_t Address = *AddressOrErr; -- -- auto TypeOrErr = Symbol.getType(); -- if (!TypeOrErr) { -- consumeError(TypeOrErr.takeError()); -- continue; -- } -- const bool IsCode = (*TypeOrErr & SymbolRef::ST_Function); -- -- auto *DWARFCU = IsCode ? DiCtx->getCompileUnitForCodeAddress(Address) -- : DiCtx->getCompileUnitForDataAddress(Address); -- if (!DWARFCU) -- continue; -- -- const DWARFDie &DIE = IsCode ? DWARFCU->getSubroutineForAddress(Address) -- : DWARFCU->getVariableForAddress(Address); -- const std::string File = DIE.getDeclFile( -- llvm::DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath); -- const uint64_t Line = DIE.getDeclLine(); -- -- auto NameOrErr = Symbol.getName(); -- if (!NameOrErr) { -- consumeError(NameOrErr.takeError()); -- continue; -- } -- auto Name = *NameOrErr; -- auto Sym = parseSymbol(Name); -- -- if (!File.empty() && Line != 0) -- LocMap.insert({Sym.Name.str(), RecordLoc(File, Line)}); -- } -- -- return LocMap; --} -- --SymbolToSourceLocMap --DylibReader::accumulateSourceLocFromDSYM(const StringRef DSYM, -- const Target &T) { -- // Find sidecar file. -- auto DSYMsOrErr = MachOObjectFile::findDsymObjectMembers(DSYM); -- if (!DSYMsOrErr) { -- consumeError(DSYMsOrErr.takeError()); -- return SymbolToSourceLocMap(); -- } -- if (DSYMsOrErr->empty()) -- return SymbolToSourceLocMap(); -- -- const StringRef Path = DSYMsOrErr->front(); -- auto BufOrErr = MemoryBuffer::getFile(Path); -- if (auto Err = BufOrErr.getError()) -- return SymbolToSourceLocMap(); -- -- auto BinOrErr = createBinary(*BufOrErr.get()); -- if (!BinOrErr) { -- consumeError(BinOrErr.takeError()); -- return SymbolToSourceLocMap(); -- } -- // Handle single arch. -- if (auto *Single = dyn_cast(BinOrErr->get())) { -- auto DiCtx = DWARFContext::create( -- *Single, DWARFContext::ProcessDebugRelocations::Process, nullptr, "", -- DWARFErrorHandler, DWARFErrorHandler); -- -- return accumulateLocs(*Single, DiCtx); -- } -- // Handle universal companion file. -- if (auto *Fat = dyn_cast(BinOrErr->get())) { -- auto ObjForArch = Fat->getObjectForArch(getArchitectureName(T.Arch)); -- if (!ObjForArch) { -- consumeError(ObjForArch.takeError()); -- return SymbolToSourceLocMap(); -- } -- auto MachOOrErr = ObjForArch->getAsObjectFile(); -- if (!MachOOrErr) { -- consumeError(MachOOrErr.takeError()); -- return SymbolToSourceLocMap(); -- } -- auto &Obj = **MachOOrErr; -- auto DiCtx = DWARFContext::create( -- Obj, DWARFContext::ProcessDebugRelocations::Process, nullptr, "", -- DWARFErrorHandler, DWARFErrorHandler); -- -- return accumulateLocs(Obj, DiCtx); -- } -- return SymbolToSourceLocMap(); --} --- -2.44.0.1.g9765aa7075 - diff --git a/build/build-clang/revert-llvmorg-19-init-6898-g60deb8b39afe.patch b/build/build-clang/revert-llvmorg-19-init-6898-g60deb8b39afe.patch deleted file mode 100644 index f6a566c199b1..000000000000 --- a/build/build-clang/revert-llvmorg-19-init-6898-g60deb8b39afe.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 3675bcd1e8d3026aa5f1c232986ce43c7cf72cd9 Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Fri, 5 Apr 2024 05:59:19 +0900 -Subject: [PATCH 3/4] Revert "[InstallAPI][test] Tweak test to run on older CI - config" - -This reverts commit 60deb8b39afe9be90e30aa18d77ad129dacd4d55. ---- - clang/test/InstallAPI/diagnostics-dsym.test | 26 ++++++++++++--------- - 1 file changed, 15 insertions(+), 11 deletions(-) - -diff --git a/clang/test/InstallAPI/diagnostics-dsym.test b/clang/test/InstallAPI/diagnostics-dsym.test -index 45c69c09d286..ee2c8b32df29 100644 ---- a/clang/test/InstallAPI/diagnostics-dsym.test -+++ b/clang/test/InstallAPI/diagnostics-dsym.test -@@ -4,20 +4,20 @@ - ; RUN: split-file %s %t - - // Build a simple dylib with debug info. --; RUN: %clang --target=x86_64-apple-macos10.15 -g -dynamiclib %t/foo.c \ -+; RUN: %clang --target=arm64-apple-macos13 -g -dynamiclib %t/foo.c \ - ; RUN: -current_version 1 -compatibility_version 1 -L%t/usr/lib \ - ; RUN: -save-temps \ - ; RUN: -o %t/foo.dylib -install_name %t/foo.dylib - ; RUN: dsymutil %t/foo.dylib -o %t/foo.dSYM - --; RUN: not clang-installapi -x c++ --target=x86_64-apple-macos10.15 \ -+; RUN: not clang-installapi -x c++ --target=arm64-apple-macos13 \ - ; RUN: -install_name %t/foo.dylib \ - ; RUN: -current_version 1 -compatibility_version 1 \ - ; RUN: -o %t/output.tbd \ - ; RUN: --verify-against=%t/foo.dylib --dsym=%t/foo.dSYM \ - ; RUN: --verify-mode=Pedantic 2>&1 | FileCheck %s - --; CHECK: violations found for x86_64 -+; CHECK: violations found for arm64 - ; CHECK: foo.c:5:0: error: no declaration found for exported symbol 'bar' in dynamic library - ; CHECK: foo.c:1:0: error: no declaration found for exported symbol 'foo' in dynamic library - -@@ -29,11 +29,15 @@ extern char bar; - char bar = 'a'; - - ;--- usr/lib/libSystem.tbd ----- !tapi-tbd --tbd-version: 4 --targets: [ x86_64-macos ] --install-name: '/usr/lib/libSystem.B.dylib' --exports: -- - targets: [ x86_64-macos ] -- symbols: [ dyld_stub_binder ] --... -+{ -+ "main_library": { -+ "install_names": [ -+ {"name": "/usr/lib/libSystem.B.dylib"} -+ ], -+ "target_info": [ -+ {"target": "arm64-macos"} -+ ] -+ }, -+ "tapi_tbd_version": 5 -+} -+ --- -2.44.0.1.g9765aa7075 - diff --git a/build/build-clang/revert-llvmorg-19-init-6902-gbdb60e6f0c8e.patch b/build/build-clang/revert-llvmorg-19-init-6902-gbdb60e6f0c8e.patch deleted file mode 100644 index 28a27dc7cca6..000000000000 --- a/build/build-clang/revert-llvmorg-19-init-6902-gbdb60e6f0c8e.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 79ff81df7b4593769ec40539e7a669e7d038efd1 Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Fri, 5 Apr 2024 05:59:15 +0900 -Subject: [PATCH 2/4] Revert "[InstallAPI][test] Add requires x86_64 for - hardcoded target test" - -This reverts commit bdb60e6f0c8e89abf9bdf36411348db304ca65ba. ---- - clang/test/InstallAPI/diagnostics-dsym.test | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/clang/test/InstallAPI/diagnostics-dsym.test b/clang/test/InstallAPI/diagnostics-dsym.test -index 8a1b394f2f86..45c69c09d286 100644 ---- a/clang/test/InstallAPI/diagnostics-dsym.test -+++ b/clang/test/InstallAPI/diagnostics-dsym.test -@@ -1,4 +1,4 @@ --; REQUIRES: 86_64-darwin -+; REQUIRES: system-darwin - - ; RUN: rm -rf %t - ; RUN: split-file %s %t --- -2.44.0.1.g9765aa7075 - diff --git a/build/build-clang/revert-llvmorg-19-init-7044-g30fd099d5062.patch b/build/build-clang/revert-llvmorg-19-init-7044-g30fd099d5062.patch deleted file mode 100644 index eac26c075cb1..000000000000 --- a/build/build-clang/revert-llvmorg-19-init-7044-g30fd099d5062.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 30a876f2ca438ebbd1db53c5008759f565940d2b Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Fri, 5 Apr 2024 05:59:08 +0900 -Subject: [PATCH 1/4] Revert "[InstallAPI] Fixup dsym test (#87299)" - -This reverts commit 30fd099d5062638b5fe6b89135ad6433a888023a. ---- - clang/test/InstallAPI/diagnostics-dsym.test | 13 ++++++------- - 1 file changed, 6 insertions(+), 7 deletions(-) - -diff --git a/clang/test/InstallAPI/diagnostics-dsym.test b/clang/test/InstallAPI/diagnostics-dsym.test -index c9cbeffef7ba..8a1b394f2f86 100644 ---- a/clang/test/InstallAPI/diagnostics-dsym.test -+++ b/clang/test/InstallAPI/diagnostics-dsym.test -@@ -1,24 +1,23 @@ --; REQUIRES: system-darwin --; REQUIRES: target-aarch64 -+; REQUIRES: 86_64-darwin - - ; RUN: rm -rf %t - ; RUN: split-file %s %t - - // Build a simple dylib with debug info. --; RUN: %clang --target=arm64-apple-macos11 -g -dynamiclib %t/foo.c \ -+; RUN: %clang --target=x86_64-apple-macos10.15 -g -dynamiclib %t/foo.c \ - ; RUN: -current_version 1 -compatibility_version 1 -L%t/usr/lib \ - ; RUN: -save-temps \ - ; RUN: -o %t/foo.dylib -install_name %t/foo.dylib - ; RUN: dsymutil %t/foo.dylib -o %t/foo.dSYM - --; RUN: not clang-installapi -x c++ --target=arm64-apple-macos11 \ -+; RUN: not clang-installapi -x c++ --target=x86_64-apple-macos10.15 \ - ; RUN: -install_name %t/foo.dylib \ - ; RUN: -current_version 1 -compatibility_version 1 \ - ; RUN: -o %t/output.tbd \ - ; RUN: --verify-against=%t/foo.dylib --dsym=%t/foo.dSYM \ - ; RUN: --verify-mode=Pedantic 2>&1 | FileCheck %s - --; CHECK: violations found for arm64 -+; CHECK: violations found for x86_64 - ; CHECK: foo.c:5:0: error: no declaration found for exported symbol 'bar' in dynamic library - ; CHECK: foo.c:1:0: error: no declaration found for exported symbol 'foo' in dynamic library - -@@ -32,9 +31,9 @@ char bar = 'a'; - ;--- usr/lib/libSystem.tbd - --- !tapi-tbd - tbd-version: 4 --targets: [ arm64-macos ] -+targets: [ x86_64-macos ] - install-name: '/usr/lib/libSystem.B.dylib' - exports: -- - targets: [ arm64-macos ] -+ - targets: [ x86_64-macos ] - symbols: [ dyld_stub_binder ] - ... --- -2.44.0.1.g9765aa7075 - diff --git a/build/build-clang/revert-llvmorg-19-init-7501-g27b2d7d4bb79.patch b/build/build-clang/revert-llvmorg-19-init-7501-g27b2d7d4bb79.patch deleted file mode 100644 index bf2893c41d77..000000000000 --- a/build/build-clang/revert-llvmorg-19-init-7501-g27b2d7d4bb79.patch +++ /dev/null @@ -1,2696 +0,0 @@ -From 6fa607c553cbcf6ba31b08ec73a0e57e3ba2a19f Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Thu, 11 Apr 2024 08:54:05 +0900 -Subject: [PATCH 3/3] Revert "[InstallAPI] Capture & compare load commands that - may differ per arch slice (#87674)" - -This reverts commit 27b2d7d4bb790ec1e7430bf18b1bc2f6e0800d0d. ---- - .../clang/Basic/DiagnosticDriverKinds.td | 1 - - .../clang/Basic/DiagnosticInstallAPIKinds.td | 21 - - clang/include/clang/InstallAPI/Context.h | 17 - - .../include/clang/InstallAPI/DylibVerifier.h | 29 +- - clang/include/clang/InstallAPI/MachO.h | 2 - - clang/lib/InstallAPI/CMakeLists.txt | 1 - - .../InstallAPI/DiagnosticBuilderWrappers.cpp | 109 --- - .../InstallAPI/DiagnosticBuilderWrappers.h | 49 -- - clang/lib/InstallAPI/DylibVerifier.cpp | 196 ------ - clang/lib/InstallAPI/Frontend.cpp | 54 -- - clang/test/InstallAPI/binary-attributes.test | 76 -- - .../InstallAPI/driver-invalid-options.test | 6 - - .../InstallAPI/reexported-frameworks.test | 638 ----------------- - clang/test/InstallAPI/rpath.test | 663 ------------------ - clang/tools/clang-installapi/CMakeLists.txt | 1 - - .../clang-installapi/ClangInstallAPI.cpp | 27 +- - .../tools/clang-installapi/InstallAPIOpts.td | 40 +- - clang/tools/clang-installapi/Options.cpp | 277 +------- - clang/tools/clang-installapi/Options.h | 43 +- - 19 files changed, 16 insertions(+), 2234 deletions(-) - delete mode 100644 clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp - delete mode 100644 clang/lib/InstallAPI/DiagnosticBuilderWrappers.h - delete mode 100644 clang/test/InstallAPI/binary-attributes.test - delete mode 100644 clang/test/InstallAPI/reexported-frameworks.test - delete mode 100644 clang/test/InstallAPI/rpath.test - -diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td -index ed3fd9b1c4a5..6186a88e1c80 100644 ---- a/clang/include/clang/Basic/DiagnosticDriverKinds.td -+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td -@@ -666,7 +666,6 @@ def warn_drv_darwin_sdk_invalid_settings : Warning< - "SDK settings were ignored as 'SDKSettings.json' could not be parsed">, - InGroup>; - --def err_missing_sysroot : Error<"no such sysroot directory: '%0'">; - def err_drv_darwin_sdk_missing_arclite : Error< - "SDK does not contain 'libarclite' at the path '%0'; try increasing the minimum deployment target">; - -diff --git a/clang/include/clang/Basic/DiagnosticInstallAPIKinds.td b/clang/include/clang/Basic/DiagnosticInstallAPIKinds.td -index 0a477da7186b..e3263fe9ccb9 100644 ---- a/clang/include/clang/Basic/DiagnosticInstallAPIKinds.td -+++ b/clang/include/clang/Basic/DiagnosticInstallAPIKinds.td -@@ -19,11 +19,9 @@ def err_no_such_header_file : Error<"no such %select{public|private|project}1 he - def warn_no_such_excluded_header_file : Warning<"no such excluded %select{public|private}0 header file: '%1'">, InGroup; - def warn_glob_did_not_match: Warning<"glob '%0' did not match any header file">, InGroup; - def err_no_such_umbrella_header_file : Error<"%select{public|private|project}1 umbrella header file not found in input: '%0'">; --def err_cannot_find_reexport : Error<"cannot find re-exported %select{framework|library}0: '%1'">; - } // end of command line category. - - let CategoryName = "Verification" in { --// Diagnostics about symbols. - def warn_target: Warning<"violations found for %0">, InGroup; - def err_library_missing_symbol : Error<"declaration has external linkage, but dynamic library doesn't have symbol '%0'">; - def warn_library_missing_symbol : Warning<"declaration has external linkage, but dynamic library doesn't have symbol '%0'">, InGroup; -@@ -45,25 +43,6 @@ def err_dylib_symbol_flags_mismatch : Error<"dynamic library symbol '%0' is " - "%select{weak defined|thread local}1, but its declaration is not">; - def err_header_symbol_flags_mismatch : Error<"declaration '%0' is " - "%select{weak defined|thread local}1, but symbol is not in dynamic library">; -- --// Diagnostics about load commands. --def err_architecture_mismatch : Error<"architectures do not match: '%0' (provided) vs '%1' (found)">; --def warn_platform_mismatch : Warning<"platform does not match: '%0' (provided) vs '%1' (found)">, InGroup; --def err_platform_mismatch : Error<"platform does not match: '%0' (provided) vs '%1' (found)">; --def err_install_name_mismatch : Error<"install_name does not match: '%0' (provided) vs '%1' (found)">; --def err_current_version_mismatch : Error<"current_version does not match: '%0' (provided) vs '%1' (found)">; --def err_compatibility_version_mismatch : Error<"compatibility_version does not match: '%0' (provided) vs '%1' (found)">; --def err_appextension_safe_mismatch : Error<"ApplicationExtensionSafe flag does not match: '%0' (provided) vs '%1' (found)">; --def err_shared_cache_eligiblity_mismatch : Error<"NotForDyldSharedCache flag does not match: '%0' (provided) vs '%1' (found)">; --def err_no_twolevel_namespace : Error<"flat namespace libraries are not supported">; --def err_parent_umbrella_missing: Error<"parent umbrella missing from %0: '%1'">; --def err_parent_umbrella_mismatch : Error<"parent umbrella does not match: '%0' (provided) vs '%1' (found)">; --def err_reexported_libraries_missing : Error<"re-exported library missing from %0: '%1'">; --def err_reexported_libraries_mismatch : Error<"re-exported libraries do not match: '%0' (provided) vs '%1' (found)">; --def err_allowable_clients_missing : Error<"allowable client missing from %0: '%1'">; --def err_allowable_clients_mismatch : Error<"allowable clients do not match: '%0' (provided) vs '%1' (found)">; --def warn_rpaths_missing : Warning<"runpath search paths missing from %0: '%1'">, InGroup; --def warn_rpaths_mismatch : Warning<"runpath search paths do not match: '%0' (provided) vs '%1' (found)">, InGroup; - } // end of Verification category. - - } // end of InstallAPI component -diff --git a/clang/include/clang/InstallAPI/Context.h b/clang/include/clang/InstallAPI/Context.h -index 8f88331a2803..54e517544b8e 100644 ---- a/clang/include/clang/InstallAPI/Context.h -+++ b/clang/include/clang/InstallAPI/Context.h -@@ -28,9 +28,6 @@ struct InstallAPIContext { - /// Library attributes that are typically passed as linker inputs. - BinaryAttrs BA; - -- /// Install names of reexported libraries of a library. -- LibAttrs Reexports; -- - /// All headers that represent a library. - HeaderSeq InputHeaders; - -@@ -83,20 +80,6 @@ private: - llvm::DenseMap KnownIncludes; - }; - --/// Lookup the dylib or TextAPI file location for a system library or framework. --/// The search paths provided are searched in order. --/// @rpath based libraries are not supported. --/// --/// \param InstallName The install name for the library. --/// \param FrameworkSearchPaths Search paths to look up frameworks with. --/// \param LibrarySearchPaths Search paths to look up dylibs with. --/// \param SearchPaths Fallback search paths if library was not found in earlier --/// paths. --/// \return The full path of the library. --std::string findLibrary(StringRef InstallName, FileManager &FM, -- ArrayRef FrameworkSearchPaths, -- ArrayRef LibrarySearchPaths, -- ArrayRef SearchPaths); - } // namespace installapi - } // namespace clang - -diff --git a/clang/include/clang/InstallAPI/DylibVerifier.h b/clang/include/clang/InstallAPI/DylibVerifier.h -index 07dbd3bf5f2b..22cdc234486c 100644 ---- a/clang/include/clang/InstallAPI/DylibVerifier.h -+++ b/clang/include/clang/InstallAPI/DylibVerifier.h -@@ -24,9 +24,6 @@ enum class VerificationMode { - Pedantic, - }; - --using LibAttrs = llvm::StringMap; --using ReexportedInterfaces = llvm::SmallVector; -- - /// Service responsible to tracking state of verification across the - /// lifetime of InstallAPI. - /// As declarations are collected during AST traversal, they are -@@ -66,12 +63,11 @@ public: - - DylibVerifier() = default; - -- DylibVerifier(llvm::MachO::Records &&Dylib, ReexportedInterfaces &&Reexports, -- DiagnosticsEngine *Diag, VerificationMode Mode, bool Demangle, -- StringRef DSYMPath) -- : Dylib(std::move(Dylib)), Reexports(std::move(Reexports)), Mode(Mode), -- Demangle(Demangle), DSYMPath(DSYMPath), -- Exports(std::make_unique()), Ctx(VerifierContext{Diag}) {} -+ DylibVerifier(llvm::MachO::Records &&Dylib, DiagnosticsEngine *Diag, -+ VerificationMode Mode, bool Demangle, StringRef DSYMPath) -+ : Dylib(std::move(Dylib)), Mode(Mode), Demangle(Demangle), -+ DSYMPath(DSYMPath), Exports(std::make_unique()), -+ Ctx(VerifierContext{Diag}) {} - - Result verify(GlobalRecord *R, const FrontendAttrs *FA); - Result verify(ObjCInterfaceRecord *R, const FrontendAttrs *FA); -@@ -81,14 +77,6 @@ public: - // Scan through dylib slices and report any remaining missing exports. - Result verifyRemainingSymbols(); - -- /// Compare and report the attributes represented as -- /// load commands in the dylib to the attributes provided via options. -- bool verifyBinaryAttrs(const ArrayRef ProvidedTargets, -- const BinaryAttrs &ProvidedBA, -- const LibAttrs &ProvidedReexports, -- const LibAttrs &ProvidedClients, -- const LibAttrs &ProvidedRPaths, const FileType &FT); -- - /// Initialize target for verification. - void setTarget(const Target &T); - -@@ -117,10 +105,6 @@ private: - bool shouldIgnoreObsolete(const Record *R, SymbolContext &SymCtx, - const Record *DR); - -- /// Check if declaration is exported from a reexported library. These -- /// symbols should be omitted from the text-api file. -- bool shouldIgnoreReexport(const Record *R, SymbolContext &SymCtx) const; -- - /// Compare the visibility declarations to the linkage of symbol found in - /// dylib. - Result compareVisibility(const Record *R, SymbolContext &SymCtx, -@@ -170,9 +154,6 @@ private: - // Symbols in dylib. - llvm::MachO::Records Dylib; - -- // Reexported interfaces apart of the library. -- ReexportedInterfaces Reexports; -- - // Controls what class of violations to report. - VerificationMode Mode = VerificationMode::Invalid; - -diff --git a/clang/include/clang/InstallAPI/MachO.h b/clang/include/clang/InstallAPI/MachO.h -index 854399f54ba6..827220dbf39f 100644 ---- a/clang/include/clang/InstallAPI/MachO.h -+++ b/clang/include/clang/InstallAPI/MachO.h -@@ -23,8 +23,6 @@ - #include "llvm/TextAPI/TextAPIWriter.h" - #include "llvm/TextAPI/Utils.h" - --using Architecture = llvm::MachO::Architecture; --using ArchitectureSet = llvm::MachO::ArchitectureSet; - using SymbolFlags = llvm::MachO::SymbolFlags; - using RecordLinkage = llvm::MachO::RecordLinkage; - using Record = llvm::MachO::Record; -diff --git a/clang/lib/InstallAPI/CMakeLists.txt b/clang/lib/InstallAPI/CMakeLists.txt -index b36493942300..e0bc8d969ecb 100644 ---- a/clang/lib/InstallAPI/CMakeLists.txt -+++ b/clang/lib/InstallAPI/CMakeLists.txt -@@ -7,7 +7,6 @@ set(LLVM_LINK_COMPONENTS - ) - - add_clang_library(clangInstallAPI -- DiagnosticBuilderWrappers.cpp - DylibVerifier.cpp - FileList.cpp - Frontend.cpp -diff --git a/clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp b/clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp -deleted file mode 100644 -index 1fa988f93bdd..000000000000 ---- a/clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp -+++ /dev/null -@@ -1,109 +0,0 @@ --//===- DiagnosticBuilderWrappers.cpp ----------------------------*- C++-*-===// --// --// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. --// See https://llvm.org/LICENSE.txt for license information. --// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception --// --//===----------------------------------------------------------------------===// -- --#include "DiagnosticBuilderWrappers.h" --#include "llvm/ADT/STLExtras.h" --#include "llvm/ADT/SmallString.h" --#include "llvm/Support/raw_ostream.h" --#include "llvm/TextAPI/Platform.h" -- --using clang::DiagnosticBuilder; -- --namespace llvm { --namespace MachO { --const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, -- const Architecture &Arch) { -- DB.AddString(getArchitectureName(Arch)); -- return DB; --} -- --const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, -- const ArchitectureSet &ArchSet) { -- DB.AddString(std::string(ArchSet)); -- return DB; --} -- --const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, -- const PlatformType &Platform) { -- DB.AddString(getPlatformName(Platform)); -- return DB; --} -- --const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, -- const PlatformVersionSet &Platforms) { -- std::string PlatformAsString; -- raw_string_ostream Stream(PlatformAsString); -- -- Stream << "[ "; -- llvm::interleaveComma( -- Platforms, Stream, -- [&Stream](const std::pair &PV) { -- Stream << getPlatformName(PV.first); -- if (!PV.second.empty()) -- Stream << PV.second.getAsString(); -- }); -- Stream << " ]"; -- DB.AddString(Stream.str()); -- return DB; --} -- --const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, -- const FileType &Type) { -- switch (Type) { -- case FileType::MachO_Bundle: -- DB.AddString("mach-o bundle"); -- return DB; -- case FileType::MachO_DynamicLibrary: -- DB.AddString("mach-o dynamic library"); -- return DB; -- case FileType::MachO_DynamicLibrary_Stub: -- DB.AddString("mach-o dynamic library stub"); -- return DB; -- case FileType::TBD_V1: -- DB.AddString("tbd-v1"); -- return DB; -- case FileType::TBD_V2: -- DB.AddString("tbd-v2"); -- return DB; -- case FileType::TBD_V3: -- DB.AddString("tbd-v3"); -- return DB; -- case FileType::TBD_V4: -- DB.AddString("tbd-v4"); -- return DB; -- case FileType::TBD_V5: -- DB.AddString("tbd-v5"); -- return DB; -- case FileType::Invalid: -- case FileType::All: -- llvm_unreachable("Unexpected file type for diagnostics."); -- } --} -- --const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, -- const PackedVersion &Version) { -- std::string VersionString; -- raw_string_ostream OS(VersionString); -- OS << Version; -- DB.AddString(OS.str()); -- return DB; --} -- --const clang::DiagnosticBuilder & --operator<<(const clang::DiagnosticBuilder &DB, -- const StringMapEntry &LibAttr) { -- std::string IFAsString; -- raw_string_ostream OS(IFAsString); -- -- OS << LibAttr.getKey() << " [ " << LibAttr.getValue() << " ]"; -- DB.AddString(OS.str()); -- return DB; --} -- --} // namespace MachO --} // namespace llvm -diff --git a/clang/lib/InstallAPI/DiagnosticBuilderWrappers.h b/clang/lib/InstallAPI/DiagnosticBuilderWrappers.h -deleted file mode 100644 -index 48cfefbf65e6..000000000000 ---- a/clang/lib/InstallAPI/DiagnosticBuilderWrappers.h -+++ /dev/null -@@ -1,49 +0,0 @@ --//===- DiagnosticBuilderWrappers.h -----------------------------*- C++ -*-===// --// --// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. --// See https://llvm.org/LICENSE.txt for license information. --// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception --// --//===----------------------------------------------------------------------===// --// --/// Diagnostic wrappers for TextAPI types for error reporting. --// --//===----------------------------------------------------------------------===// -- --#ifndef LLVM_CLANG_INSTALLAPI_DIAGNOSTICBUILDER_WRAPPER_H --#define LLVM_CLANG_INSTALLAPI_DIAGNOSTICBUILDER_WRAPPER_H -- --#include "clang/Basic/Diagnostic.h" --#include "llvm/TextAPI/Architecture.h" --#include "llvm/TextAPI/ArchitectureSet.h" --#include "llvm/TextAPI/InterfaceFile.h" --#include "llvm/TextAPI/Platform.h" -- --namespace llvm { --namespace MachO { -- --const clang::DiagnosticBuilder &operator<<(const clang::DiagnosticBuilder &DB, -- const PlatformType &Platform); -- --const clang::DiagnosticBuilder &operator<<(const clang::DiagnosticBuilder &DB, -- const PlatformVersionSet &Platforms); -- --const clang::DiagnosticBuilder &operator<<(const clang::DiagnosticBuilder &DB, -- const Architecture &Arch); -- --const clang::DiagnosticBuilder &operator<<(const clang::DiagnosticBuilder &DB, -- const ArchitectureSet &ArchSet); -- --const clang::DiagnosticBuilder &operator<<(const clang::DiagnosticBuilder &DB, -- const FileType &Type); -- --const clang::DiagnosticBuilder &operator<<(const clang::DiagnosticBuilder &DB, -- const PackedVersion &Version); -- --const clang::DiagnosticBuilder & --operator<<(const clang::DiagnosticBuilder &DB, -- const StringMapEntry &LibAttr); -- --} // namespace MachO --} // namespace llvm --#endif // LLVM_CLANG_INSTALLAPI_DIAGNOSTICBUILDER_WRAPPER_H -diff --git a/clang/lib/InstallAPI/DylibVerifier.cpp b/clang/lib/InstallAPI/DylibVerifier.cpp -index 2387ee0e78ad..c0eda1d81b9b 100644 ---- a/clang/lib/InstallAPI/DylibVerifier.cpp -+++ b/clang/lib/InstallAPI/DylibVerifier.cpp -@@ -7,7 +7,6 @@ - //===----------------------------------------------------------------------===// - - #include "clang/InstallAPI/DylibVerifier.h" --#include "DiagnosticBuilderWrappers.h" - #include "clang/InstallAPI/FrontendRecords.h" - #include "clang/InstallAPI/InstallAPIDiagnostic.h" - #include "llvm/Demangle/Demangle.h" -@@ -179,22 +178,6 @@ bool DylibVerifier::shouldIgnoreObsolete(const Record *R, SymbolContext &SymCtx, - return SymCtx.FA->Avail.isObsoleted(); - } - --bool DylibVerifier::shouldIgnoreReexport(const Record *R, -- SymbolContext &SymCtx) const { -- if (Reexports.empty()) -- return false; -- -- for (const InterfaceFile &Lib : Reexports) { -- if (!Lib.hasTarget(Ctx.Target)) -- continue; -- if (auto Sym = -- Lib.getSymbol(SymCtx.Kind, SymCtx.SymbolName, SymCtx.ObjCIFKind)) -- if ((*Sym)->hasTarget(Ctx.Target)) -- return true; -- } -- return false; --} -- - bool DylibVerifier::compareObjCInterfaceSymbols(const Record *R, - SymbolContext &SymCtx, - const ObjCInterfaceRecord *DR) { -@@ -400,11 +383,6 @@ DylibVerifier::Result DylibVerifier::verifyImpl(Record *R, - return Ctx.FrontendState; - } - -- if (shouldIgnoreReexport(R, SymCtx)) { -- updateState(Result::Ignore); -- return Ctx.FrontendState; -- } -- - Record *DR = - findRecordFromSlice(Ctx.DylibSlice, SymCtx.SymbolName, SymCtx.Kind); - if (DR) -@@ -724,179 +702,5 @@ DylibVerifier::Result DylibVerifier::verifyRemainingSymbols() { - return getState(); - } - --bool DylibVerifier::verifyBinaryAttrs(const ArrayRef ProvidedTargets, -- const BinaryAttrs &ProvidedBA, -- const LibAttrs &ProvidedReexports, -- const LibAttrs &ProvidedClients, -- const LibAttrs &ProvidedRPaths, -- const FileType &FT) { -- assert(!Dylib.empty() && "Need dylib to verify."); -- -- // Pickup any load commands that can differ per slice to compare. -- TargetList DylibTargets; -- LibAttrs DylibReexports; -- LibAttrs DylibClients; -- LibAttrs DylibRPaths; -- for (const std::shared_ptr &RS : Dylib) { -- DylibTargets.push_back(RS->getTarget()); -- const BinaryAttrs &BinInfo = RS->getBinaryAttrs(); -- for (const StringRef LibName : BinInfo.RexportedLibraries) -- DylibReexports[LibName].set(DylibTargets.back().Arch); -- for (const StringRef LibName : BinInfo.AllowableClients) -- DylibClients[LibName].set(DylibTargets.back().Arch); -- // Compare attributes that are only representable in >= TBD_V5. -- if (FT >= FileType::TBD_V5) -- for (const StringRef Name : BinInfo.RPaths) -- DylibRPaths[Name].set(DylibTargets.back().Arch); -- } -- -- // Check targets first. -- ArchitectureSet ProvidedArchs = mapToArchitectureSet(ProvidedTargets); -- ArchitectureSet DylibArchs = mapToArchitectureSet(DylibTargets); -- if (ProvidedArchs != DylibArchs) { -- Ctx.Diag->Report(diag::err_architecture_mismatch) -- << ProvidedArchs << DylibArchs; -- return false; -- } -- auto ProvidedPlatforms = mapToPlatformVersionSet(ProvidedTargets); -- auto DylibPlatforms = mapToPlatformVersionSet(DylibTargets); -- if (ProvidedPlatforms != DylibPlatforms) { -- const bool DiffMinOS = -- mapToPlatformSet(ProvidedTargets) == mapToPlatformSet(DylibTargets); -- if (DiffMinOS) -- Ctx.Diag->Report(diag::warn_platform_mismatch) -- << ProvidedPlatforms << DylibPlatforms; -- else { -- Ctx.Diag->Report(diag::err_platform_mismatch) -- << ProvidedPlatforms << DylibPlatforms; -- return false; -- } -- } -- -- // Because InstallAPI requires certain attributes to match across architecture -- // slices, take the first one to compare those with. -- const BinaryAttrs &DylibBA = (*Dylib.begin())->getBinaryAttrs(); -- -- if (ProvidedBA.InstallName != DylibBA.InstallName) { -- Ctx.Diag->Report(diag::err_install_name_mismatch) -- << ProvidedBA.InstallName << DylibBA.InstallName; -- return false; -- } -- -- if (ProvidedBA.CurrentVersion != DylibBA.CurrentVersion) { -- Ctx.Diag->Report(diag::err_current_version_mismatch) -- << ProvidedBA.CurrentVersion << DylibBA.CurrentVersion; -- return false; -- } -- -- if (ProvidedBA.CompatVersion != DylibBA.CompatVersion) { -- Ctx.Diag->Report(diag::err_compatibility_version_mismatch) -- << ProvidedBA.CompatVersion << DylibBA.CompatVersion; -- return false; -- } -- -- if (ProvidedBA.AppExtensionSafe != DylibBA.AppExtensionSafe) { -- Ctx.Diag->Report(diag::err_appextension_safe_mismatch) -- << (ProvidedBA.AppExtensionSafe ? "true" : "false") -- << (DylibBA.AppExtensionSafe ? "true" : "false"); -- return false; -- } -- -- if (!DylibBA.TwoLevelNamespace) { -- Ctx.Diag->Report(diag::err_no_twolevel_namespace); -- return false; -- } -- -- if (ProvidedBA.OSLibNotForSharedCache != DylibBA.OSLibNotForSharedCache) { -- Ctx.Diag->Report(diag::err_shared_cache_eligiblity_mismatch) -- << (ProvidedBA.OSLibNotForSharedCache ? "true" : "false") -- << (DylibBA.OSLibNotForSharedCache ? "true" : "false"); -- return false; -- } -- -- if (ProvidedBA.ParentUmbrella.empty() && !DylibBA.ParentUmbrella.empty()) { -- Ctx.Diag->Report(diag::err_parent_umbrella_missing) -- << "installAPI option" << DylibBA.ParentUmbrella; -- return false; -- } -- -- if (!ProvidedBA.ParentUmbrella.empty() && DylibBA.ParentUmbrella.empty()) { -- Ctx.Diag->Report(diag::err_parent_umbrella_missing) -- << "binary file" << ProvidedBA.ParentUmbrella; -- return false; -- } -- -- if ((!ProvidedBA.ParentUmbrella.empty()) && -- (ProvidedBA.ParentUmbrella != DylibBA.ParentUmbrella)) { -- Ctx.Diag->Report(diag::err_parent_umbrella_mismatch) -- << ProvidedBA.ParentUmbrella << DylibBA.ParentUmbrella; -- return false; -- } -- -- auto CompareLibraries = [&](const LibAttrs &Provided, const LibAttrs &Dylib, -- unsigned DiagID_missing, unsigned DiagID_mismatch, -- bool Fatal = true) { -- if (Provided == Dylib) -- return true; -- -- for (const llvm::StringMapEntry &PAttr : Provided) { -- const auto DAttrIt = Dylib.find(PAttr.getKey()); -- if (DAttrIt == Dylib.end()) { -- Ctx.Diag->Report(DiagID_missing) << "binary file" << PAttr; -- if (Fatal) -- return false; -- } -- -- if (PAttr.getValue() != DAttrIt->getValue()) { -- Ctx.Diag->Report(DiagID_mismatch) << PAttr << *DAttrIt; -- if (Fatal) -- return false; -- } -- } -- -- for (const llvm::StringMapEntry &DAttr : Dylib) { -- const auto PAttrIt = Provided.find(DAttr.getKey()); -- if (PAttrIt == Provided.end()) { -- Ctx.Diag->Report(DiagID_missing) << "installAPI option" << DAttr; -- if (!Fatal) -- continue; -- return false; -- } -- -- if (PAttrIt->getValue() != DAttr.getValue()) { -- if (Fatal) -- llvm_unreachable("this case was already covered above."); -- } -- } -- return true; -- }; -- -- if (!CompareLibraries(ProvidedReexports, DylibReexports, -- diag::err_reexported_libraries_missing, -- diag::err_reexported_libraries_mismatch)) -- return false; -- -- if (!CompareLibraries(ProvidedClients, DylibClients, -- diag::err_allowable_clients_missing, -- diag::err_allowable_clients_mismatch)) -- return false; -- -- if (FT >= FileType::TBD_V5) { -- // Ignore rpath differences if building an asan variant, since the -- // compiler injects additional paths. -- // FIXME: Building with sanitizers does not always change the install -- // name, so this is not a foolproof solution. -- if (!ProvidedBA.InstallName.ends_with("_asan")) { -- if (!CompareLibraries(ProvidedRPaths, DylibRPaths, -- diag::warn_rpaths_missing, -- diag::warn_rpaths_mismatch, -- /*Fatal=*/false)) -- return true; -- } -- } -- -- return true; --} -- - } // namespace installapi - } // namespace clang -diff --git a/clang/lib/InstallAPI/Frontend.cpp b/clang/lib/InstallAPI/Frontend.cpp -index bd7589c13e04..e07ccb14e0b8 100644 ---- a/clang/lib/InstallAPI/Frontend.cpp -+++ b/clang/lib/InstallAPI/Frontend.cpp -@@ -162,58 +162,4 @@ std::unique_ptr createInputBuffer(InstallAPIContext &Ctx) { - return llvm::MemoryBuffer::getMemBufferCopy(Contents, BufferName); - } - --std::string findLibrary(StringRef InstallName, FileManager &FM, -- ArrayRef FrameworkSearchPaths, -- ArrayRef LibrarySearchPaths, -- ArrayRef SearchPaths) { -- auto getLibrary = -- [&](const StringRef FullPath) -> std::optional { -- // Prefer TextAPI files when possible. -- SmallString TextAPIFilePath = FullPath; -- replace_extension(TextAPIFilePath, ".tbd"); -- -- if (FM.getOptionalFileRef(TextAPIFilePath)) -- return std::string(TextAPIFilePath); -- -- if (FM.getOptionalFileRef(FullPath)) -- return std::string(FullPath); -- -- return std::nullopt; -- }; -- -- const StringRef Filename = sys::path::filename(InstallName); -- const bool IsFramework = sys::path::parent_path(InstallName) -- .ends_with((Filename + ".framework").str()); -- if (IsFramework) { -- for (const StringRef Path : FrameworkSearchPaths) { -- SmallString FullPath(Path); -- sys::path::append(FullPath, Filename + StringRef(".framework"), Filename); -- if (auto LibOrNull = getLibrary(FullPath)) -- return *LibOrNull; -- } -- } else { -- // Copy Apple's linker behavior: If this is a .dylib inside a framework, do -- // not search -L paths. -- bool IsEmbeddedDylib = (sys::path::extension(InstallName) == ".dylib") && -- InstallName.contains(".framework/"); -- if (!IsEmbeddedDylib) { -- for (const StringRef Path : LibrarySearchPaths) { -- SmallString FullPath(Path); -- sys::path::append(FullPath, Filename); -- if (auto LibOrNull = getLibrary(FullPath)) -- return *LibOrNull; -- } -- } -- } -- -- for (const StringRef Path : SearchPaths) { -- SmallString FullPath(Path); -- sys::path::append(FullPath, InstallName); -- if (auto LibOrNull = getLibrary(FullPath)) -- return *LibOrNull; -- } -- -- return {}; --} -- - } // namespace clang::installapi -diff --git a/clang/test/InstallAPI/binary-attributes.test b/clang/test/InstallAPI/binary-attributes.test -deleted file mode 100644 -index d97c7a14a98d..000000000000 ---- a/clang/test/InstallAPI/binary-attributes.test -+++ /dev/null -@@ -1,76 +0,0 @@ --; RUN: rm -rf %t --; RUN: split-file %s %t --; RUN: mkdir -p %t/System/Library/Frameworks --; RUN: cp -r %S/Inputs/Simple/Simple.framework %t/System/Library/Frameworks/ --; RUN: yaml2obj %S/Inputs/Simple/Simple.yaml -o %t/Simple -- --; RUN: not clang-installapi -target x86_64h-apple-macos10.12 \ --; RUN: -install_name Simple -current_version 3 -compatibility_version 2 \ --; RUN: -o tmp.tbd --verify-against=%t/Simple 2>&1 | FileCheck -check-prefix=ARCHITECTURE %s --; ARCHITECTURE: error: architectures do not match: 'x86_64h' (provided) vs 'x86_64' (found) -- --; RUN: not clang-installapi -target x86_64-apple-macos10.12 \ --; RUN: -install_name Simple -current_version 3 -compatibility_version 2 \ --; RUN: -o tmp.tbd --verify-against=%t/Simple 2>&1 | FileCheck -check-prefix=INSTALL_NAME %s --; INSTALL_NAME: error: install_name does not match: 'Simple' (provided) vs '/System/Library/Frameworks/Simple.framework/Versions/A/Simple' (found) -- --; RUN: not clang-installapi -target x86_64-apple-macos10.12 \ --; RUN: -install_name /System/Library/Frameworks/Simple.framework/Versions/A/Simple \ --; RUN: -current_version 3 -compatibility_version 2 \ --; RUN: -o tmp.tbd --verify-against=%t/Simple 2>&1 | FileCheck -check-prefix=CURRENT_VERSION %s --; CURRENT_VERSION: error: current_version does not match: '3' (provided) vs '1.2.3' (found) -- --; RUN: not clang-installapi -target x86_64-apple-macos10.12 \ --; RUN: -install_name /System/Library/Frameworks/Simple.framework/Versions/A/Simple \ --; RUN: -current_version 1.2.3 -compatibility_version 2 \ --; RUN: -o tmp.tbd --verify-against=%t/Simple 2>&1 | FileCheck -check-prefix=COMPATIBILITY_VERSION %s --; COMPATIBILITY_VERSION: error: compatibility_version does not match: '2' (provided) vs '1' (found) -- --; RUN: not clang-installapi -target x86_64-apple-macos10.12 \ --; RUN: -install_name /System/Library/Frameworks/Simple.framework/Versions/A/Simple \ --; RUN: -current_version 1.2.3 -compatibility_version 1 -fapplication-extension \ --; RUN: -o tmp.tbd --verify-against=%t/Simple 2>&1 | FileCheck -check-prefix=APPEXTSAFE %s --; APPEXTSAFE: error: ApplicationExtensionSafe flag does not match: 'true' (provided) vs 'false' (found) -- --; RUN: not clang-installapi -target x86_64-apple-macos10.12 \ --; RUN: -install_name /System/Library/Frameworks/Simple.framework/Versions/A/Simple \ --; RUN: -current_version 1.2.3 -compatibility_version 1 -not_for_dyld_shared_cache \ --; RUN: -o tmp.tbd --verify-against=%t/Simple 2>&1 | FileCheck -check-prefix=SHARED_CACHE %s --; SHARED_CACHE: error: NotForDyldSharedCache flag does not match: 'true' (provided) vs 'false' (found) -- --; RUN: not clang-installapi -target x86_64-apple-macos10.12 \ --; RUN: -install_name /System/Library/Frameworks/Simple.framework/Versions/A/Simple \ --; RUN: -current_version 1.2.3 -compatibility_version 1 \ --; RUN: -allowable_client Foo -allowable_client Bar \ --; RUN: -o tmp.tbd --verify-against=%t/Simple 2>&1 | FileCheck -check-prefix=ALLOWABLE %s --; ALLOWABLE: error: allowable client missing from binary file: 'Foo [ x86_64 ]' -- --; RUN: not clang-installapi -target x86_64-apple-macos10.12 \ --; RUN: -install_name /System/Library/Frameworks/Simple.framework/Versions/A/Simple \ --; RUN: -current_version 1.2.3 -compatibility_version 1 -reexport_library %t/Foo.tbd \ --; RUN: -o tmp.tbd --verify-against=%t/Simple 2>&1 | FileCheck -check-prefix=REEXPORT %s --; REEXPORT: error: re-exported library missing from binary file: 'Foo [ x86_64 ]' -- --; RUN: not clang-installapi -target x86_64-apple-macos10.12 \ --; RUN: -install_name /System/Library/Frameworks/Simple.framework/Versions/A/Simple \ --; RUN: -current_version 1.2.3 -compatibility_version 1 -umbrella Bogus \ --; RUN: -o tmp.tbd --verify-against=%t/Simple 2>&1 | FileCheck -check-prefix=UMBRELLA %s --; UMBRELLA: error: parent umbrella missing from binary file: 'Bogus' -- --;--- Foo.tbd --{ -- "main_library": { -- "install_names": [ -- { -- "name": "Foo" -- } -- ], -- "target_info": [ -- { -- "min_deployment": "13.0", -- "target": "arm64-macos" -- } -- ] -- }, -- "tapi_tbd_version": 5 --} -diff --git a/clang/test/InstallAPI/driver-invalid-options.test b/clang/test/InstallAPI/driver-invalid-options.test -index 2b2c551fca20..0c630eacd183 100644 ---- a/clang/test/InstallAPI/driver-invalid-options.test -+++ b/clang/test/InstallAPI/driver-invalid-options.test -@@ -13,9 +13,3 @@ - // RUN: --verify-mode=Invalid -o tmp.tbd 2> %t - // RUN: FileCheck --check-prefix INVALID_VERIFY_MODE -input-file %t %s - // INVALID_VERIFY_MODE: error: invalid value 'Invalid' in '--verify-mode=Invalid' -- --/// Check that invalid sysroot is fatal. --// RUN: not clang-installapi -install_name Foo -target arm64-apple-ios13 \ --// RUN: -isysroot /no/such/path -o tmp.tbd 2> %t --// RUN: FileCheck --check-prefix INVALID_ISYSROOT -input-file %t %s --// INVALID_ISYSROOT: error: no such sysroot directory: {{.*}}no/such/path' -diff --git a/clang/test/InstallAPI/reexported-frameworks.test b/clang/test/InstallAPI/reexported-frameworks.test -deleted file mode 100644 -index 41c4f539c0b1..000000000000 ---- a/clang/test/InstallAPI/reexported-frameworks.test -+++ /dev/null -@@ -1,638 +0,0 @@ --; RUN: rm -rf %t --; RUN: split-file %s %t --; RUN: sed -e "s|DSTROOT|%/t|g" %t/inputs.json.in > %t/inputs.json -- --; RUN: yaml2obj %t/Umbrella.yaml -o %t/Umbrella --; RUN: mkdir -p %t/System/Library/Frameworks/Bar.framework --; RUN: yaml2obj %t/Bar.yaml -o %t/System/Library/Frameworks/Bar.framework/Bar -- --; RUN: clang-installapi -target x86_64-apple-macosx13 -install_name \ --; RUN: /System/Library/Frameworks/Umbrella3.framework/Versions/A/Umbrella3 \ --; RUN: -current_version 1 -compatibility_version 1 \ --; RUN: --verify-against=%t/Umbrella \ --; RUN: -F %t/System/Library/Frameworks -L %t/usr/lib \ --; RUN: %t/inputs.json --verify-mode=Pedantic \ --; RUN: -reexport_framework Foo -reexport_framework Bar -reexport-lBaz \ --; RUN: -o %t/Umbrella.tbd 2>&1 | FileCheck -allow-empty %s --; RUN: llvm-readtapi -compare %t/Umbrella.tbd %t/expected.tbd 2>&1 | FileCheck -allow-empty %s -- --// Checks that one of the reexported frameworks found earlier doesn't resolve --// a missing export from a declaration. --; RUN: not clang-installapi -target x86_64-apple-macosx13 -install_name \ --; RUN: /System/Library/Frameworks/Umbrella3.framework/Versions/A/Umbrella3 \ --; RUN: -current_version 1 -compatibility_version 1 \ --; RUN: --verify-against=%t/Umbrella \ --; RUN: %t/inputs.json -F %t/BadFoo \ --; RUN: -F %t/System/Library/Frameworks -L %t/usr/lib \ --; RUN: --verify-mode=ErrorsOnly \ --; RUN: -reexport_framework Foo -reexport_framework Bar -reexport-lBaz \ --; RUN: -o %t/Umbrella.tbd 2>&1 | FileCheck %s --check-prefix MISSING_SYMBOL -- --; MISSING_SYMBOL: error: declaration has external linkage, but dynamic library doesn't have symbol 'foo' --; MISSING_SYMBOL-NEXT: extern int foo(); -- -- --; CHECK-NOT: error --; CHECK-NOT: warning -- --;--- System/Library/Frameworks/Umbrella.framework/Headers/Bar.h --extern int bar(); -- --;--- System/Library/Frameworks/Umbrella.framework/Headers/Baz.h --extern int baz(); -- --;--- System/Library/Frameworks/Umbrella.framework/Headers/Foo.h --extern int foo(); -- --;--- System/Library/Frameworks/Umbrella.framework/Headers/Umbrella.h --#import --#import --#import -- --;--- inputs.json.in --{ -- "headers": [ { -- "path" : "DSTROOT/System/Library/Frameworks/Umbrella.framework/Headers/Bar.h", -- "type" : "public" -- }, -- { -- "path" : "DSTROOT/System/Library/Frameworks/Umbrella.framework/Headers/Baz.h", -- "type" : "public" -- }, -- { -- "path" : "DSTROOT/System/Library/Frameworks/Umbrella.framework/Headers/Umbrella.h", -- "type" : "public" -- }, -- { -- "path" : "DSTROOT/System/Library/Frameworks/Umbrella.framework/Headers/Foo.h", -- "type" : "public" -- } -- ], -- "version": "3" --} -- --;--- Umbrella.yaml ----- !mach-o --FileHeader: -- magic: 0xFEEDFACF -- cputype: 0x1000007 -- cpusubtype: 0x3 -- filetype: 0x6 -- ncmds: 18 -- sizeofcmds: 1184 -- flags: 0x85 -- reserved: 0x0 --LoadCommands: -- - cmd: LC_SEGMENT_64 -- cmdsize: 152 -- segname: __TEXT -- vmaddr: 0 -- vmsize: 12288 -- fileoff: 0 -- filesize: 12288 -- maxprot: 5 -- initprot: 5 -- nsects: 1 -- flags: 0 -- Sections: -- - sectname: __text -- segname: __TEXT -- addr: 0x24C0 -- size: 0 -- offset: 0x24C0 -- align: 0 -- reloff: 0x0 -- nreloc: 0 -- flags: 0x80000000 -- reserved1: 0x0 -- reserved2: 0x0 -- reserved3: 0x0 -- content: '' -- - cmd: LC_SEGMENT_64 -- cmdsize: 152 -- segname: __DATA_CONST -- vmaddr: 12288 -- vmsize: 4096 -- fileoff: 12288 -- filesize: 4096 -- maxprot: 3 -- initprot: 3 -- nsects: 1 -- flags: 16 -- Sections: -- - sectname: __objc_imageinfo -- segname: __DATA_CONST -- addr: 0x3000 -- size: 8 -- offset: 0x3000 -- align: 0 -- reloff: 0x0 -- nreloc: 0 -- flags: 0x0 -- reserved1: 0x0 -- reserved2: 0x0 -- reserved3: 0x0 -- content: '0000000040000000' -- - cmd: LC_SEGMENT_64 -- cmdsize: 72 -- segname: __LINKEDIT -- vmaddr: 16384 -- vmsize: 48 -- fileoff: 16384 -- filesize: 48 -- maxprot: 1 -- initprot: 1 -- nsects: 0 -- flags: 0 -- - cmd: LC_DYLD_INFO_ONLY -- cmdsize: 48 -- rebase_off: 0 -- rebase_size: 0 -- bind_off: 0 -- bind_size: 0 -- weak_bind_off: 0 -- weak_bind_size: 0 -- lazy_bind_off: 0 -- lazy_bind_size: 0 -- export_off: 0 -- export_size: 0 -- - cmd: LC_SYMTAB -- cmdsize: 24 -- symoff: 16392 -- nsyms: 1 -- stroff: 16408 -- strsize: 24 -- - cmd: LC_DYSYMTAB -- cmdsize: 80 -- ilocalsym: 0 -- nlocalsym: 0 -- iextdefsym: 0 -- nextdefsym: 0 -- iundefsym: 0 -- nundefsym: 1 -- tocoff: 0 -- ntoc: 0 -- modtaboff: 0 -- nmodtab: 0 -- extrefsymoff: 0 -- nextrefsyms: 0 -- indirectsymoff: 0 -- nindirectsyms: 0 -- extreloff: 0 -- nextrel: 0 -- locreloff: 0 -- nlocrel: 0 -- - cmd: LC_ID_DYLIB -- cmdsize: 96 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 65536 -- compatibility_version: 65536 -- Content: '/System/Library/Frameworks/Umbrella3.framework/Versions/A/Umbrella3' -- ZeroPadBytes: 5 -- - cmd: LC_UUID -- cmdsize: 24 -- uuid: 4C4C44AE-5555-3144-A1D3-33A5C6F7B36A -- - cmd: LC_BUILD_VERSION -- cmdsize: 32 -- platform: 1 -- minos: 851968 -- sdk: 983040 -- ntools: 1 -- Tools: -- - tool: 4 -- version: 1245184 -- - cmd: LC_LOAD_DYLIB -- cmdsize: 80 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 65536 -- compatibility_version: 65536 -- Content: '/System/Library/Frameworks/Foo.framework/Versions/A/Foo' -- ZeroPadBytes: 1 -- - cmd: LC_REEXPORT_DYLIB -- cmdsize: 80 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 0 -- compatibility_version: 0 -- Content: '/System/Library/Frameworks/Foo.framework/Versions/A/Foo' -- ZeroPadBytes: 1 -- - cmd: LC_LOAD_DYLIB -- cmdsize: 80 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 65536 -- compatibility_version: 65536 -- Content: '/System/Library/Frameworks/Bar.framework/Versions/A/Bar' -- ZeroPadBytes: 1 -- - cmd: LC_REEXPORT_DYLIB -- cmdsize: 80 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 0 -- compatibility_version: 0 -- Content: '/System/Library/Frameworks/Bar.framework/Versions/A/Bar' -- ZeroPadBytes: 1 -- - cmd: LC_LOAD_DYLIB -- cmdsize: 48 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 65536 -- compatibility_version: 65536 -- Content: '/usr/lib/libBaz.1.dylib' -- ZeroPadBytes: 1 -- - cmd: LC_REEXPORT_DYLIB -- cmdsize: 48 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 0 -- compatibility_version: 0 -- Content: '/usr/lib/libBaz.1.dylib' -- ZeroPadBytes: 1 -- - cmd: LC_LOAD_DYLIB -- cmdsize: 56 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 88539136 -- compatibility_version: 65536 -- Content: '/usr/lib/libSystem.B.dylib' -- ZeroPadBytes: 6 -- - cmd: LC_FUNCTION_STARTS -- cmdsize: 16 -- dataoff: 16384 -- datasize: 8 -- - cmd: LC_DATA_IN_CODE -- cmdsize: 16 -- dataoff: 16392 -- datasize: 0 --LinkEditData: -- NameList: -- - n_strx: 2 -- n_type: 0x1 -- n_sect: 0 -- n_desc: 1024 -- n_value: 0 -- StringTable: -- - ' ' -- - dyld_stub_binder -- - '' -- - '' -- - '' -- - '' -- - '' --... -- --;--- System/Library/Frameworks/Foo.framework/Foo.tbd --{ -- "main_library": { -- "exported_symbols": [ -- { -- "text": { -- "global": [ -- "_foo" -- ] -- } -- } -- ], -- "flags": [ -- { -- "attributes": [ -- "not_app_extension_safe" -- ] -- } -- ], -- "install_names": [ -- { -- "name": "/System/Library/Frameworks/Foo.framework/Versions/A/Foo" -- } -- ], -- "target_info": [ -- { -- "min_deployment": "13", -- "target": "x86_64-macos" -- } -- ] -- }, -- "tapi_tbd_version": 5 --} -- --;--- Bar.yaml ----- !mach-o --FileHeader: -- magic: 0xFEEDFACF -- cputype: 0x1000007 -- cpusubtype: 0x3 -- filetype: 0x6 -- ncmds: 12 -- sizeofcmds: 912 -- flags: 0x100085 -- reserved: 0x0 --LoadCommands: -- - cmd: LC_SEGMENT_64 -- cmdsize: 312 -- segname: __TEXT -- vmaddr: 0 -- vmsize: 8192 -- fileoff: 0 -- filesize: 8192 -- maxprot: 5 -- initprot: 5 -- nsects: 3 -- flags: 0 -- Sections: -- - sectname: __text -- segname: __TEXT -- addr: 0xBB0 -- size: 8 -- offset: 0xBB0 -- align: 4 -- reloff: 0x0 -- nreloc: 0 -- flags: 0x80000400 -- reserved1: 0x0 -- reserved2: 0x0 -- reserved3: 0x0 -- content: 554889E531C05DC3 -- - sectname: __unwind_info -- segname: __TEXT -- addr: 0xBB8 -- size: 4152 -- offset: 0xBB8 -- align: 2 -- reloff: 0x0 -- nreloc: 0 -- flags: 0x0 -- reserved1: 0x0 -- reserved2: 0x0 -- reserved3: 0x0 -- content: 010000001C000000010000002000000000000000200000000200000000000001B00B00003800000038000000B80B00000000000038000000030000000C0001001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -- - sectname: __eh_frame -- segname: __TEXT -- addr: 0x1BF0 -- size: 24 -- offset: 0x1BF0 -- align: 3 -- reloff: 0x0 -- nreloc: 0 -- flags: 0x6000000B -- reserved1: 0x0 -- reserved2: 0x0 -- reserved3: 0x0 -- content: 1400000000000000017A520001781001100C070890010000 -- - cmd: LC_SEGMENT_64 -- cmdsize: 152 -- segname: __DATA_CONST -- vmaddr: 8192 -- vmsize: 4096 -- fileoff: 8192 -- filesize: 4096 -- maxprot: 3 -- initprot: 3 -- nsects: 1 -- flags: 16 -- Sections: -- - sectname: __objc_imageinfo -- segname: __DATA_CONST -- addr: 0x2000 -- size: 8 -- offset: 0x2000 -- align: 0 -- reloff: 0x0 -- nreloc: 0 -- flags: 0x0 -- reserved1: 0x0 -- reserved2: 0x0 -- reserved3: 0x0 -- content: '0000000040000000' -- - cmd: LC_SEGMENT_64 -- cmdsize: 72 -- segname: __LINKEDIT -- vmaddr: 12288 -- vmsize: 80 -- fileoff: 12288 -- filesize: 80 -- maxprot: 1 -- initprot: 1 -- nsects: 0 -- flags: 0 -- - cmd: LC_DYLD_INFO_ONLY -- cmdsize: 48 -- rebase_off: 0 -- rebase_size: 0 -- bind_off: 0 -- bind_size: 0 -- weak_bind_off: 0 -- weak_bind_size: 0 -- lazy_bind_off: 0 -- lazy_bind_size: 0 -- export_off: 12288 -- export_size: 16 -- - cmd: LC_SYMTAB -- cmdsize: 24 -- symoff: 12312 -- nsyms: 2 -- stroff: 12344 -- strsize: 24 -- - cmd: LC_DYSYMTAB -- cmdsize: 80 -- ilocalsym: 0 -- nlocalsym: 0 -- iextdefsym: 0 -- nextdefsym: 1 -- iundefsym: 1 -- nundefsym: 1 -- tocoff: 0 -- ntoc: 0 -- modtaboff: 0 -- nmodtab: 0 -- extrefsymoff: 0 -- nextrefsyms: 0 -- indirectsymoff: 0 -- nindirectsyms: 0 -- extreloff: 0 -- nextrel: 0 -- locreloff: 0 -- nlocrel: 0 -- - cmd: LC_ID_DYLIB -- cmdsize: 80 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 65536 -- compatibility_version: 65536 -- Content: '/System/Library/Frameworks/Bar.framework/Versions/A/Bar' -- ZeroPadBytes: 1 -- - cmd: LC_UUID -- cmdsize: 24 -- uuid: 4C4C4415-5555-3144-A11E-3C68D85CC061 -- - cmd: LC_BUILD_VERSION -- cmdsize: 32 -- platform: 1 -- minos: 851968 -- sdk: 983040 -- ntools: 1 -- Tools: -- - tool: 4 -- version: 1245184 -- - cmd: LC_LOAD_DYLIB -- cmdsize: 56 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 88539136 -- compatibility_version: 65536 -- Content: '/usr/lib/libSystem.B.dylib' -- ZeroPadBytes: 6 -- - cmd: LC_FUNCTION_STARTS -- cmdsize: 16 -- dataoff: 12304 -- datasize: 8 -- - cmd: LC_DATA_IN_CODE -- cmdsize: 16 -- dataoff: 12312 -- datasize: 0 --LinkEditData: -- ExportTrie: -- TerminalSize: 0 -- NodeOffset: 0 -- Name: '' -- Flags: 0x0 -- Address: 0x0 -- Other: 0x0 -- ImportName: '' -- Children: -- - TerminalSize: 3 -- NodeOffset: 8 -- Name: _bar -- Flags: 0x0 -- Address: 0xBB0 -- Other: 0x0 -- ImportName: '' -- NameList: -- - n_strx: 2 -- n_type: 0xF -- n_sect: 1 -- n_desc: 0 -- n_value: 2992 -- - n_strx: 7 -- n_type: 0x1 -- n_sect: 0 -- n_desc: 256 -- n_value: 0 -- StringTable: -- - ' ' -- - _bar -- - dyld_stub_binder -- FunctionStarts: [ 0xBB0 ] --... -- --;--- usr/lib/libBaz.tbd --{ -- "main_library": { -- "exported_symbols": [ -- { -- "text": { -- "global": [ -- "_baz" -- ] -- } -- } -- ], -- "flags": [ -- { -- "attributes": [ -- "not_app_extension_safe" -- ] -- } -- ], -- "install_names": [ -- { -- "name": "/usr/lib/libBaz.1.dylib" -- } -- ], -- "target_info": [ -- { -- "min_deployment": "13", -- "target": "x86_64-macos" -- } -- ] -- }, -- "tapi_tbd_version": 5 --} -- --;--- BadFoo/Foo.framework/Foo.tbd --{ -- "main_library": { -- "exported_symbols": [ -- { -- "text": { -- "global": [ -- "_not_so_foo" -- ] -- } -- } -- ], -- "flags": [ -- { -- "attributes": [ -- "not_app_extension_safe" -- ] -- } -- ], -- "install_names": [ -- { -- "name": "/System/Library/Frameworks/Foo.framework/Versions/A/Foo" -- } -- ], -- "target_info": [ -- { -- "min_deployment": "13", -- "target": "x86_64-macos" -- } -- ] -- }, -- "tapi_tbd_version": 5 --} -- --;--- expected.tbd --{ -- "main_library": { -- "flags": [ -- { -- "attributes": [ -- "not_app_extension_safe" -- ] -- } -- ], -- "install_names": [ -- { -- "name": "/System/Library/Frameworks/Umbrella3.framework/Versions/A/Umbrella3" -- } -- ], -- "reexported_libraries": [ -- { -- "names": [ -- "/System/Library/Frameworks/Bar.framework/Versions/A/Bar", -- "/System/Library/Frameworks/Foo.framework/Versions/A/Foo", -- "/usr/lib/libBaz.1.dylib" -- ] -- } -- ], -- "target_info": [ -- { -- "min_deployment": "13", -- "target": "x86_64-macos" -- } -- ] -- }, -- "tapi_tbd_version": 5 --} -diff --git a/clang/test/InstallAPI/rpath.test b/clang/test/InstallAPI/rpath.test -deleted file mode 100644 -index 083a15419aba..000000000000 ---- a/clang/test/InstallAPI/rpath.test -+++ /dev/null -@@ -1,663 +0,0 @@ --; RUN: rm -rf %t --; RUN: split-file %s %t --; RUN: yaml2obj %t/RPath.yaml -o %t/RPath -- --; RUN: clang-installapi --filetype=tbd-v5 \ --; RUN: -target arm64-apple-macos13.0 -target x86_64-apple-macos13.0 \ --; RUN: -install_name @rpath/Frameworks/RPath.framework/Versions/A/RPath \ --; RUN: -current_version 1 -compatibility_version 1 \ --; RUN: --extra-public-header=%t/public.h \ --; RUN: -o %t/RPath_warnings.tbd \ --; RUN: --verify-against=%t/RPath \ --; RUN: --verify-mode=Pedantic 2>&1 | FileCheck %s --check-prefix=MISSING --; RUN: llvm-readtapi --compare %t/RPath_warnings.tbd %t/expected_no_rpaths.tbd -- --; MISSING: warning: runpath search paths missing from installAPI option: '@loader_path/../../../SharedFrameworks/ [ x86_64 arm64 ]' --; MISSING: warning: runpath search paths missing from installAPI option: '@loader_path/../../PrivateFrameworks/ [ x86_64 arm64 ]' -- --; RUN: clang-installapi --filetype=tbd-v5 \ --; RUN: -target arm64-apple-macos13.0 -target x86_64-apple-macos13.0 \ --; RUN: -install_name @rpath/Frameworks/RPath.framework/Versions/A/RPath \ --; RUN: -current_version 1 -compatibility_version 1 \ --; RUN: --extra-public-header=%t/public.h \ --; RUN: -Xarch_arm64 -rpath @loader_path/../../../SharedFrameworks/ \ --; RUN: -o %t/RPath_Xarch.tbd \ --; RUN: --verify-against=%t/RPath \ --; RUN: --verify-mode=Pedantic 2>&1 | FileCheck %s --check-prefix=XARCH --; RUN: llvm-readtapi --compare %t/RPath_Xarch.tbd %t/expected_xarch_rpaths.tbd -- --; XARCH: warning: runpath search paths do not match: '@loader_path/../../../SharedFrameworks/ [ arm64 ]' (provided) vs '@loader_path/../../../SharedFrameworks/ [ x86_64 arm64 ]' --; XARCH: warning: runpath search paths missing from installAPI option: '@loader_path/../../PrivateFrameworks/ [ x86_64 arm64 ]' -- --; RUN: clang-installapi --filetype=tbd-v5 \ --; RUN: -target arm64-apple-macos13.0 -target x86_64-apple-macos13.0 \ --; RUN: -install_name @rpath/Frameworks/RPath.framework/Versions/A/RPath \ --; RUN: -current_version 1 -compatibility_version 1 \ --; RUN: --extra-public-header=%t/public.h \ --; RUN: -rpath @loader_path/../../../SharedFrameworks/ \ --; RUN: -rpath @loader_path/../../PrivateFrameworks/ \ --; RUN: --verify-against=%t/RPath --verify-mode=Pedantic \ --; RUN: -o %t/RPath.tbd 2>&1 | FileCheck -allow-empty %s --; RUN: llvm-readtapi --compare %t/RPath.tbd %t/expected.tbd -- --CHECK-NOT: error --CHECK-NOT: warning -- --;--- public.h --extern int publicGlobalVariable; -- --;--- expected.tbd --{ -- "main_library": { -- "exported_symbols": [ -- { -- "data": { -- "global": [ -- "_publicGlobalVariable" -- ] -- } -- } -- ], -- "flags": [ -- { -- "attributes": [ -- "not_app_extension_safe" -- ] -- } -- ], -- "install_names": [ -- { -- "name": "@rpath/Frameworks/RPath.framework/Versions/A/RPath" -- } -- ], -- "rpaths": [ -- { -- "paths": [ -- "@loader_path/../../../SharedFrameworks/", -- "@loader_path/../../PrivateFrameworks/" -- ] -- } -- ], -- "target_info": [ -- { -- "min_deployment": "13.0", -- "target": "x86_64-macos" -- }, -- { -- "min_deployment": "13.0", -- "target": "arm64-macos" -- } -- ] -- }, -- "tapi_tbd_version": 5 --} -- --;--- expected_no_rpaths.tbd --{ -- "main_library": { -- "exported_symbols": [ -- { -- "data": { -- "global": [ -- "_publicGlobalVariable" -- ] -- } -- } -- ], -- "flags": [ -- { -- "attributes": [ -- "not_app_extension_safe" -- ] -- } -- ], -- "install_names": [ -- { -- "name": "@rpath/Frameworks/RPath.framework/Versions/A/RPath" -- } -- ], -- "target_info": [ -- { -- "min_deployment": "13.0", -- "target": "x86_64-macos" -- }, -- { -- "min_deployment": "13.0", -- "target": "arm64-macos" -- } -- ] -- }, -- "tapi_tbd_version": 5 --} -- --;--- expected_xarch_rpaths.tbd --{ -- "main_library": { -- "exported_symbols": [ -- { -- "data": { -- "global": [ -- "_publicGlobalVariable" -- ] -- } -- } -- ], -- "flags": [ -- { -- "attributes": [ -- "not_app_extension_safe" -- ] -- } -- ], -- "install_names": [ -- { -- "name": "@rpath/Frameworks/RPath.framework/Versions/A/RPath" -- } -- ], -- "rpaths": [ -- { -- "paths": [ -- "@loader_path/../../../SharedFrameworks/" -- ], -- "targets": [ -- "arm64-macos" -- ] -- } -- ], -- "target_info": [ -- { -- "min_deployment": "13.0", -- "target": "x86_64-macos" -- }, -- { -- "min_deployment": "13.0", -- "target": "arm64-macos" -- } -- ] -- }, -- "tapi_tbd_version": 5 --} -- --;--- RPath.yaml ----- !fat-mach-o --FatHeader: -- magic: 0xCAFEBABE -- nfat_arch: 2 --FatArchs: -- - cputype: 0x1000007 -- cpusubtype: 0x3 -- offset: 0x1000 -- size: 12408 -- align: 12 -- - cputype: 0x100000C -- cpusubtype: 0x0 -- offset: 0x8000 -- size: 33312 -- align: 14 --Slices: -- - !mach-o -- FileHeader: -- magic: 0xFEEDFACF -- cputype: 0x1000007 -- cpusubtype: 0x3 -- filetype: 0x6 -- ncmds: 16 -- sizeofcmds: 1072 -- flags: 0x100085 -- reserved: 0x0 -- LoadCommands: -- - cmd: LC_SEGMENT_64 -- cmdsize: 152 -- segname: __TEXT -- vmaddr: 0 -- vmsize: 8192 -- fileoff: 0 -- filesize: 8192 -- maxprot: 5 -- initprot: 5 -- nsects: 1 -- flags: 0 -- Sections: -- - sectname: __text -- segname: __TEXT -- addr: 0x1050 -- size: 0 -- offset: 0x1050 -- align: 0 -- reloff: 0x0 -- nreloc: 0 -- flags: 0x80000000 -- reserved1: 0x0 -- reserved2: 0x0 -- reserved3: 0x0 -- content: '' -- - cmd: LC_SEGMENT_64 -- cmdsize: 152 -- segname: __DATA_CONST -- vmaddr: 8192 -- vmsize: 4096 -- fileoff: 8192 -- filesize: 4096 -- maxprot: 3 -- initprot: 3 -- nsects: 1 -- flags: 16 -- Sections: -- - sectname: __objc_imageinfo -- segname: __DATA_CONST -- addr: 0x2000 -- size: 8 -- offset: 0x2000 -- align: 0 -- reloff: 0x0 -- nreloc: 0 -- flags: 0x0 -- reserved1: 0x0 -- reserved2: 0x0 -- reserved3: 0x0 -- content: '0000000040000000' -- - cmd: LC_SEGMENT_64 -- cmdsize: 152 -- segname: __DATA -- vmaddr: 12288 -- vmsize: 4096 -- fileoff: 12288 -- filesize: 0 -- maxprot: 3 -- initprot: 3 -- nsects: 1 -- flags: 0 -- Sections: -- - sectname: __common -- segname: __DATA -- addr: 0x3000 -- size: 4 -- offset: 0x0 -- align: 2 -- reloff: 0x0 -- nreloc: 0 -- flags: 0x1 -- reserved1: 0x0 -- reserved2: 0x0 -- reserved3: 0x0 -- - cmd: LC_SEGMENT_64 -- cmdsize: 72 -- segname: __LINKEDIT -- vmaddr: 16384 -- vmsize: 120 -- fileoff: 12288 -- filesize: 120 -- maxprot: 1 -- initprot: 1 -- nsects: 0 -- flags: 0 -- - cmd: LC_DYLD_INFO_ONLY -- cmdsize: 48 -- rebase_off: 0 -- rebase_size: 0 -- bind_off: 0 -- bind_size: 0 -- weak_bind_off: 0 -- weak_bind_size: 0 -- lazy_bind_off: 0 -- lazy_bind_size: 0 -- export_off: 12288 -- export_size: 32 -- - cmd: LC_SYMTAB -- cmdsize: 24 -- symoff: 12328 -- nsyms: 2 -- stroff: 12360 -- strsize: 48 -- - cmd: LC_DYSYMTAB -- cmdsize: 80 -- ilocalsym: 0 -- nlocalsym: 0 -- iextdefsym: 0 -- nextdefsym: 1 -- iundefsym: 1 -- nundefsym: 1 -- tocoff: 0 -- ntoc: 0 -- modtaboff: 0 -- nmodtab: 0 -- extrefsymoff: 0 -- nextrefsyms: 0 -- indirectsymoff: 0 -- nindirectsyms: 0 -- extreloff: 0 -- nextrel: 0 -- locreloff: 0 -- nlocrel: 0 -- - cmd: LC_RPATH -- cmdsize: 56 -- path: 12 -- Content: '@loader_path/../../../SharedFrameworks/' -- ZeroPadBytes: 5 -- - cmd: LC_RPATH -- cmdsize: 56 -- path: 12 -- Content: '@loader_path/../../PrivateFrameworks/' -- ZeroPadBytes: 7 -- - cmd: LC_ID_DYLIB -- cmdsize: 80 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 65536 -- compatibility_version: 65536 -- Content: '@rpath/Frameworks/RPath.framework/Versions/A/RPath' -- ZeroPadBytes: 6 -- - cmd: LC_UUID -- cmdsize: 24 -- uuid: 4C4C4489-5555-3144-A1D1-28C8EA66FB24 -- - cmd: LC_BUILD_VERSION -- cmdsize: 32 -- platform: 1 -- minos: 851968 -- sdk: 983040 -- ntools: 1 -- Tools: -- - tool: 4 -- version: 1245184 -- - cmd: LC_LOAD_DYLIB -- cmdsize: 56 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 14942208 -- compatibility_version: 65536 -- Content: '/usr/lib/libobjc.A.dylib' -- ZeroPadBytes: 8 -- - cmd: LC_LOAD_DYLIB -- cmdsize: 56 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 88539136 -- compatibility_version: 65536 -- Content: '/usr/lib/libSystem.B.dylib' -- ZeroPadBytes: 6 -- - cmd: LC_FUNCTION_STARTS -- cmdsize: 16 -- dataoff: 12320 -- datasize: 8 -- - cmd: LC_DATA_IN_CODE -- cmdsize: 16 -- dataoff: 12328 -- datasize: 0 -- LinkEditData: -- ExportTrie: -- TerminalSize: 0 -- NodeOffset: 0 -- Name: '' -- Flags: 0x0 -- Address: 0x0 -- Other: 0x0 -- ImportName: '' -- Children: -- - TerminalSize: 3 -- NodeOffset: 25 -- Name: _publicGlobalVariable -- Flags: 0x0 -- Address: 0x3000 -- Other: 0x0 -- ImportName: '' -- NameList: -- - n_strx: 2 -- n_type: 0xF -- n_sect: 3 -- n_desc: 0 -- n_value: 12288 -- - n_strx: 24 -- n_type: 0x1 -- n_sect: 0 -- n_desc: 512 -- n_value: 0 -- StringTable: -- - ' ' -- - _publicGlobalVariable -- - dyld_stub_binder -- - '' -- - '' -- - '' -- - '' -- - '' -- - '' -- - '' -- - !mach-o -- FileHeader: -- magic: 0xFEEDFACF -- cputype: 0x100000C -- cpusubtype: 0x0 -- filetype: 0x6 -- ncmds: 17 -- sizeofcmds: 1088 -- flags: 0x100085 -- reserved: 0x0 -- LoadCommands: -- - cmd: LC_SEGMENT_64 -- cmdsize: 152 -- segname: __TEXT -- vmaddr: 0 -- vmsize: 16384 -- fileoff: 0 -- filesize: 16384 -- maxprot: 5 -- initprot: 5 -- nsects: 1 -- flags: 0 -- Sections: -- - sectname: __text -- segname: __TEXT -- addr: 0x1060 -- size: 0 -- offset: 0x1060 -- align: 0 -- reloff: 0x0 -- nreloc: 0 -- flags: 0x80000000 -- reserved1: 0x0 -- reserved2: 0x0 -- reserved3: 0x0 -- content: '' -- - cmd: LC_SEGMENT_64 -- cmdsize: 152 -- segname: __DATA_CONST -- vmaddr: 16384 -- vmsize: 16384 -- fileoff: 16384 -- filesize: 16384 -- maxprot: 3 -- initprot: 3 -- nsects: 1 -- flags: 16 -- Sections: -- - sectname: __objc_imageinfo -- segname: __DATA_CONST -- addr: 0x4000 -- size: 8 -- offset: 0x4000 -- align: 0 -- reloff: 0x0 -- nreloc: 0 -- flags: 0x0 -- reserved1: 0x0 -- reserved2: 0x0 -- reserved3: 0x0 -- content: '0000000040000000' -- - cmd: LC_SEGMENT_64 -- cmdsize: 152 -- segname: __DATA -- vmaddr: 32768 -- vmsize: 16384 -- fileoff: 32768 -- filesize: 0 -- maxprot: 3 -- initprot: 3 -- nsects: 1 -- flags: 0 -- Sections: -- - sectname: __common -- segname: __DATA -- addr: 0x8000 -- size: 4 -- offset: 0x0 -- align: 2 -- reloff: 0x0 -- nreloc: 0 -- flags: 0x1 -- reserved1: 0x0 -- reserved2: 0x0 -- reserved3: 0x0 -- - cmd: LC_SEGMENT_64 -- cmdsize: 72 -- segname: __LINKEDIT -- vmaddr: 49152 -- vmsize: 544 -- fileoff: 32768 -- filesize: 544 -- maxprot: 1 -- initprot: 1 -- nsects: 0 -- flags: 0 -- - cmd: LC_DYLD_INFO_ONLY -- cmdsize: 48 -- rebase_off: 0 -- rebase_size: 0 -- bind_off: 0 -- bind_size: 0 -- weak_bind_off: 0 -- weak_bind_size: 0 -- lazy_bind_off: 0 -- lazy_bind_size: 0 -- export_off: 32768 -- export_size: 32 -- - cmd: LC_SYMTAB -- cmdsize: 24 -- symoff: 32808 -- nsyms: 2 -- stroff: 32840 -- strsize: 48 -- - cmd: LC_DYSYMTAB -- cmdsize: 80 -- ilocalsym: 0 -- nlocalsym: 0 -- iextdefsym: 0 -- nextdefsym: 1 -- iundefsym: 1 -- nundefsym: 1 -- tocoff: 0 -- ntoc: 0 -- modtaboff: 0 -- nmodtab: 0 -- extrefsymoff: 0 -- nextrefsyms: 0 -- indirectsymoff: 0 -- nindirectsyms: 0 -- extreloff: 0 -- nextrel: 0 -- locreloff: 0 -- nlocrel: 0 -- - cmd: LC_RPATH -- cmdsize: 56 -- path: 12 -- Content: '@loader_path/../../../SharedFrameworks/' -- ZeroPadBytes: 5 -- - cmd: LC_RPATH -- cmdsize: 56 -- path: 12 -- Content: '@loader_path/../../PrivateFrameworks/' -- ZeroPadBytes: 7 -- - cmd: LC_ID_DYLIB -- cmdsize: 80 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 65536 -- compatibility_version: 65536 -- Content: '@rpath/Frameworks/RPath.framework/Versions/A/RPath' -- ZeroPadBytes: 6 -- - cmd: LC_UUID -- cmdsize: 24 -- uuid: 4C4C440D-5555-3144-A18B-DB67A0A12202 -- - cmd: LC_BUILD_VERSION -- cmdsize: 32 -- platform: 1 -- minos: 851968 -- sdk: 983040 -- ntools: 1 -- Tools: -- - tool: 4 -- version: 1245184 -- - cmd: LC_LOAD_DYLIB -- cmdsize: 56 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 14942208 -- compatibility_version: 65536 -- Content: '/usr/lib/libobjc.A.dylib' -- ZeroPadBytes: 8 -- - cmd: LC_LOAD_DYLIB -- cmdsize: 56 -- dylib: -- name: 24 -- timestamp: 0 -- current_version: 88539136 -- compatibility_version: 65536 -- Content: '/usr/lib/libSystem.B.dylib' -- ZeroPadBytes: 6 -- - cmd: LC_FUNCTION_STARTS -- cmdsize: 16 -- dataoff: 32800 -- datasize: 8 -- - cmd: LC_DATA_IN_CODE -- cmdsize: 16 -- dataoff: 32808 -- datasize: 0 -- - cmd: LC_CODE_SIGNATURE -- cmdsize: 16 -- dataoff: 32896 -- datasize: 416 -- LinkEditData: -- ExportTrie: -- TerminalSize: 0 -- NodeOffset: 0 -- Name: '' -- Flags: 0x0 -- Address: 0x0 -- Other: 0x0 -- ImportName: '' -- Children: -- - TerminalSize: 4 -- NodeOffset: 25 -- Name: _publicGlobalVariable -- Flags: 0x0 -- Address: 0x8000 -- Other: 0x0 -- ImportName: '' -- NameList: -- - n_strx: 2 -- n_type: 0xF -- n_sect: 3 -- n_desc: 0 -- n_value: 32768 -- - n_strx: 24 -- n_type: 0x1 -- n_sect: 0 -- n_desc: 512 -- n_value: 0 -- StringTable: -- - ' ' -- - _publicGlobalVariable -- - dyld_stub_binder -- - '' -- - '' -- - '' -- - '' -- - '' -- - '' -- - '' -- FunctionStarts: [ 0x1060 ] --... -diff --git a/clang/tools/clang-installapi/CMakeLists.txt b/clang/tools/clang-installapi/CMakeLists.txt -index 9c0d9dff7dc7..b90ffc847b15 100644 ---- a/clang/tools/clang-installapi/CMakeLists.txt -+++ b/clang/tools/clang-installapi/CMakeLists.txt -@@ -1,5 +1,4 @@ - set(LLVM_LINK_COMPONENTS -- BinaryFormat - Support - TargetParser - TextAPI -diff --git a/clang/tools/clang-installapi/ClangInstallAPI.cpp b/clang/tools/clang-installapi/ClangInstallAPI.cpp -index 0c1980ba5d62..13061cfa36ee 100644 ---- a/clang/tools/clang-installapi/ClangInstallAPI.cpp -+++ b/clang/tools/clang-installapi/ClangInstallAPI.cpp -@@ -101,16 +101,6 @@ static bool run(ArrayRef Args, const char *ProgName) { - if (Diag->hasErrorOccurred()) - return EXIT_FAILURE; - -- if (!Opts.DriverOpts.DylibToVerify.empty()) { -- TargetList Targets; -- llvm::for_each(Opts.DriverOpts.Targets, -- [&](const auto &T) { Targets.push_back(T.first); }); -- if (!Ctx.Verifier->verifyBinaryAttrs(Targets, Ctx.BA, Ctx.Reexports, -- Opts.LinkerOpts.AllowableClients, -- Opts.LinkerOpts.RPaths, Ctx.FT)) -- return EXIT_FAILURE; -- }; -- - // Set up compilation. - std::unique_ptr CI(new CompilerInstance()); - CI->setFileManager(FM.get()); -@@ -118,7 +108,7 @@ static bool run(ArrayRef Args, const char *ProgName) { - if (!CI->hasDiagnostics()) - return EXIT_FAILURE; - -- // Execute, verify and gather AST results. -+ // Execute and gather AST results. - // An invocation is ran for each unique target triple and for each header - // access level. - for (const auto &[Targ, Trip] : Opts.DriverOpts.Targets) { -@@ -146,25 +136,10 @@ static bool run(ArrayRef Args, const char *ProgName) { - - // Assign attributes for serialization. - InterfaceFile IF(Ctx.Verifier->getExports()); -- // Assign attributes that are the same per slice first. - for (const auto &TargetInfo : Opts.DriverOpts.Targets) { - IF.addTarget(TargetInfo.first); - IF.setFromBinaryAttrs(Ctx.BA, TargetInfo.first); - } -- // Then assign potentially different attributes per slice after. -- auto assignLibAttrs = -- [&IF]( -- const auto &Attrs, -- std::function Add) { -- for (const auto &Lib : Attrs) -- for (const auto &T : IF.targets(Lib.getValue())) -- Add(&IF, Lib.getKey(), T); -- }; -- -- assignLibAttrs(Opts.LinkerOpts.AllowableClients, -- &InterfaceFile::addAllowableClient); -- assignLibAttrs(Opts.LinkerOpts.RPaths, &InterfaceFile::addRPath); -- assignLibAttrs(Ctx.Reexports, &InterfaceFile::addReexportedLibrary); - - // Write output file and perform CI cleanup. - if (auto Err = TextAPIWriter::writeToStream(*Out, IF, Ctx.FT)) { -diff --git a/clang/tools/clang-installapi/InstallAPIOpts.td b/clang/tools/clang-installapi/InstallAPIOpts.td -index 8b1998c280dd..010f2507a1d1 100644 ---- a/clang/tools/clang-installapi/InstallAPIOpts.td -+++ b/clang/tools/clang-installapi/InstallAPIOpts.td -@@ -17,23 +17,11 @@ include "llvm/Option/OptParser.td" - ///////// - // Options - --// --/// TextAPI options. --// -+// TextAPI options. - def filetype : Joined<["--"], "filetype=">, - HelpText<"Specify the output file type (tbd-v4 or tbd-v5)">; --def not_for_dyld_shared_cache : Joined<["-"], "not_for_dyld_shared_cache">, -- HelpText<"Mark library as shared cache ineligible">; -- --// --/// Debugging or logging options. --// --def t: Flag<["-"], "t">, -- HelpText<"Logs each dylib loaded for InstallAPI. Useful for debugging problems with search paths where the wrong library is loaded.">; - --// --/// Verification options. --// -+// Verification options. - def verify_against : Separate<["-"], "verify-against">, - HelpText<"Verify the specified dynamic library/framework against the headers">; - def verify_against_EQ : Joined<["--"], "verify-against=">, Alias; -@@ -44,9 +32,7 @@ def demangle : Flag<["--", "-"], "demangle">, - def dsym: Joined<["--"], "dsym=">, - MetaVarName<"">, HelpText<"Specify dSYM path for enriched diagnostics.">; - --// --/// Additional input options. --// -+// Additional input options. - def extra_project_header : Separate<["-"], "extra-project-header">, - MetaVarName<"">, - HelpText<"Add additional project header location for parsing">; -@@ -89,23 +75,3 @@ def project_umbrella_header : Separate<["-"], "project-umbrella-header">, - MetaVarName<"">, HelpText<"Specify the project umbrella header location">; - def project_umbrella_header_EQ : Joined<["--"], "project-umbrella-header=">, - Alias; -- --// --/// Overidden clang options for different behavior. --// -- --// Clang's Xarch does not support options that require arguments. --// But is supported for InstallAPI generation. --def Xarch__ : Joined<["-"], "Xarch_">; --def allowable_client : Separate<["-"], "allowable_client">, -- HelpText<"Restricts what can link against the dynamic library being created">; --def rpath: Separate<["-"], "rpath">, -- HelpText<"Add path to the runpath search path list for the dynamic library being created.">; --def reexport_l : Joined<["-"], "reexport-l">, -- HelpText<"Re-export the specified library">; --def reexport_library : Separate<["-"], "reexport_library">, MetaVarName<"">, -- HelpText<"Re-export the specified library">; --def reexport_framework : Separate<["-"], "reexport_framework">, -- HelpText<"Re-export the specified framework">; -- -- -diff --git a/clang/tools/clang-installapi/Options.cpp b/clang/tools/clang-installapi/Options.cpp -index d1f911812800..04d5e3cbb9d6 100644 ---- a/clang/tools/clang-installapi/Options.cpp -+++ b/clang/tools/clang-installapi/Options.cpp -@@ -7,17 +7,14 @@ - //===----------------------------------------------------------------------===// - - #include "Options.h" --#include "clang/Basic/DiagnosticIDs.h" - #include "clang/Driver/Driver.h" -+#include "clang/Frontend/FrontendDiagnostic.h" - #include "clang/InstallAPI/FileList.h" - #include "clang/InstallAPI/HeaderFile.h" - #include "clang/InstallAPI/InstallAPIDiagnostic.h" --#include "llvm/BinaryFormat/Magic.h" - #include "llvm/Support/Program.h" - #include "llvm/TargetParser/Host.h" - #include "llvm/TextAPI/DylibReader.h" --#include "llvm/TextAPI/TextAPIError.h" --#include "llvm/TextAPI/TextAPIReader.h" - #include "llvm/TextAPI/TextAPIWriter.h" - - using namespace llvm; -@@ -140,56 +137,6 @@ bool Options::processDriverOptions(InputArgList &Args) { - return true; - } - --bool Options::processInstallAPIXOptions(InputArgList &Args) { -- for (arg_iterator It = Args.begin(), End = Args.end(); It != End; ++It) { -- if ((*It)->getOption().matches(OPT_Xarch__)) { -- if (!processXarchOption(Args, It)) -- return false; -- } -- } -- // TODO: Add support for the all of the X* options installapi supports. -- -- return true; --} -- --bool Options::processXarchOption(InputArgList &Args, arg_iterator Curr) { -- Arg *CurrArg = *Curr; -- Architecture Arch = getArchitectureFromName(CurrArg->getValue(0)); -- if (Arch == AK_unknown) { -- Diags->Report(diag::err_drv_invalid_arch_name) -- << CurrArg->getAsString(Args); -- return false; -- } -- -- auto NextIt = std::next(Curr); -- if (NextIt == Args.end()) { -- Diags->Report(diag::err_drv_missing_argument) -- << CurrArg->getAsString(Args) << 1; -- return false; -- } -- -- // InstallAPI has a limited understanding of supported Xarch options. -- // Currently this is restricted to linker inputs. -- const Arg *NextArg = *NextIt; -- switch (NextArg->getOption().getID()) { -- case OPT_allowable_client: -- case OPT_reexport_l: -- case OPT_reexport_framework: -- case OPT_reexport_library: -- case OPT_rpath: -- break; -- default: -- Diags->Report(diag::err_drv_invalid_argument_to_option) -- << NextArg->getAsString(Args) << CurrArg->getAsString(Args); -- return false; -- } -- -- ArgToArchMap[NextArg] = Arch; -- CurrArg->claim(); -- -- return true; --} -- - bool Options::processLinkerOptions(InputArgList &Args) { - // Handle required arguments. - if (const Arg *A = Args.getLastArg(drv::OPT_install__name)) -@@ -206,12 +153,6 @@ bool Options::processLinkerOptions(InputArgList &Args) { - if (auto *Arg = Args.getLastArg(drv::OPT_compatibility__version)) - LinkerOpts.CompatVersion.parse64(Arg->getValue()); - -- if (auto *Arg = Args.getLastArg(drv::OPT_compatibility__version)) -- LinkerOpts.CompatVersion.parse64(Arg->getValue()); -- -- if (auto *Arg = Args.getLastArg(drv::OPT_umbrella)) -- LinkerOpts.ParentUmbrella = Arg->getValue(); -- - LinkerOpts.IsDylib = Args.hasArg(drv::OPT_dynamiclib); - - LinkerOpts.AppExtensionSafe = Args.hasFlag( -@@ -223,24 +164,12 @@ bool Options::processLinkerOptions(InputArgList &Args) { - - if (::getenv("LD_APPLICATION_EXTENSION_SAFE") != nullptr) - LinkerOpts.AppExtensionSafe = true; -- -- // Capture library paths. -- PathSeq LibraryPaths; -- for (const Arg *A : Args.filtered(drv::OPT_L)) { -- LibraryPaths.emplace_back(A->getValue()); -- A->claim(); -- } -- -- if (!LibraryPaths.empty()) -- LinkerOpts.LibPaths = std::move(LibraryPaths); -- - return true; - } - --// NOTE: Do not claim any arguments, as they will be passed along for CC1 --// invocations. - bool Options::processFrontendOptions(InputArgList &Args) { -- // Capture language mode. -+ // Do not claim any arguments, as they will be passed along for CC1 -+ // invocations. - if (auto *A = Args.getLastArgNoClaim(drv::OPT_x)) { - FEOpts.LangMode = llvm::StringSwitch(A->getValue()) - .Case("c", clang::Language::C) -@@ -262,54 +191,6 @@ bool Options::processFrontendOptions(InputArgList &Args) { - FEOpts.LangMode = clang::Language::ObjCXX; - } - -- // Capture Sysroot. -- if (const Arg *A = Args.getLastArgNoClaim(drv::OPT_isysroot)) { -- SmallString Path(A->getValue()); -- FM->makeAbsolutePath(Path); -- if (!FM->getOptionalDirectoryRef(Path)) { -- Diags->Report(diag::err_missing_sysroot) << Path; -- return false; -- } -- FEOpts.ISysroot = std::string(Path); -- } else if (FEOpts.ISysroot.empty()) { -- // Mirror CLANG and obtain the isysroot from the SDKROOT environment -- // variable, if it wasn't defined by the command line. -- if (auto *Env = ::getenv("SDKROOT")) { -- if (StringRef(Env) != "/" && llvm::sys::path::is_absolute(Env) && -- FM->getOptionalFileRef(Env)) -- FEOpts.ISysroot = Env; -- } -- } -- -- // Capture system frameworks. -- // TODO: Support passing framework paths per platform. -- for (const Arg *A : Args.filtered(drv::OPT_iframework)) -- FEOpts.SystemFwkPaths.emplace_back(A->getValue()); -- -- // Capture framework paths. -- PathSeq FrameworkPaths; -- for (const Arg *A : Args.filtered(drv::OPT_F)) -- FrameworkPaths.emplace_back(A->getValue()); -- -- if (!FrameworkPaths.empty()) -- FEOpts.FwkPaths = std::move(FrameworkPaths); -- -- // Add default framework/library paths. -- PathSeq DefaultLibraryPaths = {"/usr/lib", "/usr/local/lib"}; -- PathSeq DefaultFrameworkPaths = {"/Library/Frameworks", -- "/System/Library/Frameworks"}; -- -- for (const StringRef LibPath : DefaultLibraryPaths) { -- SmallString Path(FEOpts.ISysroot); -- sys::path::append(Path, LibPath); -- LinkerOpts.LibPaths.emplace_back(Path.str()); -- } -- for (const StringRef FwkPath : DefaultFrameworkPaths) { -- SmallString Path(FEOpts.ISysroot); -- sys::path::append(Path, FwkPath); -- FEOpts.SystemFwkPaths.emplace_back(Path.str()); -- } -- - return true; - } - -@@ -343,9 +224,6 @@ Options::processAndFilterOutInstallAPIOptions(ArrayRef Args) { - MissingArgCount, Visibility()); - - // Capture InstallAPI only driver options. -- if (!processInstallAPIXOptions(ParsedArgs)) -- return {}; -- - DriverOpts.Demangle = ParsedArgs.hasArg(OPT_demangle); - - if (auto *A = ParsedArgs.getLastArg(OPT_filetype)) { -@@ -378,42 +256,6 @@ Options::processAndFilterOutInstallAPIOptions(ArrayRef Args) { - if (const Arg *A = ParsedArgs.getLastArg(OPT_dsym)) - DriverOpts.DSYMPath = A->getValue(); - -- DriverOpts.TraceLibraryLocation = ParsedArgs.hasArg(OPT_t); -- -- // Linker options not handled by clang driver. -- LinkerOpts.OSLibNotForSharedCache = -- ParsedArgs.hasArg(OPT_not_for_dyld_shared_cache); -- -- for (const Arg *A : ParsedArgs.filtered(OPT_allowable_client)) { -- LinkerOpts.AllowableClients[A->getValue()] = -- ArgToArchMap.count(A) ? ArgToArchMap[A] : ArchitectureSet(); -- A->claim(); -- } -- -- for (const Arg *A : ParsedArgs.filtered(OPT_reexport_l)) { -- LinkerOpts.ReexportedLibraries[A->getValue()] = -- ArgToArchMap.count(A) ? ArgToArchMap[A] : ArchitectureSet(); -- A->claim(); -- } -- -- for (const Arg *A : ParsedArgs.filtered(OPT_reexport_library)) { -- LinkerOpts.ReexportedLibraryPaths[A->getValue()] = -- ArgToArchMap.count(A) ? ArgToArchMap[A] : ArchitectureSet(); -- A->claim(); -- } -- -- for (const Arg *A : ParsedArgs.filtered(OPT_reexport_framework)) { -- LinkerOpts.ReexportedFrameworks[A->getValue()] = -- ArgToArchMap.count(A) ? ArgToArchMap[A] : ArchitectureSet(); -- A->claim(); -- } -- -- for (const Arg *A : ParsedArgs.filtered(OPT_rpath)) { -- LinkerOpts.RPaths[A->getValue()] = -- ArgToArchMap.count(A) ? ArgToArchMap[A] : ArchitectureSet(); -- A->claim(); -- } -- - // Handle exclude & extra header directories or files. - auto handleAdditionalInputArgs = [&](PathSeq &Headers, - clang::installapi::ID OptID) { -@@ -494,22 +336,6 @@ Options::Options(DiagnosticsEngine &Diag, FileManager *FM, - if (!processFrontendOptions(ArgList)) - return; - -- // After all InstallAPI necessary arguments have been collected. Go back and -- // assign values that were unknown before the clang driver opt table was used. -- ArchitectureSet AllArchs; -- llvm::for_each(DriverOpts.Targets, -- [&AllArchs](const auto &T) { AllArchs.set(T.first.Arch); }); -- auto assignDefaultLibAttrs = [&AllArchs](LibAttrs &Attrs) { -- for (StringMapEntry &Entry : Attrs) -- if (Entry.getValue().empty()) -- Entry.setValue(AllArchs); -- }; -- assignDefaultLibAttrs(LinkerOpts.AllowableClients); -- assignDefaultLibAttrs(LinkerOpts.ReexportedFrameworks); -- assignDefaultLibAttrs(LinkerOpts.ReexportedLibraries); -- assignDefaultLibAttrs(LinkerOpts.ReexportedLibraryPaths); -- assignDefaultLibAttrs(LinkerOpts.RPaths); -- - /// Force cc1 options that should always be on. - FrontendArgs = {"-fsyntax-only", "-Wprivate-extern"}; - -@@ -531,89 +357,6 @@ static StringRef getFrameworkNameFromInstallName(StringRef InstallName) { - return Match.back(); - } - --static Expected> --getInterfaceFile(const StringRef Filename) { -- ErrorOr> BufferOrErr = -- MemoryBuffer::getFile(Filename); -- if (auto Err = BufferOrErr.getError()) -- return errorCodeToError(std::move(Err)); -- -- auto Buffer = std::move(*BufferOrErr); -- std::unique_ptr IF; -- switch (identify_magic(Buffer->getBuffer())) { -- case file_magic::macho_dynamically_linked_shared_lib: -- LLVM_FALLTHROUGH; -- case file_magic::macho_dynamically_linked_shared_lib_stub: -- LLVM_FALLTHROUGH; -- case file_magic::macho_universal_binary: -- return DylibReader::get(Buffer->getMemBufferRef()); -- break; -- case file_magic::tapi_file: -- return TextAPIReader::get(Buffer->getMemBufferRef()); -- default: -- return make_error(TextAPIErrorCode::InvalidInputFormat, -- "unsupported library file format"); -- } -- llvm_unreachable("unexpected failure in getInterface"); --} -- --std::pair Options::getReexportedLibraries() { -- LibAttrs Reexports; -- ReexportedInterfaces ReexportIFs; -- auto AccumulateReexports = [&](StringRef Path, const ArchitectureSet &Archs) { -- auto ReexportIFOrErr = getInterfaceFile(Path); -- if (!ReexportIFOrErr) -- return false; -- std::unique_ptr Reexport = std::move(*ReexportIFOrErr); -- StringRef InstallName = Reexport->getInstallName(); -- assert(!InstallName.empty() && "Parse error for install name"); -- Reexports.insert({InstallName, Archs}); -- ReexportIFs.emplace_back(std::move(*Reexport)); -- return true; -- }; -- -- // Populate search paths by looking at user paths before system ones. -- PathSeq FwkSearchPaths(FEOpts.FwkPaths.begin(), FEOpts.FwkPaths.end()); -- // FIXME: System framework paths need to reset if installapi is invoked with -- // different platforms. -- FwkSearchPaths.insert(FwkSearchPaths.end(), FEOpts.SystemFwkPaths.begin(), -- FEOpts.SystemFwkPaths.end()); -- -- for (const StringMapEntry &Lib : -- LinkerOpts.ReexportedLibraries) { -- std::string Name = "lib" + Lib.getKey().str() + ".dylib"; -- std::string Path = findLibrary(Name, *FM, {}, LinkerOpts.LibPaths, {}); -- if (Path.empty()) { -- Diags->Report(diag::err_cannot_find_reexport) << true << Lib.getKey(); -- return {}; -- } -- if (DriverOpts.TraceLibraryLocation) -- errs() << Path << "\n"; -- -- AccumulateReexports(Path, Lib.getValue()); -- } -- -- for (const StringMapEntry &Lib : -- LinkerOpts.ReexportedLibraryPaths) -- AccumulateReexports(Lib.getKey(), Lib.getValue()); -- -- for (const StringMapEntry &Lib : -- LinkerOpts.ReexportedFrameworks) { -- std::string Name = (Lib.getKey() + ".framework/" + Lib.getKey()).str(); -- std::string Path = findLibrary(Name, *FM, FwkSearchPaths, {}, {}); -- if (Path.empty()) { -- Diags->Report(diag::err_cannot_find_reexport) << false << Lib.getKey(); -- return {}; -- } -- if (DriverOpts.TraceLibraryLocation) -- errs() << Path << "\n"; -- -- AccumulateReexports(Path, Lib.getValue()); -- } -- -- return {std::move(Reexports), std::move(ReexportIFs)}; --} -- - InstallAPIContext Options::createContext() { - InstallAPIContext Ctx; - Ctx.FM = FM; -@@ -626,17 +369,10 @@ InstallAPIContext Options::createContext() { - Ctx.BA.CurrentVersion = LinkerOpts.CurrentVersion; - Ctx.BA.CompatVersion = LinkerOpts.CompatVersion; - Ctx.BA.AppExtensionSafe = LinkerOpts.AppExtensionSafe; -- Ctx.BA.ParentUmbrella = LinkerOpts.ParentUmbrella; -- Ctx.BA.OSLibNotForSharedCache = LinkerOpts.OSLibNotForSharedCache; - Ctx.FT = DriverOpts.OutFT; - Ctx.OutputLoc = DriverOpts.OutputPath; - Ctx.LangMode = FEOpts.LangMode; - -- auto [Reexports, ReexportedIFs] = getReexportedLibraries(); -- if (Diags->hasErrorOccurred()) -- return Ctx; -- Ctx.Reexports = Reexports; -- - // Attempt to find umbrella headers by capturing framework name. - StringRef FrameworkName; - if (!LinkerOpts.IsDylib) -@@ -796,14 +532,13 @@ InstallAPIContext Options::createContext() { - Expected Slices = - DylibReader::readFile((*Buffer)->getMemBufferRef(), PO); - if (auto Err = Slices.takeError()) { -- Diags->Report(diag::err_cannot_open_file) -- << DriverOpts.DylibToVerify << std::move(Err); -+ Diags->Report(diag::err_cannot_open_file) << DriverOpts.DylibToVerify; - return Ctx; - } - - Ctx.Verifier = std::make_unique( -- std::move(*Slices), std::move(ReexportedIFs), Diags, -- DriverOpts.VerifyMode, DriverOpts.Demangle, DriverOpts.DSYMPath); -+ std::move(*Slices), Diags, DriverOpts.VerifyMode, DriverOpts.Demangle, -+ DriverOpts.DSYMPath); - return Ctx; - } - -diff --git a/clang/tools/clang-installapi/Options.h b/clang/tools/clang-installapi/Options.h -index 6da1469de2c8..cd74722c92c8 100644 ---- a/clang/tools/clang-installapi/Options.h -+++ b/clang/tools/clang-installapi/Options.h -@@ -20,6 +20,7 @@ - #include "llvm/Option/Option.h" - #include "llvm/Support/Program.h" - #include "llvm/TargetParser/Triple.h" -+#include - #include - #include - -@@ -80,30 +81,9 @@ struct DriverOptions { - - /// \brief Print verbose output. - bool Verbose = false; -- -- /// \brief Log libraries loaded. -- bool TraceLibraryLocation = false; - }; - - struct LinkerOptions { -- /// \brief List of allowable clients to use for the dynamic library. -- LibAttrs AllowableClients; -- -- /// \brief List of reexported libraries to use for the dynamic library. -- LibAttrs ReexportedLibraries; -- -- /// \brief List of reexported libraries to use for the dynamic library. -- LibAttrs ReexportedLibraryPaths; -- -- /// \brief List of reexported frameworks to use for the dynamic library. -- LibAttrs ReexportedFrameworks; -- -- /// \brief List of rpaths to use for the dynamic library. -- LibAttrs RPaths; -- -- /// \brief Additional library search paths. -- PathSeq LibPaths; -- - /// \brief The install name to use for the dynamic library. - std::string InstallName; - -@@ -113,34 +93,18 @@ struct LinkerOptions { - /// \brief The compatibility version to use for the dynamic library. - PackedVersion CompatVersion; - -- /// \brief Name of the umbrella library. -- std::string ParentUmbrella; -- - /// \brief Is application extension safe. - bool AppExtensionSafe = false; - - /// \brief Set if we should scan for a dynamic library and not a framework. - bool IsDylib = false; -- -- /// \brief Is an OS library that is not shared cache eligible. -- bool OSLibNotForSharedCache = false; - }; - - struct FrontendOptions { - /// \brief The language mode to parse headers in. - Language LangMode = Language::ObjC; -- -- /// \brief The sysroot to search for SDK headers or libraries. -- std::string ISysroot; -- -- /// \brief Additional framework search paths. -- PathSeq FwkPaths; -- -- /// \brief Additional SYSTEM framework search paths. -- PathSeq SystemFwkPaths; - }; - --using arg_iterator = llvm::opt::arg_iterator; - class Options { - private: - bool processDriverOptions(llvm::opt::InputArgList &Args); -@@ -148,8 +112,6 @@ private: - bool processFrontendOptions(llvm::opt::InputArgList &Args); - std::vector - processAndFilterOutInstallAPIOptions(ArrayRef Args); -- bool processInstallAPIXOptions(llvm::opt::InputArgList &Args); -- bool processXarchOption(llvm::opt::InputArgList &Args, arg_iterator Curr); - - public: - /// The various options grouped together. -@@ -174,12 +136,9 @@ private: - bool addFilePaths(llvm::opt::InputArgList &Args, PathSeq &Headers, - llvm::opt::OptSpecifier ID); - -- std::pair getReexportedLibraries(); -- - DiagnosticsEngine *Diags; - FileManager *FM; - std::vector FrontendArgs; -- llvm::DenseMap ArgToArchMap; - }; - - enum ID { --- -2.44.0.1.g9765aa7075 - diff --git a/build/build-clang/revert-llvmorg-19-init-7619-gf139387fb6e7.patch b/build/build-clang/revert-llvmorg-19-init-7619-gf139387fb6e7.patch deleted file mode 100644 index c4fabc544e6c..000000000000 --- a/build/build-clang/revert-llvmorg-19-init-7619-gf139387fb6e7.patch +++ /dev/null @@ -1,29 +0,0 @@ -From ac70c3cfc46e04a6658550e4aa5620a332741f5f Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Thu, 11 Apr 2024 08:56:28 +0900 -Subject: [PATCH 1/3] Revert "Fix MSVC "not all control paths return a value" - warning. NFC." - -This reverts commit f139387fb6e76a5249e8d7c2d124565e6b566ef4. ---- - clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp b/clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp -index cc252d51e3b6..1fa988f93bdd 100644 ---- a/clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp -+++ b/clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp -@@ -81,9 +81,8 @@ const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - return DB; - case FileType::Invalid: - case FileType::All: -- break; -+ llvm_unreachable("Unexpected file type for diagnostics."); - } -- llvm_unreachable("Unexpected file type for diagnostics."); - } - - const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, --- -2.44.0.1.g9765aa7075 - diff --git a/build/build-clang/revert-llvmorg-19-init-7807-gf04452de1986.patch b/build/build-clang/revert-llvmorg-19-init-7807-gf04452de1986.patch deleted file mode 100644 index 3fb2f7389f0f..000000000000 --- a/build/build-clang/revert-llvmorg-19-init-7807-gf04452de1986.patch +++ /dev/null @@ -1,273 +0,0 @@ -From 74e0d23a9f7523db759e26462c2dd721ababff48 Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Thu, 11 Apr 2024 08:57:06 +0900 -Subject: [PATCH 2/3] Revert "[InstallAPI] Tie lifetime of FE objects to - DylibVerifier (#88189)" - -This reverts commit f04452de1986e4e01296a80231efb212d6c84c42. ---- - .../include/clang/InstallAPI/DylibVerifier.h | 10 ++-- - clang/include/clang/InstallAPI/Frontend.h | 2 +- - .../clang/InstallAPI/FrontendRecords.h | 1 - - clang/lib/InstallAPI/DylibVerifier.cpp | 47 ++++++++++--------- - clang/lib/InstallAPI/Frontend.cpp | 15 +++--- - .../clang-installapi/ClangInstallAPI.cpp | 2 - - 6 files changed, 37 insertions(+), 40 deletions(-) - -diff --git a/clang/include/clang/InstallAPI/DylibVerifier.h b/clang/include/clang/InstallAPI/DylibVerifier.h -index a3df25f10de4..07dbd3bf5f2b 100644 ---- a/clang/include/clang/InstallAPI/DylibVerifier.h -+++ b/clang/include/clang/InstallAPI/DylibVerifier.h -@@ -10,7 +10,6 @@ - #define LLVM_CLANG_INSTALLAPI_DYLIBVERIFIER_H - - #include "clang/Basic/Diagnostic.h" --#include "clang/Basic/SourceManager.h" - #include "clang/InstallAPI/MachO.h" - - namespace clang { -@@ -100,7 +99,11 @@ public: - Result getState() const { return Ctx.FrontendState; } - - /// Set different source managers to the same diagnostics engine. -- void setSourceManager(IntrusiveRefCntPtr SourceMgr); -+ void setSourceManager(SourceManager &SourceMgr) const { -+ if (!Ctx.Diag) -+ return; -+ Ctx.Diag->setSourceManager(&SourceMgr); -+ } - - private: - /// Determine whether to compare declaration to symbol in binary. -@@ -187,9 +190,6 @@ private: - - // Track DWARF provided source location for dylibs. - DWARFContext *DWARFCtx = nullptr; -- -- // Source manager for each unique compiler instance. -- llvm::SmallVector, 12> SourceManagers; - }; - - } // namespace installapi -diff --git a/clang/include/clang/InstallAPI/Frontend.h b/clang/include/clang/InstallAPI/Frontend.h -index bc4e77de2b72..5cccd891c580 100644 ---- a/clang/include/clang/InstallAPI/Frontend.h -+++ b/clang/include/clang/InstallAPI/Frontend.h -@@ -36,7 +36,7 @@ public: - std::unique_ptr CreateASTConsumer(CompilerInstance &CI, - StringRef InFile) override { - Ctx.Diags->getClient()->BeginSourceFile(CI.getLangOpts()); -- Ctx.Verifier->setSourceManager(CI.getSourceManagerPtr()); -+ Ctx.Verifier->setSourceManager(CI.getSourceManager()); - return std::make_unique( - CI.getASTContext(), Ctx, CI.getSourceManager(), CI.getPreprocessor()); - } -diff --git a/clang/include/clang/InstallAPI/FrontendRecords.h b/clang/include/clang/InstallAPI/FrontendRecords.h -index ef82398addd7..59271e81e230 100644 ---- a/clang/include/clang/InstallAPI/FrontendRecords.h -+++ b/clang/include/clang/InstallAPI/FrontendRecords.h -@@ -21,7 +21,6 @@ namespace installapi { - struct FrontendAttrs { - const AvailabilityInfo Avail; - const Decl *D; -- const SourceLocation Loc; - const HeaderType Access; - }; - -diff --git a/clang/lib/InstallAPI/DylibVerifier.cpp b/clang/lib/InstallAPI/DylibVerifier.cpp -index 4fa2d4e9292c..2387ee0e78ad 100644 ---- a/clang/lib/InstallAPI/DylibVerifier.cpp -+++ b/clang/lib/InstallAPI/DylibVerifier.cpp -@@ -214,16 +214,16 @@ bool DylibVerifier::compareObjCInterfaceSymbols(const Record *R, - StringRef SymName, bool PrintAsWarning = false) { - if (SymLinkage == RecordLinkage::Unknown) - Ctx.emitDiag([&]() { -- Ctx.Diag->Report(SymCtx.FA->Loc, PrintAsWarning -- ? diag::warn_library_missing_symbol -- : diag::err_library_missing_symbol) -+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(), -+ PrintAsWarning ? diag::warn_library_missing_symbol -+ : diag::err_library_missing_symbol) - << SymName; - }); - else - Ctx.emitDiag([&]() { -- Ctx.Diag->Report(SymCtx.FA->Loc, PrintAsWarning -- ? diag::warn_library_hidden_symbol -- : diag::err_library_hidden_symbol) -+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(), -+ PrintAsWarning ? diag::warn_library_hidden_symbol -+ : diag::err_library_hidden_symbol) - << SymName; - }); - }; -@@ -270,14 +270,16 @@ DylibVerifier::Result DylibVerifier::compareVisibility(const Record *R, - if (R->isExported()) { - if (!DR) { - Ctx.emitDiag([&]() { -- Ctx.Diag->Report(SymCtx.FA->Loc, diag::err_library_missing_symbol) -+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(), -+ diag::err_library_missing_symbol) - << getAnnotatedName(R, SymCtx); - }); - return Result::Invalid; - } - if (DR->isInternal()) { - Ctx.emitDiag([&]() { -- Ctx.Diag->Report(SymCtx.FA->Loc, diag::err_library_hidden_symbol) -+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(), -+ diag::err_library_hidden_symbol) - << getAnnotatedName(R, SymCtx); - }); - return Result::Invalid; -@@ -304,7 +306,8 @@ DylibVerifier::Result DylibVerifier::compareVisibility(const Record *R, - Outcome = Result::Invalid; - } - Ctx.emitDiag([&]() { -- Ctx.Diag->Report(SymCtx.FA->Loc, ID) << getAnnotatedName(R, SymCtx); -+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(), ID) -+ << getAnnotatedName(R, SymCtx); - }); - return Outcome; - } -@@ -326,13 +329,15 @@ DylibVerifier::Result DylibVerifier::compareAvailability(const Record *R, - switch (Mode) { - case VerificationMode::ErrorsAndWarnings: - Ctx.emitDiag([&]() { -- Ctx.Diag->Report(SymCtx.FA->Loc, diag::warn_header_availability_mismatch) -+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(), -+ diag::warn_header_availability_mismatch) - << getAnnotatedName(R, SymCtx) << IsDeclAvailable << IsDeclAvailable; - }); - return Result::Ignore; - case VerificationMode::Pedantic: - Ctx.emitDiag([&]() { -- Ctx.Diag->Report(SymCtx.FA->Loc, diag::err_header_availability_mismatch) -+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(), -+ diag::err_header_availability_mismatch) - << getAnnotatedName(R, SymCtx) << IsDeclAvailable << IsDeclAvailable; - }); - return Result::Invalid; -@@ -348,14 +353,16 @@ bool DylibVerifier::compareSymbolFlags(const Record *R, SymbolContext &SymCtx, - const Record *DR) { - if (DR->isThreadLocalValue() && !R->isThreadLocalValue()) { - Ctx.emitDiag([&]() { -- Ctx.Diag->Report(SymCtx.FA->Loc, diag::err_dylib_symbol_flags_mismatch) -+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(), -+ diag::err_dylib_symbol_flags_mismatch) - << getAnnotatedName(DR, SymCtx) << DR->isThreadLocalValue(); - }); - return false; - } - if (!DR->isThreadLocalValue() && R->isThreadLocalValue()) { - Ctx.emitDiag([&]() { -- Ctx.Diag->Report(SymCtx.FA->Loc, diag::err_header_symbol_flags_mismatch) -+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(), -+ diag::err_header_symbol_flags_mismatch) - << getAnnotatedName(R, SymCtx) << R->isThreadLocalValue(); - }); - return false; -@@ -363,14 +370,16 @@ bool DylibVerifier::compareSymbolFlags(const Record *R, SymbolContext &SymCtx, - - if (DR->isWeakDefined() && !R->isWeakDefined()) { - Ctx.emitDiag([&]() { -- Ctx.Diag->Report(SymCtx.FA->Loc, diag::err_dylib_symbol_flags_mismatch) -+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(), -+ diag::err_dylib_symbol_flags_mismatch) - << getAnnotatedName(DR, SymCtx) << R->isWeakDefined(); - }); - return false; - } - if (!DR->isWeakDefined() && R->isWeakDefined()) { - Ctx.emitDiag([&]() { -- Ctx.Diag->Report(SymCtx.FA->Loc, diag::err_header_symbol_flags_mismatch) -+ Ctx.Diag->Report(SymCtx.FA->D->getLocation(), -+ diag::err_header_symbol_flags_mismatch) - << getAnnotatedName(R, SymCtx) << R->isWeakDefined(); - }); - return false; -@@ -478,14 +487,6 @@ void DylibVerifier::setTarget(const Target &T) { - assignSlice(T); - } - --void DylibVerifier::setSourceManager( -- IntrusiveRefCntPtr SourceMgr) { -- if (!Ctx.Diag) -- return; -- SourceManagers.push_back(std::move(SourceMgr)); -- Ctx.Diag->setSourceManager(SourceManagers.back().get()); --} -- - DylibVerifier::Result DylibVerifier::verify(ObjCIVarRecord *R, - const FrontendAttrs *FA, - const StringRef SuperClass) { -diff --git a/clang/lib/InstallAPI/Frontend.cpp b/clang/lib/InstallAPI/Frontend.cpp -index 04d06f46d265..bd7589c13e04 100644 ---- a/clang/lib/InstallAPI/Frontend.cpp -+++ b/clang/lib/InstallAPI/Frontend.cpp -@@ -23,8 +23,7 @@ std::pair FrontendRecordsSlice::addGlobal( - - GlobalRecord *GR = - llvm::MachO::RecordsSlice::addGlobal(Name, Linkage, GV, Flags, Inlined); -- auto Result = FrontendRecords.insert( -- {GR, FrontendAttrs{Avail, D, D->getLocation(), Access}}); -+ auto Result = FrontendRecords.insert({GR, FrontendAttrs{Avail, D, Access}}); - return {GR, &(Result.first->second)}; - } - -@@ -40,8 +39,8 @@ FrontendRecordsSlice::addObjCInterface(StringRef Name, RecordLinkage Linkage, - - ObjCInterfaceRecord *ObjCR = - llvm::MachO::RecordsSlice::addObjCInterface(Name, Linkage, SymType); -- auto Result = FrontendRecords.insert( -- {ObjCR, FrontendAttrs{Avail, D, D->getLocation(), Access}}); -+ auto Result = -+ FrontendRecords.insert({ObjCR, FrontendAttrs{Avail, D, Access}}); - return {ObjCR, &(Result.first->second)}; - } - -@@ -52,8 +51,8 @@ FrontendRecordsSlice::addObjCCategory(StringRef ClassToExtend, - const Decl *D, HeaderType Access) { - ObjCCategoryRecord *ObjCR = - llvm::MachO::RecordsSlice::addObjCCategory(ClassToExtend, CategoryName); -- auto Result = FrontendRecords.insert( -- {ObjCR, FrontendAttrs{Avail, D, D->getLocation(), Access}}); -+ auto Result = -+ FrontendRecords.insert({ObjCR, FrontendAttrs{Avail, D, Access}}); - return {ObjCR, &(Result.first->second)}; - } - -@@ -68,8 +67,8 @@ std::pair FrontendRecordsSlice::addObjCIVar( - Linkage = RecordLinkage::Internal; - ObjCIVarRecord *ObjCR = - llvm::MachO::RecordsSlice::addObjCIVar(Container, IvarName, Linkage); -- auto Result = FrontendRecords.insert( -- {ObjCR, FrontendAttrs{Avail, D, D->getLocation(), Access}}); -+ auto Result = -+ FrontendRecords.insert({ObjCR, FrontendAttrs{Avail, D, Access}}); - - return {ObjCR, &(Result.first->second)}; - } -diff --git a/clang/tools/clang-installapi/ClangInstallAPI.cpp b/clang/tools/clang-installapi/ClangInstallAPI.cpp -index fd71aaec5943..0c1980ba5d62 100644 ---- a/clang/tools/clang-installapi/ClangInstallAPI.cpp -+++ b/clang/tools/clang-installapi/ClangInstallAPI.cpp -@@ -121,7 +121,6 @@ static bool run(ArrayRef Args, const char *ProgName) { - // Execute, verify and gather AST results. - // An invocation is ran for each unique target triple and for each header - // access level. -- Records FrontendRecords; - for (const auto &[Targ, Trip] : Opts.DriverOpts.Targets) { - Ctx.Verifier->setTarget(Targ); - Ctx.Slice = std::make_shared(Trip); -@@ -132,7 +131,6 @@ static bool run(ArrayRef Args, const char *ProgName) { - InMemoryFileSystem.get(), Opts.getClangFrontendArgs())) - return EXIT_FAILURE; - } -- FrontendRecords.emplace_back(std::move(Ctx.Slice)); - } - - if (Ctx.Verifier->verifyRemainingSymbols() == DylibVerifier::Result::Invalid) --- -2.44.0.1.g9765aa7075 -