Skip to content

Commit 15ee1fb

Browse files
committed
[llvm-gsymutil] Don't warn about non-increasing line tables with merged functions
1 parent a261eee commit 15ee1fb

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

llvm/include/llvm/DebugInfo/GSYM/GsymCreator.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class GsymCreator {
147147
bool IsSegment = false;
148148
bool Finalized = false;
149149
bool Quiet;
150-
150+
bool UseMergedFuncs = false;
151151

152152
/// Get the first function start address.
153153
///
@@ -486,6 +486,9 @@ class GsymCreator {
486486
/// encode.
487487
llvm::Expected<std::unique_ptr<GsymCreator>>
488488
createSegment(uint64_t SegmentSize, size_t &FuncIdx) const;
489+
490+
bool getUseMergedFunctions() const { return UseMergedFuncs; }
491+
void setUseMergedFunctions(bool Enable) { UseMergedFuncs = Enable; }
489492
};
490493

491494
} // namespace gsym

llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static void convertFunctionLineTable(OutputAggregator &Out, CUInfo &CUI,
405405
OS << "warning: duplicate line table detected for DIE:\n";
406406
Die.dump(OS, 0, DIDumpOptions::getForSingleDIE());
407407
});
408-
else
408+
else if (!Gsym.getUseMergedFunctions())
409409
Out.Report("Non-monotonically increasing addresses",
410410
[&](raw_ostream &OS) {
411411
OS << "error: line table has addresses that do not "

llvm/lib/DebugInfo/GSYM/GsymCreator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ using namespace llvm;
2222
using namespace gsym;
2323

2424
GsymCreator::GsymCreator(bool Quiet)
25-
: StrTab(StringTableBuilder::ELF), Quiet(Quiet) {
25+
: StrTab(StringTableBuilder::ELF), Quiet(Quiet), UseMergedFuncs(false) {
2626
insertFile(StringRef());
2727
}
2828

llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
# RUN: split-file %s %t
44
# RUN: yaml2obj %t/merged_callsites.dSYM.yaml -o %t/merged_callsites.dSYM
55

6-
# RUN: llvm-gsymutil --convert=%t/merged_callsites.dSYM --merged-functions --callsites-yaml-file=%t/callsites.yaml -o %t/call_sites_dSYM.gsym
7-
# RUN: llvm-gsymutil --convert=%t/merged_callsites.dSYM --merged-functions --dwarf-callsites -o %t/dwarf_call_sites_dSYM.gsym
6+
# RUN: llvm-gsymutil --convert=%t/merged_callsites.dSYM --merged-functions --callsites-yaml-file=%t/callsites.yaml -o %t/call_sites_dSYM.gsym | FileCheck --check-prefix=CHECK-CONVERT %s
7+
# RUN: llvm-gsymutil --convert=%t/merged_callsites.dSYM --merged-functions --dwarf-callsites -o %t/dwarf_call_sites_dSYM.gsym | FileCheck --check-prefix=CHECK-CONVERT %s
88

99
# Dump the GSYM file and check the output for callsite information
1010
# RUN: llvm-gsymutil %t/call_sites_dSYM.gsym | FileCheck --check-prefix=CHECK-MERGED-CALLSITES %s
1111
# RUN: llvm-gsymutil %t/dwarf_call_sites_dSYM.gsym | FileCheck --check-prefix=CHECK-MERGED-CALLSITES %s
1212

13+
# CHECK-CONVERT-NOT: line table has addresses that do not monotonically increase
14+
# CHECK-CONVERT-NOT: Non-monotonically increasing addresses occurred
15+
1316
# CHECK-MERGED-CALLSITES: FunctionInfo @ 0x[[#%x,FUNC4_1:]]: [0x[[#%x,FUNC4_1_START:]] - 0x[[#%x,FUNC4_1_END:]]) "function4_copy1"
1417
# CHECK-MERGED-CALLSITES: ++ Merged FunctionInfos[0]:
1518
# CHECK-MERGED-CALLSITES-NEXT: [0x[[#%x,FUNC4_2_START:]] - 0x[[#%x,FUNC4_2_END:]]) "function4_copy2"

llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ static llvm::Error handleObjectFile(ObjectFile &Obj, const std::string &OutFile,
331331
NumThreads > 0 ? NumThreads : std::thread::hardware_concurrency();
332332

333333
GsymCreator Gsym(Quiet);
334+
Gsym.setUseMergedFunctions(UseMergedFunctions);
334335

335336
// See if we can figure out the base address for a given object file, and if
336337
// we can, then set the base address to use to this value. This will ease

0 commit comments

Comments
 (0)