diff options
Diffstat (limited to 'build')
50 files changed, 458 insertions, 3159 deletions
diff --git a/build/autoconf/expandlibs.m4 b/build/autoconf/expandlibs.m4 index 70bc153e66..b0fc6caf95 100644 --- a/build/autoconf/expandlibs.m4 +++ b/build/autoconf/expandlibs.m4 @@ -14,32 +14,25 @@ dnl ======================================================== AC_CACHE_CHECK(what kind of list files are supported by the linker, moz_cv_expand_libs_list_style, [echo "int main() {return 0;}" > conftest.${ac_ext} - dnl Because BFD ld doesn't work with LTO + linker scripts, we - dnl must pass the LTO CFLAGS to the compile command, and the LTO - dnl LDFLAGS to all subsequent link commands. - dnl https://sourceware.org/bugzilla/show_bug.cgi?id=23600 - if AC_TRY_COMMAND(${CC-cc} -o conftest.${OBJ_SUFFIX} -c $MOZ_LTO_CFLAGS $CFLAGS $CPPFLAGS conftest.${ac_ext} 1>&5) && test -s conftest.${OBJ_SUFFIX}; then - echo "INPUT(conftest.${OBJ_SUFFIX})" > conftest.list + if AC_TRY_COMMAND(${CC-cc} -o conftest.${OBJ_SUFFIX} -c $CFLAGS $CPPFLAGS conftest.${ac_ext} 1>&5) && test -s conftest.${OBJ_SUFFIX}; then if test "$CC_TYPE" = "clang-cl"; then link="$LINKER -OUT:conftest${ac_exeext}" else link="${CC-cc} -o conftest${ac_exeext}" fi - if AC_TRY_COMMAND($link $MOZ_LTO_LDFLAGS $LDFLAGS conftest.list $LIBS 1>&5) && test -s conftest${ac_exeext}; then - moz_cv_expand_libs_list_style=linkerscript + echo "conftest.${OBJ_SUFFIX}" > conftest.list + if AC_TRY_COMMAND($link $LDFLAGS [-Wl,@conftest.list] $LIBS 1>&5) && test -s conftest${ac_exeext}; then + moz_cv_expand_libs_list_style=linkerlist + + dnl -filelist is for the OS X linker. We need to try -filelist first + dnl because clang understands @file, but may pass an oversized argument + dnl list to the linker depending on the contents of @file. + elif AC_TRY_COMMAND($link $LDFLAGS [-Wl,-filelist,conftest.list] $LIBS 1>&5) && test -s conftest${ac_exeext}; then + moz_cv_expand_libs_list_style=filelist + elif AC_TRY_COMMAND($link $LDFLAGS [@conftest.list] $LIBS 1>&5) && test -s conftest${ac_exeext}; then + moz_cv_expand_libs_list_style=list else - echo "conftest.${OBJ_SUFFIX}" > conftest.list - dnl -filelist is for the OS X linker. We need to try -filelist - dnl first because clang understands @file, but may pass an - dnl oversized argument list to the linker depending on the - dnl contents of @file. - if AC_TRY_COMMAND($link $MOZ_LTO_LDFLAGS $LDFLAGS [-Wl,-filelist,conftest.list] $LIBS 1>&5) && test -s conftest${ac_exeext}; then - moz_cv_expand_libs_list_style=filelist - elif AC_TRY_COMMAND($link $MOZ_LTO_LDFLAGS $LDFLAGS @conftest.list $LIBS 1>&5) && test -s conftest${ac_exeext}; then - moz_cv_expand_libs_list_style=list - else - AC_ERROR([Couldn't find one that works]) - fi + AC_ERROR([Couldn't find one that works]) fi else dnl We really don't expect to get here, but just in case diff --git a/build/build-clang/README b/build/build-clang/README index 5b13edeeb9..6badf9c59e 100644 --- a/build/build-clang/README +++ b/build/build-clang/README @@ -43,7 +43,7 @@ build-clang.py accepts a JSON config format with the following fields: * assertions: Whether to enable LLVM assertions. The default is false. * pgo: Whether to build with PGO (requires stages == 4). The default is false. -The revisions are defined in taskcluster/ci/fetch/toolchains.yml. They are usually commit sha1s corresponding to upstream tags. +The revisions are defined in taskcluster/kinds/fetch/toolchains.yml. They are usually commit sha1s corresponding to upstream tags. Environment Variables --------------------- diff --git a/build/build-clang/clang-17.json b/build/build-clang/clang-17.json index 3d855cbec8..7845af0dd8 100644 --- a/build/build-clang/clang-17.json +++ b/build/build-clang/clang-17.json @@ -9,6 +9,7 @@ "revert-llvmorg-16-init-11301-g163bb6d64e5f_clang_17.patch", "revert-llvmorg-15-init-13446-g7524fe962e47.patch", "llvmorg-18-init-8471-g160e8eb44961.patch", + "llvmorg-19-init-7654-gc23135c5488f.patch", "D146664.patch", "win64-ret-null-on-commitment-limit_clang_14.patch", "arm64e-hack.patch", diff --git a/build/build-clang/clang-18.json b/build/build-clang/clang-18.json index 8290f31048..72375ebd10 100644 --- a/build/build-clang/clang-18.json +++ b/build/build-clang/clang-18.json @@ -12,6 +12,7 @@ "partial-revert-llvmorg-16-init-17151-gaa0883b59ae1_clang_17.patch", "revert-llvmorg-16-init-11301-g163bb6d64e5f_clang_18.patch", "revert-llvmorg-15-init-13446-g7524fe962e47.patch", + "llvmorg-19-init-7654-gc23135c5488f.patch", "win64-ret-null-on-commitment-limit_clang_14.patch", "arm64e-hack.patch", "compiler-rt-rss-limit-heap-profile.patch" diff --git a/build/build-clang/llvm-symbolizer-17.json b/build/build-clang/llvm-symbolizer-17.json index 211c613d3d..b33b2081c5 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 357eab9792..1afe63ef95 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 8aa80eff8c..1afe63ef95 100644 --- a/build/build-clang/llvm-symbolizer-trunk.json +++ b/build/build-clang/llvm-symbolizer-trunk.json @@ -1,11 +1,5 @@ { "patches": [ - "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/llvmorg-19-init-7654-gc23135c5488f.patch b/build/build-clang/llvmorg-19-init-7654-gc23135c5488f.patch new file mode 100644 index 0000000000..9609de0bc0 --- /dev/null +++ b/build/build-clang/llvmorg-19-init-7654-gc23135c5488f.patch @@ -0,0 +1,155 @@ +From 7db340bcc57fb7f4fabbae34b30065fbd77b0174 Mon Sep 17 00:00:00 2001 +From: Leonard Grey <lgrey@chromium.org> +Date: Mon, 8 Apr 2024 16:05:52 -0400 +Subject: [PATCH] -fsanitize=function: fix .subsections_via_symbols (#87527) + +-fsanitize=function emits a signature and function hash before a +function. Similar to 7f6e2c9, these can be sheared off when +`.subsections_via_symbols` is used. + +This change uses the same technique 7f6e2c9 introduced for prefixes: +emitting a symbol for the metadata, then marking the actual function +entry as an .alt_entry symbol. +--- + llvm/include/llvm/CodeGen/AsmPrinter.h | 3 ++ + llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 43 ++++++++++++--------- + llvm/test/CodeGen/AArch64/func-sanitizer.ll | 9 +++++ + llvm/test/CodeGen/X86/func-sanitizer.ll | 10 +++++ + 4 files changed, 46 insertions(+), 19 deletions(-) + +diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h +index 0ac497c5f8ef..96e302859f44 100644 +--- a/llvm/include/llvm/CodeGen/AsmPrinter.h ++++ b/llvm/include/llvm/CodeGen/AsmPrinter.h +@@ -840,6 +840,9 @@ private: + /// This method emits a comment next to header for the current function. + virtual void emitFunctionHeaderComment(); + ++ /// This method emits prefix-like data before the current function. ++ void emitFunctionPrefix(ArrayRef<const Constant *> Prefix); ++ + /// Emit a blob of inline asm to the output streamer. + void + emitInlineAsm(StringRef Str, const MCSubtargetInfo &STI, +diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +index 5381dfdd184c..a1d4c72d2899 100644 +--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp ++++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +@@ -896,6 +896,27 @@ void AsmPrinter::emitDebugValue(const MCExpr *Value, unsigned Size) const { + + void AsmPrinter::emitFunctionHeaderComment() {} + ++void AsmPrinter::emitFunctionPrefix(ArrayRef<const Constant *> Prefix) { ++ const Function &F = MF->getFunction(); ++ if (!MAI->hasSubsectionsViaSymbols()) { ++ for (auto &C : Prefix) ++ emitGlobalConstant(F.getParent()->getDataLayout(), C); ++ return; ++ } ++ // Preserving prefix-like data on platforms which use subsections-via-symbols ++ // is a bit tricky. Here we introduce a symbol for the prefix-like data ++ // and use the .alt_entry attribute to mark the function's real entry point ++ // as an alternative entry point to the symbol that precedes the function.. ++ OutStreamer->emitLabel(OutContext.createLinkerPrivateTempSymbol()); ++ ++ for (auto &C : Prefix) { ++ emitGlobalConstant(F.getParent()->getDataLayout(), C); ++ } ++ ++ // Emit an .alt_entry directive for the actual function symbol. ++ OutStreamer->emitSymbolAttribute(CurrentFnSym, MCSA_AltEntry); ++} ++ + /// EmitFunctionHeader - This method emits the header for the current + /// function. + void AsmPrinter::emitFunctionHeader() { +@@ -935,23 +956,8 @@ void AsmPrinter::emitFunctionHeader() { + OutStreamer->emitSymbolAttribute(CurrentFnSym, MCSA_Cold); + + // Emit the prefix data. +- if (F.hasPrefixData()) { +- if (MAI->hasSubsectionsViaSymbols()) { +- // Preserving prefix data on platforms which use subsections-via-symbols +- // is a bit tricky. Here we introduce a symbol for the prefix data +- // and use the .alt_entry attribute to mark the function's real entry point +- // as an alternative entry point to the prefix-data symbol. +- MCSymbol *PrefixSym = OutContext.createLinkerPrivateTempSymbol(); +- OutStreamer->emitLabel(PrefixSym); +- +- emitGlobalConstant(F.getParent()->getDataLayout(), F.getPrefixData()); +- +- // Emit an .alt_entry directive for the actual function symbol. +- OutStreamer->emitSymbolAttribute(CurrentFnSym, MCSA_AltEntry); +- } else { +- emitGlobalConstant(F.getParent()->getDataLayout(), F.getPrefixData()); +- } +- } ++ if (F.hasPrefixData()) ++ emitFunctionPrefix({F.getPrefixData()}); + + // Emit KCFI type information before patchable-function-prefix nops. + emitKCFITypeId(*MF); +@@ -983,8 +989,7 @@ void AsmPrinter::emitFunctionHeader() { + + auto *PrologueSig = mdconst::extract<Constant>(MD->getOperand(0)); + auto *TypeHash = mdconst::extract<Constant>(MD->getOperand(1)); +- emitGlobalConstant(F.getParent()->getDataLayout(), PrologueSig); +- emitGlobalConstant(F.getParent()->getDataLayout(), TypeHash); ++ emitFunctionPrefix({PrologueSig, TypeHash}); + } + + if (isVerbose()) { +diff --git a/llvm/test/CodeGen/AArch64/func-sanitizer.ll b/llvm/test/CodeGen/AArch64/func-sanitizer.ll +index 89f23e7ed80e..de83d70a5784 100644 +--- a/llvm/test/CodeGen/AArch64/func-sanitizer.ll ++++ b/llvm/test/CodeGen/AArch64/func-sanitizer.ll +@@ -1,4 +1,5 @@ + ; RUN: llc -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s ++; RUN: llc -mtriple=arm64-apple-darwin < %s | FileCheck %s --check-prefix=MACHO + + ; CHECK-LABEL: .type _Z3funv,@function + ; CHECK-NEXT: .word 3238382334 // 0xc105cafe +@@ -7,6 +8,14 @@ + ; CHECK-NEXT: // %bb.0: + ; CHECK-NEXT: ret + ++; MACHO: ltmp0: ++; MACHO-NEXT: .long 3238382334 ; 0xc105cafe ++; MACHO-NEXT: .long 42 ; 0x2a ++; MACHO-NEXT: .alt_entry __Z3funv ++; MACHO-NEXT: __Z3funv: ++; MACHO-NEXT: ; %bb.0: ++; MACHO-NEXT: ret ++ + define dso_local void @_Z3funv() nounwind !func_sanitize !0 { + ret void + } +diff --git a/llvm/test/CodeGen/X86/func-sanitizer.ll b/llvm/test/CodeGen/X86/func-sanitizer.ll +index b421cb53ddfe..71f062ae2f8c 100644 +--- a/llvm/test/CodeGen/X86/func-sanitizer.ll ++++ b/llvm/test/CodeGen/X86/func-sanitizer.ll +@@ -1,4 +1,5 @@ + ; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s ++; RUN: llc -mtriple=x86_64-apple-darwin < %s | FileCheck %s --check-prefix=MACHO + + ; CHECK: .type _Z3funv,@function + ; CHECK-NEXT: .long 3238382334 # 0xc105cafe +@@ -8,6 +9,15 @@ + ; CHECK-NEXT: # %bb.0: + ; CHECK-NEXT: retq + ++; MACHO: ltmp0: ++; MACHO-NEXT: .long 3238382334 ## 0xc105cafe ++; MACHO-NEXT: .long 42 ## 0x2a ++; MACHO-NEXT: .alt_entry __Z3funv ++; MACHO-NEXT: __Z3funv: ++; MACHO-NEXT: .cfi_startproc ++; MACHO-NEXT: # %bb.0: ++; MACHO-NEXT: retq ++ + define dso_local void @_Z3funv() !func_sanitize !0 { + ret void + } +-- +2.44.0.1.g9765aa7075 + 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 0000000000..85621ab450 --- /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<DWARFUnit> &CU : compile_units()) { +- if (DWARFDie Die = CU->getVariableForAddress(Address)) { +- return static_cast<DWARFCompileUnit *>(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 0000000000..457120e78d --- /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<DWARFUnit> &CU : compile_units()) { +- if (CU->getVariableForAddress(Address)) { +- return static_cast<DWARFCompileUnit *>(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 96ac988380..0000000000 --- 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 93c7e7d767..0000000000 --- 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 <mh@glandium.org> -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<attribute_iterator> 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<uint64_t> 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 <cstdint> - #include <map> - #include <memory> --#include <set> - #include <utility> - #include <vector> - -@@ -242,11 +240,6 @@ class DWARFUnit { - /// std::map::upper_bound for address range lookup. - std::map<uint64_t, std::pair<uint64_t, DWARFDie>> AddrDieMap; - -- /// Map from the location (interpreted DW_AT_location) of a DW_TAG_variable, -- /// to the end address and the corresponding DIE. -- std::map<uint64_t, std::pair<uint64_t, DWARFDie>> VariableDieMap; -- DenseSet<uint64_t> RootsParsedForVariables; -- - using die_iterator_range = - iterator_range<std::vector<DWARFDebugInfoEntry>::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<DWARFUnit> &CU : compile_units()) { -- if (DWARFDie Die = CU->getVariableForAddress(Address)) { -- return static_cast<DWARFCompileUnit *>(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<uint64_t> getTypeSize(DWARFDie Type, uint64_t PointerSize) { -+ if (auto SizeAttr = Type.find(DW_AT_byte_size)) -+ if (std::optional<uint64_t> 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<uint64_t>(); -+ std::optional<uint64_t> BaseSize = getTypeSize(BaseType, PointerSize); -+ if (!BaseSize) -+ return std::optional<uint64_t>(); -+ 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<uint64_t> ElemCount = -+ ElemCountAttr->getAsUnsignedConstant()) -+ Size *= *ElemCount; -+ if (auto UpperBoundAttr = Child.find(DW_AT_upper_bound)) -+ if (std::optional<int64_t> 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<uint64_t>(); -+} -+ - static std::optional<int64_t> - getExpressionFrameOffset(ArrayRef<uint8_t> Expr, - std::optional<unsigned> FrameBaseReg) { -@@ -1201,7 +1241,7 @@ void DWARFContext::addLocalsForDie(DWARFCompileUnit *CU, DWARFDie Subprogram, - if (std::optional<const char *> 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<uint64_t> DWARFDie::getTypeSize(uint64_t PointerSize) { -- if (auto SizeAttr = find(DW_AT_byte_size)) -- if (std::optional<uint64_t> 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<uint64_t> 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<uint64_t> ElemCount = -- ElemCountAttr->getAsUnsignedConstant()) -- Size *= *ElemCount; -- if (auto UpperBoundAttr = Child.find(DW_AT_upper_bound)) -- if (std::optional<int64_t> 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<DWARFLocationExpressionsVector> 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<uint64_t> 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<DWARFDie> &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 908374789c..0000000000 --- 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 <mh@glandium.org> -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<attribute_iterator> 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<uint64_t> 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 <cstdint> - #include <map> - #include <memory> --#include <set> - #include <utility> - #include <vector> - -@@ -242,11 +240,6 @@ class DWARFUnit { - /// std::map::upper_bound for address range lookup. - std::map<uint64_t, std::pair<uint64_t, DWARFDie>> AddrDieMap; - -- /// Map from the location (interpreted DW_AT_location) of a DW_TAG_variable, -- /// to the end address and the corresponding DIE. -- std::map<uint64_t, std::pair<uint64_t, DWARFDie>> VariableDieMap; -- DenseSet<uint64_t> RootsParsedForVariables; -- - using die_iterator_range = - iterator_range<std::vector<DWARFDebugInfoEntry>::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<DWARFUnit> &CU : compile_units()) { -- if (CU->getVariableForAddress(Address)) { -- return static_cast<DWARFCompileUnit *>(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<uint64_t> getTypeSize(DWARFDie Type, uint64_t PointerSize) { -+ if (auto SizeAttr = Type.find(DW_AT_byte_size)) -+ if (std::optional<uint64_t> 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<uint64_t>(); -+ std::optional<uint64_t> BaseSize = getTypeSize(BaseType, PointerSize); -+ if (!BaseSize) -+ return std::optional<uint64_t>(); -+ 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<uint64_t> ElemCount = -+ ElemCountAttr->getAsUnsignedConstant()) -+ Size *= *ElemCount; -+ if (auto UpperBoundAttr = Child.find(DW_AT_upper_bound)) -+ if (std::optional<int64_t> 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<uint64_t>(); -+} -+ - static std::optional<int64_t> - getExpressionFrameOffset(ArrayRef<uint8_t> Expr, - std::optional<unsigned> FrameBaseReg) { -@@ -1201,7 +1241,7 @@ void DWARFContext::addLocalsForDie(DWARFCompileUnit *CU, DWARFDie Subprogram, - if (std::optional<const char *> 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<uint64_t> DWARFDie::getTypeSize(uint64_t PointerSize) { -- SmallPtrSet<const DWARFDebugInfoEntry *, 4> 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<DWARFLocationExpressionsVector> 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<uint64_t> 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<DWARFDie> &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-16-init-11301-g163bb6d64e5f_clang_19.patch b/build/build-clang/revert-llvmorg-16-init-11301-g163bb6d64e5f_clang_19.patch index a296eb9153..97a589354f 100644 --- a/build/build-clang/revert-llvmorg-16-init-11301-g163bb6d64e5f_clang_19.patch +++ b/build/build-clang/revert-llvmorg-16-init-11301-g163bb6d64e5f_clang_19.patch @@ -75,7 +75,7 @@ index 2e489757ebc1..810a9f92bb7a 100644 + MadeChange |= widenSubvectorLoad(I); MadeChange |= foldShuffleOfBinops(I); MadeChange |= foldShuffleOfCastops(I); - MadeChange |= foldSelectShuffle(I); + MadeChange |= foldShuffleOfShuffles(I); diff --git a/llvm/test/Other/new-pm-defaults.ll b/llvm/test/Other/new-pm-defaults.ll index 13612c3bb459..5f84d28af4a6 100644 --- a/llvm/test/Other/new-pm-defaults.ll 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 63e59ee68b..0000000000 --- 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 <mh@glandium.org> -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<DILocal> - DWARFContext::getLocalsForAddress(object::SectionedAddress Address) { - std::vector<DILocal> 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 098c410790..0000000000 --- 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 <mh@glandium.org> -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<DILocal> - DWARFContext::getLocalsForAddress(object::SectionedAddress Address) { - std::vector<DILocal> 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 a54bb501a1..0000000000 --- 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 <mh@glandium.org> -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<void()> Report, RecordLoc *Loc = nullptr); -+ void emitDiag(llvm::function_ref<void()> 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<SymbolSet>()), -- Ctx(VerifierContext{Diag}) {} -+ Exports(std::make_unique<SymbolSet>()), 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<SymbolSet> Exports = std::make_unique<SymbolSet>(); - - // 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<void()> Report, -- RecordLoc *Loc) { -+void DylibVerifier::VerifierContext::emitDiag( -+ llvm::function_ref<void()> 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<RecordsSlice> 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<"<path>">, 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<const char *> 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<DylibVerifier>( -- 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<Records> readFile(MemoryBufferRef Buffer, const ParseOption &Opt); - /// \param Buffer Data that points to dylib. - Expected<std::unique_ptr<InterfaceFile>> get(MemoryBufferRef Buffer); - --using SymbolToSourceLocMap = llvm::StringMap<RecordLoc>; --/// 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<DWARFContext> &DiCtx) { -- SymbolToSourceLocMap LocMap; -- for (const auto &Symbol : Obj.symbols()) { -- Expected<uint32_t> FlagsOrErr = Symbol.getFlags(); -- if (!FlagsOrErr) { -- consumeError(FlagsOrErr.takeError()); -- continue; -- } -- -- if (!(*FlagsOrErr & SymbolRef::SF_Exported)) -- continue; -- -- Expected<uint64_t> 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<MachOObjectFile>(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<MachOUniversalBinary>(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 f6a566c199..0000000000 --- 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 <mh@glandium.org> -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 28a27dc7cc..0000000000 --- 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 <mh@glandium.org> -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 eac26c075c..0000000000 --- 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 <mh@glandium.org> -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/clang-plugin/Utils.h b/build/clang-plugin/Utils.h index c25caf43ee..d252eeda15 100644 --- a/build/clang-plugin/Utils.h +++ b/build/clang-plugin/Utils.h @@ -169,7 +169,11 @@ inline bool isInIgnoredNamespaceForImplicitCtor(const Decl *Declaration) { Name == "boost" || // boost Name == "webrtc" || // upstream webrtc Name == "rtc" || // upstream webrtc 'base' package +#if CLANG_VERSION_MAJOR >= 16 + Name.starts_with("icu_") || // icu +#else Name.startswith("icu_") || // icu +#endif Name == "google" || // protobuf Name == "google_breakpad" || // breakpad Name == "soundtouch" || // libsoundtouch diff --git a/build/clang-plugin/mozsearch-plugin/BindingOperations.cpp b/build/clang-plugin/mozsearch-plugin/BindingOperations.cpp index 79f7f3aebf..cc277f1f2f 100644 --- a/build/clang-plugin/mozsearch-plugin/BindingOperations.cpp +++ b/build/clang-plugin/mozsearch-plugin/BindingOperations.cpp @@ -8,6 +8,7 @@ #include <clang/AST/Attr.h> #include <clang/AST/Expr.h> #include <clang/AST/RecursiveASTVisitor.h> +#include <clang/Basic/Version.h> #include <algorithm> #include <array> @@ -173,10 +174,15 @@ constexpr StringRef BoundAs::ANNOTATION; template<typename B> void setBindingAttr(ASTContext &C, Decl &decl, B binding) { +#if CLANG_VERSION_MAJOR >= 18 + auto utf8 = StringLiteralKind::UTF8; +#else + auto utf8 = StringLiteral::UTF8; +#endif // recent LLVM: CreateImplicit then setDelayedArgs - Expr *langExpr = StringLiteral::Create(C, AbstractBinding::stringFromLang(binding.lang), StringLiteral::UTF8, false, {}, {}); - Expr *kindExpr = StringLiteral::Create(C, AbstractBinding::stringFromKind(binding.kind), StringLiteral::UTF8, false, {}, {}); - Expr *symbolExpr = StringLiteral::Create(C, binding.symbol, StringLiteral::UTF8, false, {}, {}); + Expr *langExpr = StringLiteral::Create(C, AbstractBinding::stringFromLang(binding.lang), utf8, false, {}, {}); + Expr *kindExpr = StringLiteral::Create(C, AbstractBinding::stringFromKind(binding.kind), utf8, false, {}, {}); + Expr *symbolExpr = StringLiteral::Create(C, binding.symbol, utf8, false, {}, {}); auto **args = new (C, 16) Expr *[3]{langExpr, kindExpr, symbolExpr}; auto *attr = AnnotateAttr::CreateImplicit(C, B::ANNOTATION, args, 3); decl.addAttr(attr); diff --git a/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp b/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp index f6958384a8..5e09e093d0 100644 --- a/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp +++ b/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp @@ -138,6 +138,14 @@ struct RAIITracer { class IndexConsumer; +bool isPure(FunctionDecl* D) { +#if CLANG_VERSION_MAJOR >= 18 + return D->isPureVirtual(); +#else + return D->isPure(); +#endif +} + // For each C++ file seen by the analysis (.cpp or .h), we track a // FileInfo. This object tracks whether the file is "interesting" (i.e., whether // it's in the source dir or the objdir). We also store the analysis output @@ -191,7 +199,12 @@ public: #endif StringRef SearchPath, StringRef RelativePath, +#if CLANG_VERSION_MAJOR >= 19 + const Module *SuggestedModule, + bool ModuleImported, +#else const Module *Imported, +#endif SrcMgr::CharacteristicKind FileType) override; virtual void MacroDefined(const Token &Tok, @@ -1749,7 +1762,7 @@ public: D = D2->getTemplateInstantiationPattern(); } // We treat pure virtual declarations as definitions. - Kind = (D2->isThisDeclarationADefinition() || D2->isPure()) ? "def" : "decl"; + Kind = (D2->isThisDeclarationADefinition() || isPure(D2)) ? "def" : "decl"; PrettyKind = "function"; PeekRange = getFunctionPeekRange(D2); @@ -1881,7 +1894,7 @@ public: } } if (FunctionDecl *D2 = dyn_cast<FunctionDecl>(D)) { - if ((D2->isThisDeclarationADefinition() || D2->isPure()) && + if ((D2->isThisDeclarationADefinition() || isPure(D2)) && // a clause at the top should have generalized and set wasTemplate so // it shouldn't be the case that isTemplateInstantiation() is true. !D2->isTemplateInstantiation() && @@ -2335,7 +2348,12 @@ void PreprocessorHook::InclusionDirective(SourceLocation HashLoc, #endif StringRef SearchPath, StringRef RelativePath, +#if CLANG_VERSION_MAJOR >= 19 + const Module *SuggestedModule, + bool ModuleImported, +#else const Module *Imported, +#endif SrcMgr::CharacteristicKind FileType) { #if CLANG_VERSION_MAJOR >= 15 if (!File) { diff --git a/build/defines.sh b/build/defines.sh index d6524ae631..cf98c3d8bf 100644 --- a/build/defines.sh +++ b/build/defines.sh @@ -1,3 +1,3 @@ # Define indicating that this build is prior to one of the early betas. To be # unset mid-way through the beta cycle. -EARLY_BETA_OR_EARLIER=
\ No newline at end of file +EARLY_BETA_OR_EARLIER= diff --git a/build/docs/sccache-dist.rst b/build/docs/sccache-dist.rst index edd9ead909..594c19f5fd 100644 --- a/build/docs/sccache-dist.rst +++ b/build/docs/sccache-dist.rst @@ -68,7 +68,7 @@ must read:: will contain the version of ``rustc`` used by automation builds, which may lag behind stable for a few days after Rust releases, which is specified by the task definition in - `this file <https://hg.mozilla.org/mozilla-central/file/tip/taskcluster/ci/toolchain/dist-toolchains.yml>`_. + `this file <https://hg.mozilla.org/mozilla-central/file/tip/taskcluster/kinds/toolchain/dist-toolchains.yml>`_. For instance, to specify 1.37.0 rather than the current stable, run ``rustup toolchain add 1.37.0`` and point to ``/path/to/home/.rustup/toolchains/1.37.0-x86_64-apple-darwin/bin/rustc`` in your diff --git a/build/docs/toolchains.rst b/build/docs/toolchains.rst index f43972b8f3..c7b8fcd333 100644 --- a/build/docs/toolchains.rst +++ b/build/docs/toolchains.rst @@ -209,7 +209,7 @@ its content and ensure that's what you're looking for. (...) Once you have found the SDK you want, you can create or update toolchain tasks -in ``taskcluster/ci/toolchain/macosx-sdk.yml``. +in ``taskcluster/kinds/toolchain/macosx-sdk.yml``. The ``taskcluster/scripts/misc/unpack-sdk.py`` script takes the url of a SDK package, the sha512 hash for its content, the path to the SDK in the package, diff --git a/build/mach_initialize.py b/build/mach_initialize.py index c0a4e515a8..ccd79d9a99 100644 --- a/build/mach_initialize.py +++ b/build/mach_initialize.py @@ -6,19 +6,9 @@ import math import os import shutil import sys +from importlib.abc import MetaPathFinder from pathlib import Path -if sys.version_info[0] < 3: - import __builtin__ as builtins - - class MetaPathFinder(object): - pass - -else: - from importlib.abc import MetaPathFinder - -from types import ModuleType - STATE_DIR_FIRST_RUN = """ Mach and the build system store shared state in a common directory on the filesystem. The following directory will be created: @@ -490,76 +480,6 @@ def _create_state_dir(): # and caveats. # Objdirs outside the source directory are ignored because in most cases, if # a .pyc/.pyo file exists there, a .py file will be next to it anyways. -class ImportHook(object): - def __init__(self, original_import): - self._original_import = original_import - # Assume the source directory is the parent directory of the one - # containing this file. - self._source_dir = ( - os.path.normcase( - os.path.abspath(os.path.dirname(os.path.dirname(__file__))) - ) - + os.sep - ) - self._modules = set() - - def __call__(self, name, globals=None, locals=None, fromlist=None, level=-1): - if sys.version_info[0] >= 3 and level < 0: - level = 0 - - # name might be a relative import. Instead of figuring out what that - # resolves to, which is complex, just rely on the real import. - # Since we don't know the full module name, we can't check sys.modules, - # so we need to keep track of which modules we've already seen to avoid - # to stat() them again when they are imported multiple times. - module = self._original_import(name, globals, locals, fromlist, level) - - # Some tests replace modules in sys.modules with non-module instances. - if not isinstance(module, ModuleType): - return module - - resolved_name = module.__name__ - if resolved_name in self._modules: - return module - self._modules.add(resolved_name) - - # Builtin modules don't have a __file__ attribute. - if not getattr(module, "__file__", None): - return module - - # Note: module.__file__ is not always absolute. - path = os.path.normcase(os.path.abspath(module.__file__)) - # Note: we could avoid normcase and abspath above for non pyc/pyo - # files, but those are actually rare, so it doesn't really matter. - if not path.endswith((".pyc", ".pyo")): - return module - - # Ignore modules outside our source directory - if not path.startswith(self._source_dir): - return module - - # If there is no .py corresponding to the .pyc/.pyo module we're - # loading, remove the .pyc/.pyo file, and reload the module. - # Since we already loaded the .pyc/.pyo module, if it had side - # effects, they will have happened already, and loading the module - # with the same name, from another directory may have the same side - # effects (or different ones). We assume it's not a problem for the - # python modules under our source directory (either because it - # doesn't happen or because it doesn't matter). - if not os.path.exists(module.__file__[:-1]): - if os.path.exists(module.__file__): - os.remove(module.__file__) - del sys.modules[module.__name__] - module = self(name, globals, locals, fromlist, level) - - return module - - -# Hook import such that .pyc/.pyo files without a corresponding .py file in -# the source directory are essentially ignored. See further below for details -# and caveats. -# Objdirs outside the source directory are ignored because in most cases, if -# a .pyc/.pyo file exists there, a .py file will be next to it anyways. class FinderHook(MetaPathFinder): def __init__(self, klass): # Assume the source directory is the parent directory of the one @@ -616,8 +536,4 @@ def hook(finder): return finder -# Install our hook. This can be deleted when the Python 3 migration is complete. -if sys.version_info[0] < 3: - builtins.__import__ = ImportHook(builtins.__import__) -else: - sys.meta_path = [hook(c) for c in sys.meta_path] +sys.meta_path = [hook(c) for c in sys.meta_path] diff --git a/build/moz-automation.mk b/build/moz-automation.mk index 5e165228ed..cff0a81865 100644 --- a/build/moz-automation.mk +++ b/build/moz-automation.mk @@ -29,9 +29,7 @@ MOZ_AUTOMATION_CHECK := 0 endif ifneq (,$(filter automation/%,$(MAKECMDGOALS))) -ifeq (4.0,$(firstword $(sort 4.0 $(MAKE_VERSION)))) -MAKEFLAGS += --output-sync=target -else +ifneq (4.0,$(firstword $(sort 4.0 $(MAKE_VERSION)))) .NOTPARALLEL: endif endif @@ -75,15 +73,15 @@ endif MOZ_AUTOMATION_TIERS := $(foreach sym,$(moz_automation_symbols),$(if $(filter 1,$($(sym))),$(tier_$(sym)))) # Dependencies between automation build steps -automation-start/uploadsymbols: automation/buildsymbols +automation/uploadsymbols: automation/buildsymbols -automation-start/upload: automation/package -automation-start/upload: automation/package-tests -automation-start/upload: automation/buildsymbols -automation-start/upload: automation/package-generated-sources +automation/upload: automation/package +automation/upload: automation/package-tests +automation/upload: automation/buildsymbols +automation/upload: automation/package-generated-sources # Run the check tier after everything else. -automation-start/check: $(addprefix automation/,$(filter-out check,$(MOZ_AUTOMATION_TIERS))) +automation/check: $(addprefix automation/,$(filter-out check,$(MOZ_AUTOMATION_TIERS))) automation/build: $(addprefix automation/,$(MOZ_AUTOMATION_TIERS)) @echo Automation steps completed. @@ -98,13 +96,9 @@ AUTOMATION_EXTRA_CMDLINE-check = --keep-going # case because it is a prerequisite of automation/upload. define automation_commands @+$(PYTHON3) $(topsrcdir)/config/run-and-prefix.py $1 $(MAKE) $1 $(AUTOMATION_EXTRA_CMDLINE-$1) -$(call BUILDSTATUS,TIER_FINISH $1) endef -# The tier start message is in a separate target so make doesn't buffer it -# until the step completes with output syncing enabled. -automation-start/%: - $(if $(filter $*,$(MOZ_AUTOMATION_TIERS)),$(call BUILDSTATUS,TIER_START $*)) - -automation/%: automation-start/% +automation/%: + $(if $(filter $*,$(filter-out $(ALL_TIERS),$(MOZ_AUTOMATION_TIERS))),$(call BUILDSTATUS,TIER_START $*)) $(if $(filter $*,$(MOZ_AUTOMATION_TIERS)),$(call automation_commands,$*)) + $(if $(filter $*,$(filter-out $(ALL_TIERS),$(MOZ_AUTOMATION_TIERS))),$(call BUILDSTATUS,TIER_FINISH $*)) diff --git a/build/moz.configure/bootstrap.configure b/build/moz.configure/bootstrap.configure index d8deddbb9e..6e8e59812f 100644 --- a/build/moz.configure/bootstrap.configure +++ b/build/moz.configure/bootstrap.configure @@ -132,7 +132,7 @@ def bootstrap_path(path, **kwargs): @imports("os") @imports("subprocess") @imports("sys") - @imports(_from="mozbuild.util", _import="ensureParentDir") + @imports(_from="mozbuild.dirutils", _import="ensureParentDir") @imports(_from="importlib", _import="import_module") @imports(_from="shutil", _import="rmtree") @imports(_from="__builtin__", _import="open") diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure index bfb878aebb..5ff6851e86 100644 --- a/build/moz.configure/init.configure +++ b/build/moz.configure/init.configure @@ -1271,6 +1271,19 @@ def enabled_in_nightly(milestone): return milestone.is_nightly +# Check if we need the 32-bit Linux SSE2 error dialog +# =================================================== +option( + env="MOZ_LINUX_32_SSE2_STARTUP_ERROR", + help="Add code to perform startup checks to warn if SSE2 is not available", + default=depends("MOZ_AUTOMATION")(lambda x: bool(x)), + when=target_is_unix & depends(target)(lambda target: target.cpu == "x86"), +) +set_config( + "MOZ_LINUX_32_SSE2_STARTUP_ERROR", True, when="MOZ_LINUX_32_SSE2_STARTUP_ERROR" +) + + # Branding # ============================================================== option( diff --git a/build/moz.configure/nss.configure b/build/moz.configure/nss.configure index 2765a6502d..33ff47b3b1 100644 --- a/build/moz.configure/nss.configure +++ b/build/moz.configure/nss.configure @@ -9,7 +9,7 @@ system_lib_option("--with-system-nss", help="Use system NSS") imply_option("--with-system-nspr", True, when="--with-system-nss") nss_pkg = pkg_check_modules( - "NSS", "nss >= 3.99", when="--with-system-nss", config=False + "NSS", "nss >= 3.100", when="--with-system-nss", config=False ) set_config("MOZ_SYSTEM_NSS", True, when="--with-system-nss") diff --git a/build/rust/backtrace/lib.rs b/build/rust/backtrace/lib.rs index e69de29bb2..e0032240a4 100644 --- a/build/rust/backtrace/lib.rs +++ b/build/rust/backtrace/lib.rs @@ -0,0 +1,3 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/build/rust/dist-bin/Cargo.toml b/build/rust/dist-bin/Cargo.toml new file mode 100644 index 0000000000..2bdf076905 --- /dev/null +++ b/build/rust/dist-bin/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "dist-bin" +version = "0.1.0" +edition = "2021" +license = "MPL-2.0" + +[lib] +path = "lib.rs" + +[build-dependencies] +mozbuild = "0.1" diff --git a/build/rust/dist-bin/build.rs b/build/rust/dist-bin/build.rs new file mode 100644 index 0000000000..5905ee23d4 --- /dev/null +++ b/build/rust/dist-bin/build.rs @@ -0,0 +1,16 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +fn main() { + // Hack around the lack of dist/bin in the search path set up by + // various third party crates for nss. Bug 1892894. + println!( + "cargo:rustc-link-search=native={}", + mozbuild::TOPOBJDIR + .join("dist") + .join("bin") + .to_str() + .unwrap() + ); +} diff --git a/build/rust/dist-bin/lib.rs b/build/rust/dist-bin/lib.rs new file mode 100644 index 0000000000..e0032240a4 --- /dev/null +++ b/build/rust/dist-bin/lib.rs @@ -0,0 +1,3 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/build/rust/hashbrown/Cargo.toml b/build/rust/hashbrown/Cargo.toml new file mode 100644 index 0000000000..be365ea103 --- /dev/null +++ b/build/rust/hashbrown/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "hashbrown" +version = "0.13.999" +edition = "2021" + +[lib] +path = "lib.rs" + +[features] +# N.B., not using `hashbrown/default` because it includes `hashbrown/allocator-api2`, which we want +# to avoid. +default = ["ahash", "inline-more"] +ahash = ["hashbrown/ahash"] +inline-more = ["hashbrown/inline-more"] +raw = ["hashbrown/raw"] + +[dependencies.hashbrown] +version = "0.14.3" +default-features = false diff --git a/build/rust/hashbrown/lib.rs b/build/rust/hashbrown/lib.rs new file mode 100644 index 0000000000..48ed12a3ba --- /dev/null +++ b/build/rust/hashbrown/lib.rs @@ -0,0 +1,4 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +pub use hashbrown::*; diff --git a/build/rust/indexmap/Cargo.toml b/build/rust/indexmap/Cargo.toml index de45a4f02d..ea85a5826e 100644 --- a/build/rust/indexmap/Cargo.toml +++ b/build/rust/indexmap/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "indexmap" -version = "2.999.999" +version = "1.999.999" edition = "2021" license = "MPL-2.0" @@ -9,8 +9,9 @@ path = "lib.rs" [features] default = ["std"] -serde = ["indexmap/serde-1"] +serde = ["indexmap/serde"] +serde-1 = ["indexmap/serde"] std = ["indexmap/std"] [dependencies.indexmap] -version = "1.9.3" +version = "2.2.6" diff --git a/build/rust/libloading/Cargo.toml b/build/rust/libloading/Cargo.toml new file mode 100644 index 0000000000..18385bc7ac --- /dev/null +++ b/build/rust/libloading/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "libloading" +version = "0.7.999" +edition = "2021" + +[lib] +path = "lib.rs" + +[dependencies.libloading] +version = "0.8.3" diff --git a/build/rust/libloading/lib.rs b/build/rust/libloading/lib.rs new file mode 100644 index 0000000000..790eef042c --- /dev/null +++ b/build/rust/libloading/lib.rs @@ -0,0 +1,4 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +pub use libloading::*; diff --git a/build/rust/nix/Cargo.toml b/build/rust/nix/Cargo.toml index 4ecba71164..b8a704d1a7 100644 --- a/build/rust/nix/Cargo.toml +++ b/build/rust/nix/Cargo.toml @@ -8,7 +8,7 @@ license = "MPL-2.0" path = "lib.rs" [dependencies.nix] -version = "0.27" +version = "0.28" default-features = false [features] diff --git a/build/rust/scroll/Cargo.toml b/build/rust/scroll/Cargo.toml deleted file mode 100644 index dea2c21fd1..0000000000 --- a/build/rust/scroll/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "scroll" -version = "0.11.999" -edition = "2018" -license = "MIT/Apache-2.0" - -[lib] -path = "lib.rs" - -[dependencies.scroll] -version = "0.12.0" -default-features = false - -[features] -default = ["scroll/default"] -derive = ["scroll/derive"] -std = ["scroll/std"] diff --git a/build/rust/scroll/lib.rs b/build/rust/scroll/lib.rs deleted file mode 100644 index f7d352d6d2..0000000000 --- a/build/rust/scroll/lib.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub use scroll::*; diff --git a/build/sparse-profiles/github-sync b/build/sparse-profiles/github-sync deleted file mode 100644 index 72f265b3a1..0000000000 --- a/build/sparse-profiles/github-sync +++ /dev/null @@ -1,7 +0,0 @@ -%include build/sparse-profiles/mach -%include build/sparse-profiles/taskgraph - -[include] -path:gfx/wr/ -path:taskcluster/scripts/misc/ -path:tools/github-sync/ diff --git a/build/sparse-profiles/sphinx-docs b/build/sparse-profiles/sphinx-docs index 491d18b080..081904bee5 100644 --- a/build/sparse-profiles/sphinx-docs +++ b/build/sparse-profiles/sphinx-docs @@ -36,7 +36,7 @@ glob:testing/perfdocs/generated/** # Python API docs. glob:**/*.py # Referenced by some python files. -path:taskcluster/ci/docker-image/kind.yml +path:taskcluster/kinds/docker-image/kind.yml # Included in ipc docs path:ipc/ipdl/test/ipdl/ok/PMyManaged.ipdl diff --git a/build/unix/elfhack/relrhack.cpp b/build/unix/elfhack/relrhack.cpp index 2d78d783c9..c55103ea70 100644 --- a/build/unix/elfhack/relrhack.cpp +++ b/build/unix/elfhack/relrhack.cpp @@ -12,6 +12,7 @@ #include "relrhack.h" #include <algorithm> +#include <cstdio> #include <cstring> #include <filesystem> #include <fstream> @@ -26,6 +27,8 @@ #include <utility> #include <vector> +#include "mozilla/ScopeExit.h" + namespace fs = std::filesystem; class CantSwapSections : public std::runtime_error { @@ -420,10 +423,40 @@ uint16_t get_elf_machine(std::istream& in) { return ehdr.e_machine; } -int run_command(std::vector<const char*>& args) { +int run_command(std::vector<const char*>& args, bool use_response_file) { + std::string at_file; + const char** argv = args.data(); + std::array<const char*, 3> args_with_atfile{}; + if (use_response_file) { + const char* tmpdir = getenv("TMPDIR"); + if (!tmpdir) { + tmpdir = "/tmp"; + } + std::string tmpfile = tmpdir; + tmpfile += "/relrhackXXXXXX"; + int fd = mkstemp(tmpfile.data()); + if (fd < 0) { + std::cerr << "Failed to create temporary file." << std::endl; + return 1; + } + close(fd); + std::ofstream f{tmpfile, f.binary}; + for (auto arg = std::next(args.begin()); arg != args.end(); ++arg) { + f << *arg << "\n"; + } + at_file = "@"; + at_file += tmpfile; + args_with_atfile = {args.front(), at_file.c_str(), nullptr}; + argv = args_with_atfile.data(); + } + auto guard = mozilla::MakeScopeExit([&] { + if (!at_file.empty()) { + unlink(at_file.c_str() + 1); + } + }); pid_t child_pid; if (posix_spawn(&child_pid, args[0], nullptr, nullptr, - const_cast<char* const*>(args.data()), environ) != 0) { + const_cast<char* const*>(argv), environ) != 0) { throw std::runtime_error("posix_spawn failed"); } @@ -442,6 +475,9 @@ int main(int argc, char* argv[]) { std::optional<fs::path> real_linker = std::nullopt; bool shared = false; bool is_android = false; + bool use_response_file = false; + std::vector<char> response_file; + std::vector<const char*> response_file_args; uint16_t elf_machine = EM_NONE; // Scan argv in order to prepare the following: // - get the output file. That's the file we may need to adjust. @@ -458,6 +494,33 @@ int main(int argc, char* argv[]) { // // At the same time, we also construct a new list of arguments, with // --real-linker filtered out. We'll later inject arguments in that list. + if (argc == 2 && argv[1] && argv[1][0] == '@') { + // When GCC is given a response file, it wraps all arguments into a + // new response file with all arguments, even if originally there were + // arguments and a response file. + // In that case, we can't scan for arguments, so we need to read the + // response file. And as we change the arguments, we'll need to write + // a new one. + std::ifstream f{argv[1] + 1, f.binary | f.ate}; + if (!f) { + std::cerr << "Failed to read " << argv[1] + 1 << std::endl; + return 1; + } + size_t len = f.tellg(); + response_file = read_vector_at<char>(f, 0, len); + std::replace(response_file.begin(), response_file.end(), '\n', '\0'); + if (len && response_file[len - 1] != '\0') { + response_file.push_back('\0'); + } + response_file_args.push_back(argv[0]); + for (const char* a = response_file.data(); + a < response_file.data() + response_file.size(); a += strlen(a) + 1) { + response_file_args.push_back(a); + } + argv = const_cast<char**>(response_file_args.data()); + argc = response_file_args.size(); + use_response_file = true; + } for (i = 1, argv++; i < argc && *argv; argv++, i++) { std::string_view arg{*argv}; if (arg == "-shared") { @@ -538,7 +601,7 @@ int main(int argc, char* argv[]) { hacked_args.insert(hacked_args.begin() + crti + 1, inject.c_str()); hacked_args.insert(hacked_args.end() - 1, {"-z", "pack-relative-relocs", "-init=_relrhack_wrap_init"}); - int status = run_command(hacked_args); + int status = run_command(hacked_args, use_response_file); if (status) { return status; } @@ -563,5 +626,5 @@ int main(int argc, char* argv[]) { } } - return run_command(args); + return run_command(args, use_response_file); } diff --git a/build/unix/mozconfig.linux32 b/build/unix/mozconfig.linux32 index 8da778465d..e43aa13ad9 100644 --- a/build/unix/mozconfig.linux32 +++ b/build/unix/mozconfig.linux32 @@ -1,7 +1,5 @@ . "$topsrcdir/build/unix/mozconfig.linux" -export MOZ_LINUX_32_SSE2_STARTUP_ERROR=1 - CFLAGS="$CFLAGS -march=pentium-m -msse -msse2 -mfpmath=sse" CXXFLAGS="$CXXFLAGS -march=pentium-m -msse -msse2 -mfpmath=sse" diff --git a/build/valgrind/cross-architecture.sup b/build/valgrind/cross-architecture.sup index 49efa69151..9dc40034c5 100644 --- a/build/valgrind/cross-architecture.sup +++ b/build/valgrind/cross-architecture.sup @@ -164,10 +164,10 @@ ... } { - We intentionally leak TLS data in the global servo thread-pool until we can free it consistently (https://github.com/rayon-rs/rayon/issues/688) + We intentionally leak bloom filter TLS data in the global servo thread-pool until we can free it consistently (https://github.com/rayon-rs/rayon/issues/688) Memcheck:Leak match-leak-kinds: definite - fun:malloc + fun:calloc ... fun:_ZN3std*thread*local*fast*12Key$LT$T$GT$14try_initialize* ... @@ -175,7 +175,7 @@ ... } { - We intentionally leak TLS data in the global servo thread-pool until we can free it consistently (https://github.com/rayon-rs/rayon/issues/688) + We intentionally leak sharing cache TLS data in the global servo thread-pool until we can free it consistently (https://github.com/rayon-rs/rayon/issues/688) Memcheck:Leak match-leak-kinds: definite fun:malloc diff --git a/build/valgrind/mach_commands.py b/build/valgrind/mach_commands.py index e48d5af311..d7180d6465 100644 --- a/build/valgrind/mach_commands.py +++ b/build/valgrind/mach_commands.py @@ -158,7 +158,7 @@ def valgrind_test(command_context, suppressions): valgrind_args.append("--suppressions=" + supps_file2) exitcode = None - timeout = 2400 + timeout = 3600 binary_not_found_exception = None try: runner = FirefoxRunner( diff --git a/build/workspace-hack/Cargo.toml b/build/workspace-hack/Cargo.toml index acb3b365f2..ece5f9888e 100644 --- a/build/workspace-hack/Cargo.toml +++ b/build/workspace-hack/Cargo.toml @@ -20,6 +20,7 @@ arrayvec = { version = "0.7", features = ["serde"], optional = true } bitflags = { version = "2", features = ["serde", "std"], optional = true } bytes = { version = "1", optional = true } chrono = { version = "0.4", features = ["serde"], optional = true } +dist-bin = { path = "../rust/dist-bin", optional = true } env_logger = { version = "0.10", default-features = false, features = ["color"], optional = true } flate2 = { version = "1", optional = true } futures-channel = { version = "0.3", features = ["sink"], optional = true } @@ -27,7 +28,7 @@ futures-sink = { version = "0.3", optional = true } futures-core = { version = "0.3", optional = true } futures-util = { version = "0.3", features = ["channel", "io", "sink"], optional = true } getrandom = { version = "0.2", default-features = false, features = ["std"], optional = true } -hashbrown = { version = "0.12", optional = true } +hashbrown = { version = "0.13", optional = true } hyper = { version = "0.14", features = ["full"], optional = true } indexmap = { version = "1", default-features = false, features = ["serde-1", "std"], optional = true } libc = { version = "0.2", features = ["extra_traits"] } @@ -190,7 +191,7 @@ crashreporter = ["dep:env_logger", "dep:hyper", "dep:log", "dep:serde_json", "de geckodriver = ["dep:bitflags", "dep:bytes", "dep:cc", "dep:chrono", "dep:flate2", "dep:futures-channel", "dep:futures-core", "dep:futures-sink", "dep:futures-util", "dep:getrandom", "dep:hashbrown", "dep:hyper", "dep:indexmap", "dep:log", "dep:memchr", "dep:mio", "dep:num-integer", "dep:num-traits", "dep:once_cell", "dep:regex", "dep:semver", "dep:serde_json", "dep:smallvec", "dep:time", "dep:tokio", "dep:tokio-util", "dep:tracing", "dep:url", "dep:uuid", "dep:windows-sys"] gkrust = ["dep:arrayvec", "dep:bindgen", "dep:bitflags", "dep:bytes", "dep:cc", "dep:chrono", "dep:env_logger", "dep:flate2", "dep:futures-channel", "dep:futures-core", "dep:futures-sink", "dep:futures-util", "dep:getrandom", "dep:hashbrown", "dep:indexmap", "dep:log", "dep:memchr", "dep:nom", "dep:num-integer", "dep:num-traits", "dep:once_cell", "dep:regex", "dep:scopeguard", "dep:semver", "dep:serde_json", "dep:smallvec", "dep:time", "dep:url", "dep:uuid", "dep:windows-sys"] gkrust-gtest = ["gkrust"] -http3server = ["dep:arrayvec", "dep:bindgen", "dep:bitflags", "dep:bytes", "dep:chrono", "dep:env_logger", "dep:futures-channel", "dep:futures-core", "dep:futures-sink", "dep:futures-util", "dep:getrandom", "dep:hashbrown", "dep:hyper", "dep:indexmap", "dep:log", "dep:memchr", "dep:mio", "dep:nom", "dep:num-integer", "dep:num-traits", "dep:once_cell", "dep:regex", "dep:serde_json", "dep:smallvec", "dep:time", "dep:tokio", "dep:tokio-util", "dep:tracing", "dep:url", "dep:windows-sys"] +http3server = ["dep:arrayvec", "dep:bindgen", "dep:bitflags", "dep:bytes", "dep:chrono", "dep:env_logger", "dep:futures-channel", "dep:futures-core", "dep:futures-sink", "dep:futures-util", "dep:getrandom", "dep:hashbrown", "dep:hyper", "dep:indexmap", "dep:log", "dep:memchr", "dep:mio", "dep:nom", "dep:num-integer", "dep:num-traits", "dep:once_cell", "dep:regex", "dep:serde_json", "dep:smallvec", "dep:time", "dep:tokio", "dep:tokio-util", "dep:tracing", "dep:url", "dep:windows-sys", "dep:dist-bin"] ipcclientcerts-static = ["dep:bindgen", "dep:bitflags", "dep:memchr", "dep:nom", "dep:regex"] jsrust = ["dep:arrayvec", "dep:cc", "dep:env_logger", "dep:getrandom", "dep:hashbrown", "dep:indexmap", "dep:log", "dep:memchr", "dep:num-traits", "dep:once_cell", "dep:semver", "dep:smallvec", "dep:url"] mozwer_s = ["dep:getrandom", "dep:hashbrown", "dep:indexmap", "dep:once_cell", "dep:serde_json", "dep:uuid", "dep:windows-sys"] |