mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1854022 - Adjust clang trunk patches to upstream changes. r=firefox-build-system-reviewers,andi
- D146664 is not needed anymore (something equivalent now landed upstream) - One patch needs a small context adjustment - Other patches need to be reverted because we already revert things they depend on. - We also disable a new warning about unversioned android target fallback because it currently causes problems we'll fix later. Differential Revision: https://phabricator.services.mozilla.com/D188669
This commit is contained in:
parent
23df3cab6b
commit
fc8b517cea
36
build/build-clang/allow-unversioned-android.patch
Normal file
36
build/build-clang/allow-unversioned-android.patch
Normal file
@ -0,0 +1,36 @@
|
||||
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
|
||||
index 31245964c4ba..dbdccd95bb4f 100644
|
||||
--- a/clang/lib/Driver/ToolChain.cpp
|
||||
+++ b/clang/lib/Driver/ToolChain.cpp
|
||||
@@ -689,7 +689,6 @@ ToolChain::getFallbackAndroidTargetPath(StringRef BaseDir) const {
|
||||
unsigned BestVersion = 0;
|
||||
|
||||
SmallString<32> TripleDir;
|
||||
- bool UsingUnversionedDir = false;
|
||||
std::error_code EC;
|
||||
for (llvm::vfs::directory_iterator LI = getVFS().dir_begin(BaseDir, EC), LE;
|
||||
!EC && LI != LE; LI = LI.increment(EC)) {
|
||||
@@ -698,14 +697,12 @@ ToolChain::getFallbackAndroidTargetPath(StringRef BaseDir) const {
|
||||
if (DirNameSuffix.consume_front(TripleWithoutLevelStr)) {
|
||||
if (DirNameSuffix.empty() && TripleDir.empty()) {
|
||||
TripleDir = DirName;
|
||||
- UsingUnversionedDir = true;
|
||||
} else {
|
||||
unsigned Version;
|
||||
if (!DirNameSuffix.getAsInteger(10, Version) && Version > BestVersion &&
|
||||
Version < TripleVersion) {
|
||||
BestVersion = Version;
|
||||
TripleDir = DirName;
|
||||
- UsingUnversionedDir = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -716,8 +713,6 @@ ToolChain::getFallbackAndroidTargetPath(StringRef BaseDir) const {
|
||||
|
||||
SmallString<128> P(BaseDir);
|
||||
llvm::sys::path::append(P, TripleDir);
|
||||
- if (UsingUnversionedDir)
|
||||
- D.Diag(diag::warn_android_unversioned_fallback) << P << getTripleString();
|
||||
return std::string(P);
|
||||
}
|
||||
|
@ -1,22 +1,26 @@
|
||||
{
|
||||
"patches": [
|
||||
"allow-unversioned-android.patch",
|
||||
"find_symbolizer_linux_clang_15.patch",
|
||||
"android-mangling-error_clang_12.patch",
|
||||
"unpoison-thread-stacks_clang_10.patch",
|
||||
"downgrade-mangling-error_clang_12.patch",
|
||||
"fuzzing_ccov_build_clang_12.patch",
|
||||
"revert-llvmorg-18-init-6208-g2baf4a06ef06.patch",
|
||||
"revert-llvmorg-18-init-6193-gb88cffeafd39.patch",
|
||||
"revert-llvmorg-18-init-6188-gc649f29c24c9.patch",
|
||||
"revert-llvmorg-18-init-6139-gcf8e189a99f9.patch",
|
||||
"revert-llvmorg-18-init-3037-g625113402f9f.patch",
|
||||
"partial-revert-llvmorg-17-init-17713-gc8e055d485ea.patch",
|
||||
"partial-revert-llvmorg-17-init-7686-g244be0b0de19.patch",
|
||||
"revert-llvmorg-17-init-4120-g02e8eb1a438b_clang_18.patch",
|
||||
"partial-revert-llvmorg-16-init-17151-gaa0883b59ae1_clang_17.patch",
|
||||
"revert-llvmorg-16-init-11301-g163bb6d64e5f_clang_17.patch",
|
||||
"revert-llvmorg-16-init-11301-g163bb6d64e5f_clang_18.patch",
|
||||
"revert-llvmorg-16-init-7598-g54bfd0484615.patch",
|
||||
"revert-llvmorg-15-init-13446-g7524fe962e47.patch",
|
||||
"revert-llvmorg-15-init-11205-gcead4eceb01b_clang_18.patch",
|
||||
"revert-llvmorg-14-init-14141-gd6d3000a2f6d.patch",
|
||||
"revert-llvmorg-14-init-11890-gf86deb18cab6_clang_17.patch",
|
||||
"D146664.patch",
|
||||
"win64-ret-null-on-commitment-limit_clang_14.patch",
|
||||
"compiler-rt-rss-limit-heap-profile.patch"
|
||||
]
|
||||
|
@ -0,0 +1,183 @@
|
||||
From cf00b30288c4c81b2c6a5af01c38f236148777a0 Mon Sep 17 00:00:00 2001
|
||||
From: Mike Hommey <mh@glandium.org>
|
||||
Date: Tue, 28 Mar 2023 06:13:36 +0900
|
||||
Subject: [PATCH] Revert "[Passes][VectorCombine] enable early run generally
|
||||
and try load folds"
|
||||
|
||||
This reverts commit 163bb6d64e5f1220777c3ec2a8b58c0666a74d91.
|
||||
It causes various reftest regressions.
|
||||
---
|
||||
llvm/lib/Passes/PassBuilderPipelines.cpp | 7 ++++---
|
||||
llvm/lib/Transforms/Vectorize/VectorCombine.cpp | 8 ++------
|
||||
llvm/test/Other/new-pm-defaults.ll | 2 +-
|
||||
.../Other/new-pm-thinlto-postlink-defaults.ll | 1 -
|
||||
.../Other/new-pm-thinlto-postlink-pgo-defaults.ll | 1 -
|
||||
.../new-pm-thinlto-postlink-samplepgo-defaults.ll | 1 -
|
||||
.../Other/new-pm-thinlto-prelink-pgo-defaults.ll | 1 -
|
||||
.../new-pm-thinlto-prelink-samplepgo-defaults.ll | 1 -
|
||||
.../PhaseOrdering/X86/vec-load-combine.ll | 15 +++++++++++----
|
||||
9 files changed, 18 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
|
||||
index eed29c25714b..b925448cd6c0 100644
|
||||
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
|
||||
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
|
||||
@@ -611,9 +611,10 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
|
||||
// Delete small array after loop unroll.
|
||||
FPM.addPass(SROAPass(SROAOptions::ModifyCFG));
|
||||
|
||||
- // Try vectorization/scalarization transforms that are both improvements
|
||||
- // themselves and can allow further folds with GVN and InstCombine.
|
||||
- FPM.addPass(VectorCombinePass(/*TryEarlyFoldsOnly=*/true));
|
||||
+ // The matrix extension can introduce large vector operations early, which can
|
||||
+ // benefit from running vector-combine early on.
|
||||
+ if (EnableMatrix)
|
||||
+ FPM.addPass(VectorCombinePass(/*TryEarlyFoldsOnly=*/true));
|
||||
|
||||
// Eliminate redundancies.
|
||||
FPM.addPass(MergedLoadStoreMotionPass());
|
||||
diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
|
||||
index 2e489757ebc1..810a9f92bb7a 100644
|
||||
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
|
||||
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
|
||||
@@ -1715,23 +1715,6 @@ bool VectorCombine::run() {
|
||||
bool IsFixedVectorType = isa<FixedVectorType>(I.getType());
|
||||
auto Opcode = I.getOpcode();
|
||||
|
||||
- // These folds should be beneficial regardless of when this pass is run
|
||||
- // in the optimization pipeline.
|
||||
- // The type checking is for run-time efficiency. We can avoid wasting time
|
||||
- // dispatching to folding functions if there's no chance of matching.
|
||||
- if (IsFixedVectorType) {
|
||||
- switch (Opcode) {
|
||||
- case Instruction::InsertElement:
|
||||
- MadeChange |= vectorizeLoadInsert(I);
|
||||
- break;
|
||||
- case Instruction::ShuffleVector:
|
||||
- MadeChange |= widenSubvectorLoad(I);
|
||||
- break;
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
// This transform works with scalable and fixed vectors
|
||||
// TODO: Identify and allow other scalable transforms
|
||||
if (isa<VectorType>(I.getType())) {
|
||||
@@ -1753,9 +1736,11 @@ bool VectorCombine::run() {
|
||||
if (IsFixedVectorType) {
|
||||
switch (Opcode) {
|
||||
case Instruction::InsertElement:
|
||||
+ MadeChange |= vectorizeLoadInsert(I);
|
||||
MadeChange |= foldInsExtFNeg(I);
|
||||
break;
|
||||
case Instruction::ShuffleVector:
|
||||
+ MadeChange |= widenSubvectorLoad(I);
|
||||
MadeChange |= foldShuffleOfBinops(I);
|
||||
MadeChange |= foldSelectShuffle(I);
|
||||
break;
|
||||
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
|
||||
+++ b/llvm/test/Other/new-pm-defaults.ll
|
||||
@@ -186,7 +186,7 @@
|
||||
; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
|
||||
; CHECK-EP-LOOP-END-NEXT: Running pass: NoOpLoopPass
|
||||
; CHECK-O-NEXT: Running pass: SROAPass on foo
|
||||
-; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
|
||||
+; CHECK-MATRIX: Running pass: VectorCombinePass
|
||||
; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
|
||||
; CHECK-O23SZ-NEXT: Running pass: GVNPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
|
||||
diff --git a/llvm/test/Other/new-pm-thinlto-postlink-defaults.ll b/llvm/test/Other/new-pm-thinlto-postlink-defaults.ll
|
||||
index 3f5d2d5b153d..ea07128c9f6a 100644
|
||||
--- a/llvm/test/Other/new-pm-thinlto-postlink-defaults.ll
|
||||
+++ b/llvm/test/Other/new-pm-thinlto-postlink-defaults.ll
|
||||
@@ -159,7 +159,6 @@
|
||||
; CHECK-O-NEXT: Running pass: LoopDeletionPass
|
||||
; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
|
||||
; CHECK-O-NEXT: Running pass: SROAPass on foo
|
||||
-; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
|
||||
; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
|
||||
; CHECK-O23SZ-NEXT: Running pass: GVNPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
|
||||
diff --git a/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll b/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
|
||||
index 29021ceace54..43e943cb6011 100644
|
||||
--- a/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
|
||||
+++ b/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
|
||||
@@ -121,7 +121,6 @@
|
||||
; CHECK-O-NEXT: Running pass: LoopDeletionPass
|
||||
; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
|
||||
; CHECK-O-NEXT: Running pass: SROAPass on foo
|
||||
-; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
|
||||
; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
|
||||
; CHECK-O23SZ-NEXT: Running pass: GVNPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
|
||||
diff --git a/llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll b/llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
|
||||
index daf3141a1f2c..78914d1c23b2 100644
|
||||
--- a/llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
|
||||
+++ b/llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
|
||||
@@ -130,7 +130,6 @@
|
||||
; CHECK-O-NEXT: Running pass: LoopDeletionPass
|
||||
; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
|
||||
; CHECK-O-NEXT: Running pass: SROAPass on foo
|
||||
-; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
|
||||
; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
|
||||
; CHECK-O23SZ-NEXT: Running pass: GVNPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
|
||||
diff --git a/llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll b/llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
|
||||
index bfe80902f806..5b62ba39add3 100644
|
||||
--- a/llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
|
||||
+++ b/llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
|
||||
@@ -160,7 +160,6 @@
|
||||
; CHECK-O-NEXT: Running pass: LoopDeletionPass
|
||||
; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
|
||||
; CHECK-O-NEXT: Running pass: SROAPass on foo
|
||||
-; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
|
||||
; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
|
||||
; CHECK-O23SZ-NEXT: Running pass: GVNPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
|
||||
diff --git a/llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll b/llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
|
||||
index c7daf7aa46b1..17475423d696 100644
|
||||
--- a/llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
|
||||
+++ b/llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
|
||||
@@ -124,7 +124,6 @@
|
||||
; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
|
||||
; CHECK-O-NEXT: Running pass: LoopDeletionPass
|
||||
; CHECK-O-NEXT: Running pass: SROAPass on foo
|
||||
-; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
|
||||
; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
|
||||
; CHECK-O23SZ-NEXT: Running pass: GVNPass
|
||||
; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
|
||||
diff --git a/llvm/test/Transforms/PhaseOrdering/X86/vec-load-combine.ll b/llvm/test/Transforms/PhaseOrdering/X86/vec-load-combine.ll
|
||||
index 77cbc70ff369..dd7164febea4 100644
|
||||
--- a/llvm/test/Transforms/PhaseOrdering/X86/vec-load-combine.ll
|
||||
+++ b/llvm/test/Transforms/PhaseOrdering/X86/vec-load-combine.ll
|
||||
@@ -12,13 +12,20 @@ $getAt = comdat any
|
||||
define dso_local noundef <4 x float> @ConvertVectors_ByRef(ptr noundef nonnull align 16 dereferenceable(16) %0) #0 {
|
||||
; SSE-LABEL: @ConvertVectors_ByRef(
|
||||
; SSE-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[TMP0:%.*]], align 16
|
||||
-; SSE-NEXT: [[TMP3:%.*]] = shufflevector <4 x float> [[TMP2]], <4 x float> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 2>
|
||||
-; SSE-NEXT: ret <4 x float> [[TMP3]]
|
||||
+; SSE-NEXT: [[TMP3:%.*]] = getelementptr inbounds [4 x float], ptr [[TMP0]], i64 0, i64 1
|
||||
+; SSE-NEXT: [[TMP4:%.*]] = load <2 x float>, ptr [[TMP3]], align 4
|
||||
+; SSE-NEXT: [[TMP5:%.*]] = shufflevector <2 x float> [[TMP4]], <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
|
||||
+; SSE-NEXT: [[TMP6:%.*]] = shufflevector <4 x float> [[TMP2]], <4 x float> [[TMP5]], <4 x i32> <i32 0, i32 4, i32 5, i32 undef>
|
||||
+; SSE-NEXT: [[TMP7:%.*]] = shufflevector <4 x float> [[TMP6]], <4 x float> [[TMP5]], <4 x i32> <i32 0, i32 1, i32 2, i32 5>
|
||||
+; SSE-NEXT: ret <4 x float> [[TMP7]]
|
||||
;
|
||||
; AVX-LABEL: @ConvertVectors_ByRef(
|
||||
; AVX-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[TMP0:%.*]], align 16
|
||||
-; AVX-NEXT: [[TMP3:%.*]] = shufflevector <4 x float> [[TMP2]], <4 x float> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 2>
|
||||
-; AVX-NEXT: ret <4 x float> [[TMP3]]
|
||||
+; AVX-NEXT: [[TMP3:%.*]] = getelementptr inbounds [4 x float], ptr [[TMP0]], i64 0, i64 2
|
||||
+; AVX-NEXT: [[TMP4:%.*]] = load float, ptr [[TMP3]], align 8
|
||||
+; AVX-NEXT: [[TMP5:%.*]] = insertelement <4 x float> [[TMP2]], float [[TMP4]], i64 2
|
||||
+; AVX-NEXT: [[TMP6:%.*]] = insertelement <4 x float> [[TMP5]], float [[TMP4]], i64 3
|
||||
+; AVX-NEXT: ret <4 x float> [[TMP6]]
|
||||
;
|
||||
%2 = alloca ptr, align 8
|
||||
%3 = alloca <4 x float>, align 16
|
||||
--
|
||||
2.39.0.1.g6739ec1790
|
||||
|
@ -0,0 +1,132 @@
|
||||
From 126b7ff0cf72e084b3e5bd8dd8afedaea5b0375d Mon Sep 17 00:00:00 2001
|
||||
From: Mike Hommey <mh@glandium.org>
|
||||
Date: Wed, 20 Sep 2023 09:13:05 +0900
|
||||
Subject: [PATCH] Revert "[clang][TSA] Thread safety cleanup functions"
|
||||
|
||||
This reverts commit cf8e189a99f988398a48148b9ea7901948665ab0 because it
|
||||
depends on 54bfd04846156dbd5e0a6b88f539c3d4569a455f, which we also
|
||||
revert.
|
||||
---
|
||||
.../Analysis/Analyses/ThreadSafetyCommon.h | 2 +-
|
||||
clang/lib/Analysis/ThreadSafety.cpp | 12 +-----------
|
||||
clang/lib/Analysis/ThreadSafetyCommon.cpp | 19 ++++---------------
|
||||
clang/test/Sema/warn-thread-safety-analysis.c | 9 ---------
|
||||
4 files changed, 6 insertions(+), 36 deletions(-)
|
||||
|
||||
diff --git a/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h b/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
|
||||
index 13e37ac2b56b..9d28325c1ea6 100644
|
||||
--- a/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
|
||||
+++ b/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
|
||||
@@ -361,7 +361,7 @@ public:
|
||||
unsigned NumArgs = 0;
|
||||
|
||||
// Function arguments
|
||||
- llvm::PointerUnion<const Expr *const *, til::SExpr *> FunArgs = nullptr;
|
||||
+ const Expr *const *FunArgs = nullptr;
|
||||
|
||||
// is Self referred to with -> or .?
|
||||
bool SelfArrow = false;
|
||||
diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp
|
||||
index 3e6ceb7d54c4..3107d035254d 100644
|
||||
--- a/clang/lib/Analysis/ThreadSafety.cpp
|
||||
+++ b/clang/lib/Analysis/ThreadSafety.cpp
|
||||
@@ -1773,8 +1773,7 @@ void BuildLockset::checkPtAccess(const Expr *Exp, AccessKind AK,
|
||||
///
|
||||
/// \param Exp The call expression.
|
||||
/// \param D The callee declaration.
|
||||
-/// \param Self If \p Exp = nullptr, the implicit this argument or the argument
|
||||
-/// of an implicitly called cleanup function.
|
||||
+/// \param Self If \p Exp = nullptr, the implicit this argument.
|
||||
/// \param Loc If \p Exp = nullptr, the location.
|
||||
void BuildLockset::handleCall(const Expr *Exp, const NamedDecl *D,
|
||||
til::LiteralPtr *Self, SourceLocation Loc) {
|
||||
@@ -2418,15 +2417,6 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) {
|
||||
AD.getTriggerStmt()->getEndLoc());
|
||||
break;
|
||||
}
|
||||
-
|
||||
- case CFGElement::CleanupFunction: {
|
||||
- const CFGCleanupFunction &CF = BI.castAs<CFGCleanupFunction>();
|
||||
- LocksetBuilder.handleCall(/*Exp=*/nullptr, CF.getFunctionDecl(),
|
||||
- SxBuilder.createVariable(CF.getVarDecl()),
|
||||
- CF.getVarDecl()->getLocation());
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
case CFGElement::TemporaryDtor: {
|
||||
auto TD = BI.castAs<CFGTemporaryDtor>();
|
||||
|
||||
diff --git a/clang/lib/Analysis/ThreadSafetyCommon.cpp b/clang/lib/Analysis/ThreadSafetyCommon.cpp
|
||||
index 63cc66852a9e..b8286cef396c 100644
|
||||
--- a/clang/lib/Analysis/ThreadSafetyCommon.cpp
|
||||
+++ b/clang/lib/Analysis/ThreadSafetyCommon.cpp
|
||||
@@ -110,8 +110,7 @@ static StringRef ClassifyDiagnostic(QualType VDT) {
|
||||
/// \param D The declaration to which the attribute is attached.
|
||||
/// \param DeclExp An expression involving the Decl to which the attribute
|
||||
/// is attached. E.g. the call to a function.
|
||||
-/// \param Self S-expression to substitute for a \ref CXXThisExpr in a call,
|
||||
-/// or argument to a cleanup function.
|
||||
+/// \param Self S-expression to substitute for a \ref CXXThisExpr.
|
||||
CapabilityExpr SExprBuilder::translateAttrExpr(const Expr *AttrExp,
|
||||
const NamedDecl *D,
|
||||
const Expr *DeclExp,
|
||||
@@ -145,11 +144,7 @@ CapabilityExpr SExprBuilder::translateAttrExpr(const Expr *AttrExp,
|
||||
|
||||
if (Self) {
|
||||
assert(!Ctx.SelfArg && "Ambiguous self argument");
|
||||
- assert(isa<FunctionDecl>(D) && "Self argument requires function");
|
||||
- if (isa<CXXMethodDecl>(D))
|
||||
- Ctx.SelfArg = Self;
|
||||
- else
|
||||
- Ctx.FunArgs = Self;
|
||||
+ Ctx.SelfArg = Self;
|
||||
|
||||
// If the attribute has no arguments, then assume the argument is "this".
|
||||
if (!AttrExp)
|
||||
@@ -317,14 +312,8 @@ til::SExpr *SExprBuilder::translateDeclRefExpr(const DeclRefExpr *DRE,
|
||||
? (cast<FunctionDecl>(D)->getCanonicalDecl() == Canonical)
|
||||
: (cast<ObjCMethodDecl>(D)->getCanonicalDecl() == Canonical)) {
|
||||
// Substitute call arguments for references to function parameters
|
||||
- if (const Expr *const *FunArgs =
|
||||
- Ctx->FunArgs.dyn_cast<const Expr *const *>()) {
|
||||
- assert(I < Ctx->NumArgs);
|
||||
- return translate(FunArgs[I], Ctx->Prev);
|
||||
- }
|
||||
-
|
||||
- assert(I == 0);
|
||||
- return Ctx->FunArgs.get<til::SExpr *>();
|
||||
+ assert(I < Ctx->NumArgs);
|
||||
+ return translate(Ctx->FunArgs[I], Ctx->Prev);
|
||||
}
|
||||
}
|
||||
// Map the param back to the param of the original function declaration
|
||||
diff --git a/clang/test/Sema/warn-thread-safety-analysis.c b/clang/test/Sema/warn-thread-safety-analysis.c
|
||||
index 642ea88ec3c9..355616b73d96 100644
|
||||
--- a/clang/test/Sema/warn-thread-safety-analysis.c
|
||||
+++ b/clang/test/Sema/warn-thread-safety-analysis.c
|
||||
@@ -72,8 +72,6 @@ int get_value(int *p) SHARED_LOCKS_REQUIRED(foo_.mu_){
|
||||
return *p;
|
||||
}
|
||||
|
||||
-void unlock_scope(struct Mutex *const *mu) __attribute__((release_capability(**mu)));
|
||||
-
|
||||
int main(void) {
|
||||
|
||||
Foo_fun1(1); // expected-warning{{calling function 'Foo_fun1' requires holding mutex 'mu2'}} \
|
||||
@@ -129,13 +127,6 @@ int main(void) {
|
||||
// expected-note@-1{{mutex released here}}
|
||||
mutex_shared_unlock(&mu1); // expected-warning {{releasing mutex 'mu1' that was not held}}
|
||||
|
||||
- /// Cleanup functions
|
||||
- {
|
||||
- struct Mutex* const __attribute__((cleanup(unlock_scope))) scope = &mu1;
|
||||
- mutex_exclusive_lock(scope); // Note that we have to lock through scope, because no alias analysis!
|
||||
- // Cleanup happens automatically -> no warning.
|
||||
- }
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.41.0.3.g1cb8d410ac
|
||||
|
@ -0,0 +1,481 @@
|
||||
From c3994286d37f4273d6d7a4cb578828d64a25a341 Mon Sep 17 00:00:00 2001
|
||||
From: Mike Hommey <mh@glandium.org>
|
||||
Date: Wed, 20 Sep 2023 10:08:22 +0900
|
||||
Subject: [PATCH 3/3] Revert "[llvm-nm] Add --line-numbers flag"
|
||||
|
||||
This reverts commit c649f29c24c9fc1502d8d53e0c96c3d24b31de1a because it
|
||||
depends on cead4eceb01b935fae07bf4a7e91911b344d2fec, which we revert.
|
||||
---
|
||||
llvm/docs/CommandGuide/llvm-nm.rst | 6 -
|
||||
llvm/docs/ReleaseNotes.rst | 3 -
|
||||
llvm/test/tools/llvm-nm/X86/line-numbers.test | 240 ------------------
|
||||
llvm/tools/llvm-nm/CMakeLists.txt | 1 -
|
||||
llvm/tools/llvm-nm/Opts.td | 2 -
|
||||
llvm/tools/llvm-nm/llvm-nm.cpp | 92 +------
|
||||
6 files changed, 5 insertions(+), 339 deletions(-)
|
||||
delete mode 100644 llvm/test/tools/llvm-nm/X86/line-numbers.test
|
||||
|
||||
diff --git a/llvm/docs/CommandGuide/llvm-nm.rst b/llvm/docs/CommandGuide/llvm-nm.rst
|
||||
index 7067bb0a29a1..4b1290a15665 100644
|
||||
--- a/llvm/docs/CommandGuide/llvm-nm.rst
|
||||
+++ b/llvm/docs/CommandGuide/llvm-nm.rst
|
||||
@@ -190,12 +190,6 @@ OPTIONS
|
||||
|
||||
Print just the symbol names. Alias for `--format=just-symbols``.
|
||||
|
||||
-.. option:: --line-numbers, -l
|
||||
-
|
||||
- Use debugging information to print the filenames and line numbers where
|
||||
- symbols are defined. Undefined symbols have the location of their first
|
||||
- relocation printed instead.
|
||||
-
|
||||
.. option:: -m
|
||||
|
||||
Use Darwin format. Alias for ``--format=darwin``.
|
||||
diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
|
||||
index 660bb4e70a5a..352420e1110d 100644
|
||||
--- a/llvm/docs/ReleaseNotes.rst
|
||||
+++ b/llvm/docs/ReleaseNotes.rst
|
||||
@@ -177,9 +177,6 @@ Changes to the LLVM tools
|
||||
* llvm-readelf now supports ``--extra-sym-info`` (``-X``) to display extra
|
||||
information (section name) when showing symbols.
|
||||
|
||||
-* ``llvm-nm`` now supports the ``--line-numbers`` (``-l``) option to use
|
||||
- debugging information to print symbols' filenames and line numbers.
|
||||
-
|
||||
Changes to LLDB
|
||||
---------------------------------
|
||||
|
||||
diff --git a/llvm/test/tools/llvm-nm/X86/line-numbers.test b/llvm/test/tools/llvm-nm/X86/line-numbers.test
|
||||
deleted file mode 100644
|
||||
index 4b9817ab5c62..000000000000
|
||||
--- a/llvm/test/tools/llvm-nm/X86/line-numbers.test
|
||||
+++ /dev/null
|
||||
@@ -1,240 +0,0 @@
|
||||
-## Check that printing line numbers isn't attempted for files like bitcode,
|
||||
-## which have symbols but limited/no section or debug info.
|
||||
-# RUN: llvm-nm --line-numbers %p/Inputs/test.IRobj-x86_64 | FileCheck %s --check-prefix=BITCODE --match-full-lines --implicit-check-not={{.}}
|
||||
-# BITCODE: ---------------- S _global_const
|
||||
-# BITCODE-NEXT: ---------------- D _global_data
|
||||
-# BITCODE-NEXT: ---------------- T _global_func
|
||||
-# BITCODE-NEXT: ---------------- S _hidden_const
|
||||
-# BITCODE-NEXT: ---------------- D _hidden_data
|
||||
-# BITCODE-NEXT: ---------------- T _hidden_func
|
||||
-# BITCODE-NEXT: ---------------- s _static_const
|
||||
-# BITCODE-NEXT: ---------------- d _static_data
|
||||
-# BITCODE-NEXT: ---------------- t _static_func
|
||||
-
|
||||
-## Check that various symbol types can use debug information if available to
|
||||
-## print line numbers, and if unavailable, don't print anything erroneous. The
|
||||
-## specific cases checked are given by the symbol names below. Other test cases
|
||||
-## place requirements on the contents of the whole file, so they are kept out
|
||||
-## of main.o.
|
||||
-# RUN: rm -rf %t
|
||||
-# RUN: split-file %s %t
|
||||
-# RUN: llvm-mc -g --filetype=obj %t/main.s -o %t/main.o
|
||||
-# RUN: llvm-nm -l %t/main.o | FileCheck %s --match-full-lines --implicit-check-not={{.}}
|
||||
-# RUN: llvm-nm --line-numbers %t/main.o | FileCheck %s --match-full-lines --implicit-check-not={{.}}
|
||||
-
|
||||
-# CHECK: 0000000000001234 a absolute_symbol
|
||||
-# CHECK-NEXT: 0000000000000000 d data_no_dwarf
|
||||
-# CHECK-NEXT: 0000000000000000 T defined_global_function [[FILENAME:.*main.s]]:4
|
||||
-# CHECK-NEXT: 0000000000000001 t defined_local_function [[FILENAME]]:7
|
||||
-# CHECK-NEXT: 0000000000000000 t function_no_dwarf
|
||||
-# CHECK-NEXT: U undef1 [[FILENAME]]:12
|
||||
-# CHECK-NEXT: U undef2 [[FILENAME]]:14
|
||||
-# CHECK-NEXT: U undef_no_reloc
|
||||
-# CHECK-NEXT: 0000000000000002 t undefined_references [[FILENAME]]:12
|
||||
-
|
||||
-## Check that in the absence of DWARF in the whole object, no line number
|
||||
-## information is printed.
|
||||
-# RUN: llvm-mc --filetype=obj %t/main.s -o %t/no-dwarf.o
|
||||
-# RUN: llvm-nm -l %t/no-dwarf.o | FileCheck %s --check-prefix=NO-DWARF --match-full-lines --implicit-check-not={{.}}
|
||||
-
|
||||
-# NO-DWARF: 0000000000001234 a absolute_symbol
|
||||
-# NO-DWARF-NEXT: 0000000000000000 d data_no_dwarf
|
||||
-# NO-DWARF-NEXT: 0000000000000000 T defined_global_function
|
||||
-# NO-DWARF-NEXT: 0000000000000001 t defined_local_function
|
||||
-# NO-DWARF-NEXT: 0000000000000000 t function_no_dwarf
|
||||
-# NO-DWARF-NEXT: U undef1
|
||||
-# NO-DWARF-NEXT: U undef2
|
||||
-# NO-DWARF-NEXT: U undef_no_reloc
|
||||
-# NO-DWARF-NEXT: 0000000000000002 t undefined_references
|
||||
-
|
||||
-## Check that printing line numbers for undefined values is not attempted in
|
||||
-## the absence of any relocation section.
|
||||
-# RUN: llvm-mc --filetype=obj %t/undef-no-reloc-sections.s -o %t/undef-no-reloc-sections.o
|
||||
-# RUN: llvm-nm --line-numbers %t/undef-no-reloc-sections.o | FileCheck %s --check-prefix=UNDEF-NO-RELOC-SECTIONS --match-full-lines --implicit-check-not={{.}}
|
||||
-
|
||||
-# UNDEF-NO-RELOC-SECTIONS: U undef
|
||||
-
|
||||
-## Check that printing line numbers for undefined values does not include
|
||||
-## relocations for non-text sections. This is broken out of main.s to ensure
|
||||
-## that the data relocation for undef comes first.
|
||||
-# RUN: llvm-mc -g --filetype=obj %t/undef-data-reloc.s -o %t/undef-data-reloc.o
|
||||
-# RUN: llvm-nm --line-numbers %t/undef-data-reloc.o | FileCheck %s --check-prefix=UNDEF-DATA-RELOC --match-full-lines --implicit-check-not={{.}}
|
||||
-
|
||||
-# UNDEF-DATA-RELOC: 0000000000000000 r data_reloc
|
||||
-# UNDEF-DATA-RELOC-NEXT: U undef
|
||||
-
|
||||
-## Check that line numbers can be printed for data definitions. These are broken
|
||||
-## out of main.s since their DWARF cannot be generated with llvm-mc -g.
|
||||
-# RUN: llvm-mc -g --filetype=obj %t/data-dwarf.s -o %t/data-dwarf.o
|
||||
-# RUN: llvm-nm --line-numbers %t/data-dwarf.o | FileCheck %s --check-prefix=DATA-DWARF --match-full-lines --implicit-check-not={{.}}
|
||||
-
|
||||
-# DATA-DWARF: 0000000000000000 D defined_data /tmp/tmp.c:1
|
||||
-
|
||||
-#--- main.s
|
||||
-.text
|
||||
-.globl defined_global_function
|
||||
-defined_global_function:
|
||||
- ret
|
||||
-
|
||||
-defined_local_function:
|
||||
- ret
|
||||
-
|
||||
-absolute_symbol = 0x1234
|
||||
-
|
||||
-undefined_references:
|
||||
- nop
|
||||
- .long undef1
|
||||
- nop
|
||||
- .long undef2
|
||||
- ret
|
||||
-
|
||||
-# Note: llvm-mc -g produces no DWARF for data.
|
||||
-.data
|
||||
-data_no_dwarf:
|
||||
- .byte 0
|
||||
-
|
||||
-.globl undef_no_reloc
|
||||
-
|
||||
-# Note: llvm-mc -g does not produce DWARF for non-SHF_ALLOC sections.
|
||||
-.section no_alloc_text,"x",@progbits
|
||||
-function_no_dwarf:
|
||||
- ret
|
||||
-
|
||||
-#--- undef-no-reloc-sections.s
|
||||
-.globl undef
|
||||
-
|
||||
-#--- undef-data-reloc.s
|
||||
-.globl undef
|
||||
-.rodata
|
||||
-data_reloc:
|
||||
- .long undef
|
||||
-
|
||||
-#--- data-dwarf.s
|
||||
-# char defined_data = 42
|
||||
- .text
|
||||
- .file "tmp.c"
|
||||
- .file 0 "/tmp" "/tmp/tmp.c" md5 0x39602a53b15a32d6a622ca86936e88d7
|
||||
- .file 1 "tmp.c" md5 0x39602a53b15a32d6a622ca86936e88d7
|
||||
- .type defined_data,@object # @defined_data
|
||||
- .data
|
||||
- .globl defined_data
|
||||
-defined_data:
|
||||
- .byte 42 # 0x2a
|
||||
- .size defined_data, 1
|
||||
-
|
||||
- .section .debug_abbrev,"",@progbits
|
||||
- .byte 1 # Abbreviation Code
|
||||
- .byte 17 # DW_TAG_compile_unit
|
||||
- .byte 1 # DW_CHILDREN_yes
|
||||
- .byte 37 # DW_AT_producer
|
||||
- .byte 37 # DW_FORM_strx1
|
||||
- .byte 19 # DW_AT_language
|
||||
- .byte 5 # DW_FORM_data2
|
||||
- .byte 3 # DW_AT_name
|
||||
- .byte 37 # DW_FORM_strx1
|
||||
- .byte 114 # DW_AT_str_offsets_base
|
||||
- .byte 23 # DW_FORM_sec_offset
|
||||
- .byte 16 # DW_AT_stmt_list
|
||||
- .byte 23 # DW_FORM_sec_offset
|
||||
- .byte 27 # DW_AT_comp_dir
|
||||
- .byte 37 # DW_FORM_strx1
|
||||
- .byte 115 # DW_AT_addr_base
|
||||
- .byte 23 # DW_FORM_sec_offset
|
||||
- .byte 0 # EOM(1)
|
||||
- .byte 0 # EOM(2)
|
||||
- .byte 2 # Abbreviation Code
|
||||
- .byte 52 # DW_TAG_variable
|
||||
- .byte 0 # DW_CHILDREN_no
|
||||
- .byte 3 # DW_AT_name
|
||||
- .byte 37 # DW_FORM_strx1
|
||||
- .byte 73 # DW_AT_type
|
||||
- .byte 19 # DW_FORM_ref4
|
||||
- .byte 63 # DW_AT_external
|
||||
- .byte 25 # DW_FORM_flag_present
|
||||
- .byte 58 # DW_AT_decl_file
|
||||
- .byte 11 # DW_FORM_data1
|
||||
- .byte 59 # DW_AT_decl_line
|
||||
- .byte 11 # DW_FORM_data1
|
||||
- .byte 2 # DW_AT_location
|
||||
- .byte 24 # DW_FORM_exprloc
|
||||
- .byte 0 # EOM(1)
|
||||
- .byte 0 # EOM(2)
|
||||
- .byte 3 # Abbreviation Code
|
||||
- .byte 36 # DW_TAG_base_type
|
||||
- .byte 0 # DW_CHILDREN_no
|
||||
- .byte 3 # DW_AT_name
|
||||
- .byte 37 # DW_FORM_strx1
|
||||
- .byte 62 # DW_AT_encoding
|
||||
- .byte 11 # DW_FORM_data1
|
||||
- .byte 11 # DW_AT_byte_size
|
||||
- .byte 11 # DW_FORM_data1
|
||||
- .byte 0 # EOM(1)
|
||||
- .byte 0 # EOM(2)
|
||||
- .byte 0 # EOM(3)
|
||||
- .section .debug_info,"",@progbits
|
||||
-.Lcu_begin0:
|
||||
- .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
|
||||
-.Ldebug_info_start0:
|
||||
- .short 5 # DWARF version number
|
||||
- .byte 1 # DWARF Unit Type
|
||||
- .byte 8 # Address Size (in bytes)
|
||||
- .long .debug_abbrev # Offset Into Abbrev. Section
|
||||
- .byte 1 # Abbrev [1] 0xc:0x22 DW_TAG_compile_unit
|
||||
- .byte 0 # DW_AT_producer
|
||||
- .short 12 # DW_AT_language
|
||||
- .byte 1 # DW_AT_name
|
||||
- .long .Lstr_offsets_base0 # DW_AT_str_offsets_base
|
||||
- .long .Lline_table_start0 # DW_AT_stmt_list
|
||||
- .byte 2 # DW_AT_comp_dir
|
||||
- .long .Laddr_table_base0 # DW_AT_addr_base
|
||||
- .byte 2 # Abbrev [2] 0x1e:0xb DW_TAG_variable
|
||||
- .byte 3 # DW_AT_name
|
||||
- .long 41 # DW_AT_type
|
||||
- # DW_AT_external
|
||||
- .byte 1 # DW_AT_decl_file
|
||||
- .byte 1 # DW_AT_decl_line
|
||||
- .byte 2 # DW_AT_location
|
||||
- .byte 161
|
||||
- .byte 0
|
||||
- .byte 3 # Abbrev [3] 0x29:0x4 DW_TAG_base_type
|
||||
- .byte 4 # DW_AT_name
|
||||
- .byte 6 # DW_AT_encoding
|
||||
- .byte 1 # DW_AT_byte_size
|
||||
- .byte 0 # End Of Children Mark
|
||||
-.Ldebug_info_end0:
|
||||
- .section .debug_str_offsets,"",@progbits
|
||||
- .long 24 # Length of String Offsets Set
|
||||
- .short 5
|
||||
- .short 0
|
||||
-.Lstr_offsets_base0:
|
||||
- .section .debug_str,"MS",@progbits,1
|
||||
-.Linfo_string0:
|
||||
- .asciz "Debian clang version 14.0.6" # string offset=0
|
||||
-.Linfo_string1:
|
||||
- .asciz "/tmp/tmp.c" # string offset=28
|
||||
-.Linfo_string2:
|
||||
- .asciz "/tmp" # string offset=39
|
||||
-.Linfo_string3:
|
||||
- .asciz "defined_data" # string offset=44
|
||||
-.Linfo_string4:
|
||||
- .asciz "char" # string offset=57
|
||||
- .section .debug_str_offsets,"",@progbits
|
||||
- .long .Linfo_string0
|
||||
- .long .Linfo_string1
|
||||
- .long .Linfo_string2
|
||||
- .long .Linfo_string3
|
||||
- .long .Linfo_string4
|
||||
- .section .debug_addr,"",@progbits
|
||||
- .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
|
||||
-.Ldebug_addr_start0:
|
||||
- .short 5 # DWARF version number
|
||||
- .byte 8 # Address size
|
||||
- .byte 0 # Segment selector size
|
||||
-.Laddr_table_base0:
|
||||
- .quad defined_data
|
||||
-.Ldebug_addr_end0:
|
||||
- .ident "Debian clang version 14.0.6"
|
||||
- .section ".note.GNU-stack","",@progbits
|
||||
- .addrsig
|
||||
- .section .debug_line,"",@progbits
|
||||
-.Lline_table_start0:
|
||||
diff --git a/llvm/tools/llvm-nm/CMakeLists.txt b/llvm/tools/llvm-nm/CMakeLists.txt
|
||||
index 5191e138d1c0..ec04f1e9d234 100644
|
||||
--- a/llvm/tools/llvm-nm/CMakeLists.txt
|
||||
+++ b/llvm/tools/llvm-nm/CMakeLists.txt
|
||||
@@ -8,7 +8,6 @@ set(LLVM_LINK_COMPONENTS
|
||||
Object
|
||||
Option
|
||||
Support
|
||||
- Symbolize
|
||||
TargetParser
|
||||
TextAPI
|
||||
)
|
||||
diff --git a/llvm/tools/llvm-nm/Opts.td b/llvm/tools/llvm-nm/Opts.td
|
||||
index 04d9f5db5cf8..60ac134269b3 100644
|
||||
--- a/llvm/tools/llvm-nm/Opts.td
|
||||
+++ b/llvm/tools/llvm-nm/Opts.td
|
||||
@@ -22,7 +22,6 @@ def export_symbols : FF<"export-symbols", "Export symbol list for all inputs">;
|
||||
def extern_only : FF<"extern-only", "Show only external symbols">;
|
||||
defm format : Eq<"format", "Specify output format: bsd (default), posix, sysv, darwin, just-symbols">, MetaVarName<"<format>">;
|
||||
def help : FF<"help", "Display this help">;
|
||||
-def line_numbers : FF<"line-numbers", "Use debugging information to print symbols' filenames and line numbers">;
|
||||
def no_llvm_bc : FF<"no-llvm-bc", "Disable LLVM bitcode reader">;
|
||||
def no_sort : FF<"no-sort", "Show symbols in order encountered">;
|
||||
def no_weak : FF<"no-weak", "Show only non-weak symbols">;
|
||||
@@ -68,7 +67,6 @@ def : JoinedOrSeparate<["-"], "f">, HelpText<"Alias for --format">, Alias<format
|
||||
def : F<"h", "Alias for --help">, Alias<help>;
|
||||
def : F<"g", "Alias for --extern-only">, Alias<extern_only>;
|
||||
def : F<"j", "Alias for --format=just-symbols">, Alias<format_EQ>, AliasArgs<["just-symbols"]>;
|
||||
-def : F<"l", "Alias for --line-numbers">, Alias<line_numbers>;
|
||||
def : F<"m", "Alias for --format=darwin">, Alias<format_EQ>, AliasArgs<["darwin"]>;
|
||||
def : F<"M", "Deprecated alias for --print-armap">, Alias<print_armap>, Flags<[HelpHidden]>;
|
||||
def : F<"n", "Alias for --numeric-sort">, Alias<numeric_sort>;
|
||||
diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp
|
||||
index 051fa3e5bfa5..9a9e8bd146bb 100644
|
||||
--- a/llvm/tools/llvm-nm/llvm-nm.cpp
|
||||
+++ b/llvm/tools/llvm-nm/llvm-nm.cpp
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "llvm/BinaryFormat/COFF.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/BinaryFormat/XCOFF.h"
|
||||
-#include "llvm/DebugInfo/Symbolize/Symbolize.h"
|
||||
#include "llvm/Demangle/Demangle.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
@@ -98,7 +97,6 @@ static bool Demangle;
|
||||
static bool DynamicSyms;
|
||||
static bool ExportSymbols;
|
||||
static bool ExternalOnly;
|
||||
-static bool LineNumbers;
|
||||
static OutputFormatTy OutputFormat;
|
||||
static bool NoLLVMBitcode;
|
||||
static bool NoSort;
|
||||
@@ -553,6 +551,8 @@ static void darwinPrintSymbol(SymbolicFile &Obj, const NMSymbol &S,
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ outs() << "\n";
|
||||
}
|
||||
|
||||
// Table that maps Darwin's Mach-O stab constants to strings to allow printing.
|
||||
@@ -689,88 +689,9 @@ static void printExportSymbolList(const std::vector<NMSymbol> &SymbolList) {
|
||||
}
|
||||
}
|
||||
|
||||
-static void printLineNumbers(symbolize::LLVMSymbolizer &Symbolizer,
|
||||
- const NMSymbol &S) {
|
||||
- const auto *Obj = dyn_cast<ObjectFile>(S.Sym.getObject());
|
||||
- if (!Obj)
|
||||
- return;
|
||||
- const SymbolRef Sym(S.Sym);
|
||||
- uint64_t SectionIndex = object::SectionedAddress::UndefSection;
|
||||
- section_iterator Sec = cantFail(Sym.getSection());
|
||||
- if (Sec != Obj->section_end())
|
||||
- SectionIndex = Sec->getIndex();
|
||||
- object::SectionedAddress Address = {cantFail(Sym.getAddress()), SectionIndex};
|
||||
-
|
||||
- std::string FileName;
|
||||
- uint32_t Line;
|
||||
- switch (S.TypeChar) {
|
||||
- // For undefined symbols, find the first relocation for that symbol with a
|
||||
- // line number.
|
||||
- case 'U': {
|
||||
- for (const SectionRef RelocsSec : Obj->sections()) {
|
||||
- if (RelocsSec.relocations().empty())
|
||||
- continue;
|
||||
- SectionRef TextSec = *cantFail(RelocsSec.getRelocatedSection());
|
||||
- if (!TextSec.isText())
|
||||
- continue;
|
||||
- for (const RelocationRef R : RelocsSec.relocations()) {
|
||||
- if (R.getSymbol() != Sym)
|
||||
- continue;
|
||||
- Expected<DILineInfo> ResOrErr = Symbolizer.symbolizeCode(
|
||||
- *Obj, {TextSec.getAddress() + R.getOffset(), SectionIndex});
|
||||
- if (!ResOrErr) {
|
||||
- error(ResOrErr.takeError(), Obj->getFileName());
|
||||
- return;
|
||||
- }
|
||||
- if (ResOrErr->FileName == DILineInfo::BadString)
|
||||
- return;
|
||||
- FileName = std::move(ResOrErr->FileName);
|
||||
- Line = ResOrErr->Line;
|
||||
- break;
|
||||
- }
|
||||
- if (!FileName.empty())
|
||||
- break;
|
||||
- }
|
||||
- if (FileName.empty())
|
||||
- return;
|
||||
- break;
|
||||
- }
|
||||
- case 't':
|
||||
- case 'T': {
|
||||
- Expected<DILineInfo> ResOrErr = Symbolizer.symbolizeCode(*Obj, Address);
|
||||
- if (!ResOrErr) {
|
||||
- error(ResOrErr.takeError(), Obj->getFileName());
|
||||
- return;
|
||||
- }
|
||||
- if (ResOrErr->FileName == DILineInfo::BadString)
|
||||
- return;
|
||||
- FileName = std::move(ResOrErr->FileName);
|
||||
- Line = ResOrErr->Line;
|
||||
- break;
|
||||
- }
|
||||
- default: {
|
||||
- Expected<DIGlobal> ResOrErr = Symbolizer.symbolizeData(*Obj, Address);
|
||||
- if (!ResOrErr) {
|
||||
- error(ResOrErr.takeError(), Obj->getFileName());
|
||||
- return;
|
||||
- }
|
||||
- if (ResOrErr->DeclFile.empty())
|
||||
- return;
|
||||
- FileName = std::move(ResOrErr->DeclFile);
|
||||
- Line = ResOrErr->DeclLine;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- outs() << '\t' << FileName << ':' << Line;
|
||||
-}
|
||||
-
|
||||
static void printSymbolList(SymbolicFile &Obj,
|
||||
std::vector<NMSymbol> &SymbolList, bool printName,
|
||||
StringRef ArchiveName, StringRef ArchitectureName) {
|
||||
- std::optional<symbolize::LLVMSymbolizer> Symbolizer;
|
||||
- if (LineNumbers)
|
||||
- Symbolizer.emplace();
|
||||
-
|
||||
if (!PrintFileName) {
|
||||
if ((OutputFormat == bsd || OutputFormat == posix ||
|
||||
OutputFormat == just_symbols) &&
|
||||
@@ -877,7 +798,7 @@ static void printSymbolList(SymbolicFile &Obj,
|
||||
printFormat);
|
||||
} else if (OutputFormat == posix) {
|
||||
outs() << Name << " " << S.TypeChar << " " << SymbolAddrStr << " "
|
||||
- << (MachO ? "0" : SymbolSizeStr);
|
||||
+ << (MachO ? "0" : SymbolSizeStr) << "\n";
|
||||
} else if (OutputFormat == bsd || (OutputFormat == darwin && !MachO)) {
|
||||
if (PrintAddress)
|
||||
outs() << SymbolAddrStr << ' ';
|
||||
@@ -898,14 +819,12 @@ static void printSymbolList(SymbolicFile &Obj,
|
||||
} else
|
||||
outs() << S.IndirectName << ")";
|
||||
}
|
||||
+ outs() << "\n";
|
||||
} else if (OutputFormat == sysv) {
|
||||
outs() << left_justify(Name, 20) << "|" << SymbolAddrStr << "| "
|
||||
<< S.TypeChar << " |" << right_justify(S.TypeName, 18) << "|"
|
||||
- << SymbolSizeStr << "| |" << S.SectionName;
|
||||
+ << SymbolSizeStr << "| |" << S.SectionName << "\n";
|
||||
}
|
||||
- if (LineNumbers)
|
||||
- printLineNumbers(*Symbolizer, S);
|
||||
- outs() << '\n';
|
||||
}
|
||||
|
||||
SymbolList.clear();
|
||||
@@ -2496,7 +2415,6 @@ int llvm_nm_main(int argc, char **argv, const llvm::ToolContext &) {
|
||||
else
|
||||
error("--format value should be one of: bsd, posix, sysv, darwin, "
|
||||
"just-symbols");
|
||||
- LineNumbers = Args.hasArg(OPT_line_numbers);
|
||||
NoLLVMBitcode = Args.hasArg(OPT_no_llvm_bc);
|
||||
NoSort = Args.hasArg(OPT_no_sort);
|
||||
NoWeakSymbols = Args.hasArg(OPT_no_weak);
|
||||
--
|
||||
2.41.0.3.g1cb8d410ac
|
||||
|
@ -0,0 +1,63 @@
|
||||
From be338a0b7be5040a7814d10d424f1555604cce7c Mon Sep 17 00:00:00 2001
|
||||
From: Mike Hommey <mh@glandium.org>
|
||||
Date: Wed, 20 Sep 2023 10:08:21 +0900
|
||||
Subject: [PATCH 2/3] Revert "Explicitly set triple on line-numbers.test"
|
||||
|
||||
This reverts commit b88cffeafd393d54f85feb641c4f8fd4fdb73fe4 because it
|
||||
depends on c649f29c24c9fc1502d8d53e0c96c3d24b31de1a which we revert.
|
||||
---
|
||||
llvm/test/tools/llvm-nm/X86/line-numbers.test | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/llvm/test/tools/llvm-nm/X86/line-numbers.test b/llvm/test/tools/llvm-nm/X86/line-numbers.test
|
||||
index 4acda8afb2a4..4b9817ab5c62 100644
|
||||
--- a/llvm/test/tools/llvm-nm/X86/line-numbers.test
|
||||
+++ b/llvm/test/tools/llvm-nm/X86/line-numbers.test
|
||||
@@ -18,7 +18,7 @@
|
||||
## of main.o.
|
||||
# RUN: rm -rf %t
|
||||
# RUN: split-file %s %t
|
||||
-# RUN: llvm-mc -g --filetype=obj -triple=x86_64-pc-linux %t/main.s -o %t/main.o
|
||||
+# RUN: llvm-mc -g --filetype=obj %t/main.s -o %t/main.o
|
||||
# RUN: llvm-nm -l %t/main.o | FileCheck %s --match-full-lines --implicit-check-not={{.}}
|
||||
# RUN: llvm-nm --line-numbers %t/main.o | FileCheck %s --match-full-lines --implicit-check-not={{.}}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
## Check that in the absence of DWARF in the whole object, no line number
|
||||
## information is printed.
|
||||
-# RUN: llvm-mc --filetype=obj %t/main.s -triple=x86_64-pc-linux -o %t/no-dwarf.o
|
||||
+# RUN: llvm-mc --filetype=obj %t/main.s -o %t/no-dwarf.o
|
||||
# RUN: llvm-nm -l %t/no-dwarf.o | FileCheck %s --check-prefix=NO-DWARF --match-full-lines --implicit-check-not={{.}}
|
||||
|
||||
# NO-DWARF: 0000000000001234 a absolute_symbol
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
## Check that printing line numbers for undefined values is not attempted in
|
||||
## the absence of any relocation section.
|
||||
-# RUN: llvm-mc --filetype=obj %t/undef-no-reloc-sections.s -triple=x86_64-pc-linux -o %t/undef-no-reloc-sections.o
|
||||
+# RUN: llvm-mc --filetype=obj %t/undef-no-reloc-sections.s -o %t/undef-no-reloc-sections.o
|
||||
# RUN: llvm-nm --line-numbers %t/undef-no-reloc-sections.o | FileCheck %s --check-prefix=UNDEF-NO-RELOC-SECTIONS --match-full-lines --implicit-check-not={{.}}
|
||||
|
||||
# UNDEF-NO-RELOC-SECTIONS: U undef
|
||||
@@ -57,7 +57,7 @@
|
||||
## Check that printing line numbers for undefined values does not include
|
||||
## relocations for non-text sections. This is broken out of main.s to ensure
|
||||
## that the data relocation for undef comes first.
|
||||
-# RUN: llvm-mc -g --filetype=obj %t/undef-data-reloc.s -triple=x86_64-pc-linux -o %t/undef-data-reloc.o
|
||||
+# RUN: llvm-mc -g --filetype=obj %t/undef-data-reloc.s -o %t/undef-data-reloc.o
|
||||
# RUN: llvm-nm --line-numbers %t/undef-data-reloc.o | FileCheck %s --check-prefix=UNDEF-DATA-RELOC --match-full-lines --implicit-check-not={{.}}
|
||||
|
||||
# UNDEF-DATA-RELOC: 0000000000000000 r data_reloc
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
## Check that line numbers can be printed for data definitions. These are broken
|
||||
## out of main.s since their DWARF cannot be generated with llvm-mc -g.
|
||||
-# RUN: llvm-mc -g --filetype=obj %t/data-dwarf.s -triple=x86_64-pc-linux -o %t/data-dwarf.o
|
||||
+# RUN: llvm-mc -g --filetype=obj %t/data-dwarf.s -o %t/data-dwarf.o
|
||||
# RUN: llvm-nm --line-numbers %t/data-dwarf.o | FileCheck %s --check-prefix=DATA-DWARF --match-full-lines --implicit-check-not={{.}}
|
||||
|
||||
# DATA-DWARF: 0000000000000000 D defined_data /tmp/tmp.c:1
|
||||
--
|
||||
2.41.0.3.g1cb8d410ac
|
||||
|
@ -0,0 +1,28 @@
|
||||
From 9d81bf8d2e457540b8bd93859baef79a043c8482 Mon Sep 17 00:00:00 2001
|
||||
From: Mike Hommey <mh@glandium.org>
|
||||
Date: Wed, 20 Sep 2023 10:08:13 +0900
|
||||
Subject: [PATCH 1/3] Revert "Fix test added in D150987 to account for
|
||||
different path separators which was causing the test to fail on Windows."
|
||||
|
||||
This reverts commit 2baf4a06ef06c51c2ef09f981f204983b0f8082c because it
|
||||
depends on c649f29c24c9fc1502d8d53e0c96c3d24b31de1a which we revert.
|
||||
---
|
||||
llvm/test/tools/llvm-nm/X86/line-numbers.test | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/llvm/test/tools/llvm-nm/X86/line-numbers.test b/llvm/test/tools/llvm-nm/X86/line-numbers.test
|
||||
index e254df67f955..4acda8afb2a4 100644
|
||||
--- a/llvm/test/tools/llvm-nm/X86/line-numbers.test
|
||||
+++ b/llvm/test/tools/llvm-nm/X86/line-numbers.test
|
||||
@@ -68,7 +68,7 @@
|
||||
# RUN: llvm-mc -g --filetype=obj %t/data-dwarf.s -triple=x86_64-pc-linux -o %t/data-dwarf.o
|
||||
# RUN: llvm-nm --line-numbers %t/data-dwarf.o | FileCheck %s --check-prefix=DATA-DWARF --match-full-lines --implicit-check-not={{.}}
|
||||
|
||||
-# DATA-DWARF: 0000000000000000 D defined_data /tmp{{\\|/}}tmp.c:1
|
||||
+# DATA-DWARF: 0000000000000000 D defined_data /tmp/tmp.c:1
|
||||
|
||||
#--- main.s
|
||||
.text
|
||||
--
|
||||
2.41.0.3.g1cb8d410ac
|
||||
|
Loading…
Reference in New Issue
Block a user