Skip to content

Commit 1ad249b

Browse files
Merge pull request #8429 from rastogishubham/FourByteMCCAS
Add support for 32 bit Addresses in MCCAS debug info
2 parents 4d3f797 + e816c76 commit 1ad249b

File tree

8 files changed

+190
-45
lines changed

8 files changed

+190
-45
lines changed

llvm/include/llvm/MC/MCMachOCASWriter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class MachOCASWriter : public MCObjectWriter {
5555
std::optional<MCTargetOptions::ResultCallBackTy> CallBack,
5656
raw_pwrite_stream *CasIDOS = nullptr);
5757

58+
uint8_t getAddressSize() { return Target.isArch32Bit() ? 4 : 8; }
59+
5860
void recordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
5961
const MCFragment *Fragment, const MCFixup &Fixup,
6062
MCValue Target, uint64_t &FixedValue) override {

llvm/include/llvm/MCCAS/MCCASObjectV1.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,8 @@ class MCCASReader {
639639

640640
Triple::ArchType getArch() { return Target.getArch(); }
641641

642+
uint8_t getAddressSize() { return Target.isArch32Bit() ? 4 : 8; }
643+
642644
Expected<uint64_t> materializeGroup(cas::ObjectRef ID);
643645
Expected<uint64_t> materializeDebugAbbrevUnopt(ArrayRef<cas::ObjectRef> Refs);
644646
Expected<uint64_t> materializeSection(cas::ObjectRef ID, raw_ostream *Stream);
@@ -740,7 +742,7 @@ Error visitDebugInfo(
740742
std::function<void(dwarf::Tag, uint64_t)> StartTagCallback,
741743
std::function<void(dwarf::Attribute, dwarf::Form, StringRef, bool)>
742744
AttrCallback,
743-
std::function<void(bool)> EndTagCallback,
745+
std::function<void(bool)> EndTagCallback, uint8_t AddressSize,
744746
std::function<void(StringRef)> NewBlockCallback = [](StringRef) {});
745747

746748
} // namespace v1

llvm/lib/MCCAS/MCCASObjectV1.cpp

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ static Error materializeDebugInfoOpt(MCCASReader &Reader,
505505
StringRef FormData, bool) {
506506
if (Form == dwarf::Form::DW_FORM_ref4_cas ||
507507
Form == dwarf::Form::DW_FORM_strp_cas) {
508-
DataExtractor Extractor(FormData, true, 8);
508+
DataExtractor Extractor(FormData, true, Reader.getAddressSize());
509509
DataExtractor::Cursor Cursor(0);
510510
uint64_t Data64 = Extractor.getULEB128(Cursor);
511511
if (!Cursor)
@@ -529,7 +529,7 @@ static Error materializeDebugInfoOpt(MCCASReader &Reader,
529529

530530
if (auto E = visitDebugInfo(TotAbbrevEntries, std::move(MaybeTopRef),
531531
HeaderCallback, StartTagCallback, AttrCallback,
532-
EndTagCallback))
532+
EndTagCallback, Reader.getAddressSize()))
533533
return E;
534534
}
535535
return Error::success();
@@ -826,10 +826,11 @@ getLineTableLengthInfoAndVersion(DWARFDataExtractor &LineTableDataReader,
826826
auto AddressSize = LineTableDataReader.getU8(OffsetPtr, &Err);
827827
if (Err)
828828
return std::move(Err);
829-
if (AddressSize != 8)
829+
if (AddressSize != LineTableDataReader.getAddressSize())
830830
return createStringError(
831831
inconvertibleErrorCode(),
832-
"Address size is not 8 bytes, unsupported architecture for MCCAS!");
832+
"Address size in line table header is not the same as Address size "
833+
"for the target architecture, something went really wrong!");
833834
LineTableDataReader.getU8(OffsetPtr, &Err);
834835
if (Err)
835836
return std::move(Err);
@@ -956,9 +957,12 @@ handleStandardOpcodesForLineTable(DWARFDataExtractor &LineTableDataReader,
956957
static Expected<std::pair<uint64_t, uint64_t>>
957958
getOpcodeAndOperandSize(StringRef DistinctData, StringRef LineTableData,
958959
uint64_t DistinctOffset, uint64_t LineTableOffset,
959-
bool IsLittleEndian, uint8_t OpcodeBase) {
960-
DWARFDataExtractor LineTableDataReader(LineTableData, IsLittleEndian, 8);
961-
DWARFDataExtractor DistinctDataReader(DistinctData, IsLittleEndian, 8);
960+
bool IsLittleEndian, uint8_t OpcodeBase,
961+
uint8_t AddressSize) {
962+
DWARFDataExtractor LineTableDataReader(LineTableData, IsLittleEndian,
963+
AddressSize);
964+
DWARFDataExtractor DistinctDataReader(DistinctData, IsLittleEndian,
965+
AddressSize);
962966
DWARFDataExtractor::Cursor LineTableCursor(LineTableOffset);
963967
DWARFDataExtractor::Cursor DistinctCursor(DistinctOffset);
964968

@@ -1064,7 +1068,8 @@ materializeDebugLineSection(MCCASReader &Reader,
10641068
DistinctDebugLineRefSeen = true;
10651069
auto Data = DistinctRef->getData();
10661070
DistinctData.append(Data.begin(), Data.end());
1067-
DWARFDataExtractor LineTableDataReader(Data, Reader.getEndian(), 8);
1071+
DWARFDataExtractor LineTableDataReader(Data, Reader.getEndian(),
1072+
Reader.getAddressSize());
10681073
auto Prologue = parseLineTableHeaderAndSkip(LineTableDataReader);
10691074
if (!Prologue)
10701075
return Prologue.takeError();
@@ -1084,9 +1089,9 @@ materializeDebugLineSection(MCCASReader &Reader,
10841089
auto Data = LineRef->getData();
10851090
uint64_t LineTableOffset = 0;
10861091
while (LineTableOffset < Data.size()) {
1087-
auto Sizes = getOpcodeAndOperandSize(toStringRef(DistinctData), Data,
1088-
DistinctOffset, LineTableOffset,
1089-
Reader.getEndian(), OpcodeBase);
1092+
auto Sizes = getOpcodeAndOperandSize(
1093+
toStringRef(DistinctData), Data, DistinctOffset, LineTableOffset,
1094+
Reader.getEndian(), OpcodeBase, Reader.getAddressSize());
10901095
if (!Sizes)
10911096
return Sizes.takeError();
10921097
// Copy opcode and operand, only in the case of DW_LNS_set_file, the
@@ -1725,12 +1730,11 @@ static Expected<size_t> getSizeFromDwarfHeader(DataExtractor &Extractor,
17251730
/// contained in CUData, as well as the total number of bytes taken by the CU.
17261731
/// Note: this is different from the length field of the Dwarf header, which
17271732
/// does not account for the header size.
1728-
static Expected<CUInfo>
1729-
getAndSetDebugAbbrevOffsetAndSkip(MutableArrayRef<char> CUData,
1730-
support::endianness Endian,
1731-
std::optional<uint32_t> NewOffset) {
1733+
static Expected<CUInfo> getAndSetDebugAbbrevOffsetAndSkip(
1734+
MutableArrayRef<char> CUData, support::endianness Endian,
1735+
std::optional<uint32_t> NewOffset, uint8_t AddressSize) {
17321736
DataExtractor Extractor(toStringRef(CUData),
1733-
Endian == support::endianness::little, 8);
1737+
Endian == support::endianness::little, AddressSize);
17341738
DataExtractor::Cursor Cursor(0);
17351739
Expected<size_t> Size = getSizeFromDwarfHeader(Extractor, Cursor);
17361740
if (!Size)
@@ -1754,13 +1758,14 @@ getAndSetDebugAbbrevOffsetAndSkip(MutableArrayRef<char> CUData,
17541758
return createStringError(
17551759
inconvertibleErrorCode(),
17561760
"Unit type is not DW_UT_compile, and is incompatible with MCCAS!");
1757-
uint8_t AddressSize = Extractor.getU8(Cursor);
1761+
uint8_t HeaderAddressSize = Extractor.getU8(Cursor);
17581762
if (!Cursor)
17591763
return Cursor.takeError();
1760-
if (AddressSize != 8)
1764+
if (HeaderAddressSize != AddressSize)
17611765
return createStringError(
17621766
inconvertibleErrorCode(),
1763-
"Address size is not 8 bytes, unsupported architecture for MCCAS!");
1767+
"Address size in Compile Unit header is not the same as Address size "
1768+
"for the target architecture, something went really wrong!");
17641769
}
17651770

17661771
// TODO: Handle Dwarf 64 format, which uses 8 bytes.
@@ -1815,7 +1820,8 @@ MCCASBuilder::splitDebugInfoSectionData(MutableArrayRef<char> DebugInfoData) {
18151820
// CU splitting loop.
18161821
while (!DebugInfoData.empty()) {
18171822
Expected<CUInfo> Info = getAndSetDebugAbbrevOffsetAndSkip(
1818-
DebugInfoData, Asm.getBackend().Endian, /*NewOffset*/ 0);
1823+
DebugInfoData, Asm.getBackend().Endian, /*NewOffset*/ 0,
1824+
ObjectWriter.getAddressSize());
18191825
if (!Info)
18201826
return Info.takeError();
18211827
Split.SplitCUData.push_back(DebugInfoData.take_front(Info->CUSize));
@@ -1981,12 +1987,15 @@ Error InMemoryCASDWARFObject::partitionCUData(ArrayRef<char> DebugInfoData,
19811987
uint16_t DwarfVersion) {
19821988
StringRef AbbrevSectionContribution =
19831989
getAbbrevSection().drop_front(AbbrevOffset);
1984-
DataExtractor Data(AbbrevSectionContribution, isLittleEndian(), 8);
1990+
DataExtractor Data(AbbrevSectionContribution, isLittleEndian(),
1991+
Builder.ObjectWriter.getAddressSize());
19851992
DWARFDebugAbbrev Abbrev(Data);
19861993
uint64_t OffsetPtr = 0;
19871994
DWARFUnitHeader Header;
19881995
DWARFSection Section = {toStringRef(DebugInfoData), 0 /*Address*/};
1989-
Header.extract(*Ctx, DWARFDataExtractor(*this, Section, isLittleEndian(), 8),
1996+
Header.extract(*Ctx,
1997+
DWARFDataExtractor(*this, Section, isLittleEndian(),
1998+
Builder.ObjectWriter.getAddressSize()),
19901999
&OffsetPtr, DWARFSectionKind::DW_SECT_INFO);
19912000

19922001
DWARFUnitVector UV;
@@ -2084,8 +2093,8 @@ inline void copyData(SmallVector<char, 0> &Data, StringRef DebugLineStrRef,
20842093

20852094
Expected<uint64_t>
20862095
MCCASBuilder::createOptimizedLineSection(StringRef DebugLineStrRef) {
2087-
DWARFDataExtractor LineTableDataReader(DebugLineStrRef,
2088-
Asm.getBackend().Endian, 8);
2096+
DWARFDataExtractor LineTableDataReader(
2097+
DebugLineStrRef, Asm.getBackend().Endian, ObjectWriter.getAddressSize());
20892098
auto Prologue = parseLineTableHeaderAndSkip(LineTableDataReader);
20902099
if (!Prologue)
20912100
return Prologue.takeError();
@@ -3127,20 +3136,19 @@ Error DIEVisitor::visitDIEAttrs(DataExtractor &Extractor,
31273136
StringRef DIEData,
31283137
ArrayRef<AbbrevContent> DIEContents) {
31293138
constexpr auto IsLittleEndian = true;
3130-
constexpr auto AddrSize = 8;
3131-
auto FormParams =
3132-
dwarf::FormParams{DwarfVersion, AddrSize, dwarf::DwarfFormat::DWARF32};
3139+
auto FormParams = dwarf::FormParams{DwarfVersion, Extractor.getAddressSize(),
3140+
dwarf::DwarfFormat::DWARF32};
31333141

31343142
for (auto Contents : DIEContents) {
31353143
bool DataInDistinct = Contents.FormInDistinctData;
31363144
auto &ExtractorForData = DataInDistinct ? DistinctExtractor : Extractor;
31373145
auto &CursorForData = DataInDistinct ? DistinctCursor : Cursor;
31383146
StringRef DataToUse = DataInDistinct ? DistinctData : DIEData;
31393147
Expected<uint64_t> FormSize =
3140-
Contents.FormSize
3141-
? *Contents.FormSize
3142-
: getFormSize(Contents.Form, FormParams, DataToUse,
3143-
CursorForData.tell(), IsLittleEndian, AddrSize);
3148+
Contents.FormSize ? *Contents.FormSize
3149+
: getFormSize(Contents.Form, FormParams, DataToUse,
3150+
CursorForData.tell(), IsLittleEndian,
3151+
Extractor.getAddressSize());
31443152
if (!FormSize)
31453153
return FormSize.takeError();
31463154

@@ -3241,9 +3249,9 @@ static std::optional<uint8_t> getNonULEBFormSize(dwarf::Form Form,
32413249
}
32423250

32433251
Error DIEVisitor::materializeAbbrevDIE(unsigned AbbrevIdx) {
3244-
constexpr auto AddrSize = 8;
32453252
auto FormParams =
3246-
dwarf::FormParams{DwarfVersion, AddrSize, dwarf::DwarfFormat::DWARF32};
3253+
dwarf::FormParams{DwarfVersion, DistinctExtractor.getAddressSize(),
3254+
dwarf::DwarfFormat::DWARF32};
32473255

32483256
AbbrevEntryReader AbbrevReader =
32493257
getAbbrevEntryReader(AbbrevEntries, AbbrevIdx);
@@ -3281,9 +3289,10 @@ Error DIEVisitor::materializeAbbrevDIE(unsigned AbbrevIdx) {
32813289
/// previous stack frame.
32823290
static void popStack(DataExtractor &Extractor, DataExtractor::Cursor &Cursor,
32833291
StringRef &Data,
3284-
std::stack<std::pair<StringRef, unsigned>> &StackOfNodes) {
3292+
std::stack<std::pair<StringRef, unsigned>> &StackOfNodes,
3293+
uint8_t AddressSize) {
32853294
auto DataAndOffset = StackOfNodes.top();
3286-
Extractor = DataExtractor(DataAndOffset.first, true, 8);
3295+
Extractor = DataExtractor(DataAndOffset.first, true, AddressSize);
32873296
Data = DataAndOffset.first;
32883297
Cursor.seek(DataAndOffset.second);
32893298
StackOfNodes.pop();
@@ -3299,7 +3308,7 @@ Error DIEVisitor::visitDIERef(ArrayRef<DIEDataRef> &DIEChildrenStack) {
32993308
std::stack<std::pair<StringRef, unsigned>> StackOfNodes;
33003309
auto Data = DIEChildrenStack.empty() ? StringRef()
33013310
: DIEChildrenStack.front().getData();
3302-
DataExtractor Extractor(Data, true, 8);
3311+
DataExtractor Extractor(Data, true, DistinctExtractor.getAddressSize());
33033312
DataExtractor::Cursor Cursor(0);
33043313

33053314
while (!DistinctExtractor.eof(DistinctCursor)) {
@@ -3316,7 +3325,8 @@ Error DIEVisitor::visitDIERef(ArrayRef<DIEDataRef> &DIEChildrenStack) {
33163325
if (AbbrevIdx == getEndOfDIESiblingsMarker()) {
33173326
EndTagCallback(true /*HadChildren*/);
33183327
if (!StackOfNodes.empty() && Extractor.eof(Cursor))
3319-
popStack(Extractor, Cursor, Data, StackOfNodes);
3328+
popStack(Extractor, Cursor, Data, StackOfNodes,
3329+
DistinctExtractor.getAddressSize());
33203330
continue;
33213331
}
33223332

@@ -3328,7 +3338,7 @@ Error DIEVisitor::visitDIERef(ArrayRef<DIEDataRef> &DIEChildrenStack) {
33283338
DIEChildrenStack = DIEChildrenStack.drop_front();
33293339
Data = DIEChildrenStack.front().getData();
33303340
NewBlockCallback(DIEChildrenStack.front().getID().toString());
3331-
Extractor = DataExtractor(Data, true, 8);
3341+
Extractor = DataExtractor(Data, true, DistinctExtractor.getAddressSize());
33323342
Cursor.seek(0);
33333343
continue;
33343344
}
@@ -3347,7 +3357,8 @@ Error DIEVisitor::visitDIERef(ArrayRef<DIEDataRef> &DIEChildrenStack) {
33473357
// parent's siblings that may exist.
33483358
if (!AbbrevEntryCacheVal.HasChildren) {
33493359
if (!StackOfNodes.empty() && Extractor.eof(Cursor))
3350-
popStack(Extractor, Cursor, Data, StackOfNodes);
3360+
popStack(Extractor, Cursor, Data, StackOfNodes,
3361+
DistinctExtractor.getAddressSize());
33513362
EndTagCallback(false /*HadChildren*/);
33523363
}
33533364
}
@@ -3387,7 +3398,7 @@ Error mccasformats::v1::visitDebugInfo(
33873398
std::function<void(dwarf::Tag, uint64_t)> StartTagCallback,
33883399
std::function<void(dwarf::Attribute, dwarf::Form, StringRef, bool)>
33893400
AttrCallback,
3390-
std::function<void(bool)> EndTagCallback,
3401+
std::function<void(bool)> EndTagCallback, uint8_t AddressSize,
33913402
std::function<void(StringRef)> NewBlockCallback) {
33923403

33933404
Expected<LoadedDIETopLevel> LoadedTopRef =
@@ -3406,7 +3417,7 @@ Error mccasformats::v1::visitDebugInfo(
34063417
return E;
34073418
DistinctData = toStringRef(OutBuff);
34083419
#endif
3409-
DataExtractor DistinctExtractor(DistinctData, true, 8);
3420+
DataExtractor DistinctExtractor(DistinctData, true, AddressSize);
34103421
DataExtractor::Cursor DistinctCursor(0);
34113422

34123423
auto Size = getSizeFromDwarfHeader(DistinctExtractor, DistinctCursor);

llvm/test/CAS/armv7-cas-dwarf5.ll

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
; RUN: rm -rf %t && mkdir -p %t
2+
; RUN: llc --filetype=obj --mccas-verify --cas-backend --cas=%t/cas %s -o %t/watchos-cas-dwarf5.o
3+
; RUN: llvm-dwarfdump %t/watchos-cas-dwarf5.o | FileCheck %s
4+
; CHECK: .debug_info contents:
5+
; CHECK-NEXT: 0x{{[0-9a-f]+}}: Compile Unit: length = 0x{{[0-9a-f]+}}, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x04
6+
; REQUIRES: arm-registered-target
7+
8+
; ModuleID = '/tmp/a.cpp'
9+
source_filename = "/tmp/a.cpp"
10+
target datalayout = "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
11+
target triple = "thumbv7-apple-ios5.0.0"
12+
13+
@a = global i32 0, align 4, !dbg !0
14+
15+
!llvm.dbg.cu = !{!2}
16+
!llvm.module.flags = !{!7, !8, !9, !10, !11, !12}
17+
!llvm.ident = !{!13}
18+
19+
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
20+
!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !5, line: 1, type: !6, isLocal: false, isDefinition: true)
21+
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 19.0.0git ([email protected]:apple/llvm-project.git 6fa917db4566cab002b856a66e8ebba16f0e20a4)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/")
22+
!3 = !DIFile(filename: "/tmp/a.cpp", directory: "/Users/shubham/Development/llvm-project-cas/llvm-project/build_ninja", checksumkind: CSK_MD5, checksum: "5b8ff0b44df608b9bb47431c2b46f6ce")
23+
!4 = !{!0}
24+
!5 = !DIFile(filename: "/tmp/a.cpp", directory: "", checksumkind: CSK_MD5, checksum: "5b8ff0b44df608b9bb47431c2b46f6ce")
25+
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
26+
!7 = !{i32 7, !"Dwarf Version", i32 5}
27+
!8 = !{i32 2, !"Debug Info Version", i32 3}
28+
!9 = !{i32 1, !"wchar_size", i32 4}
29+
!10 = !{i32 1, !"min_enum_size", i32 4}
30+
!11 = !{i32 8, !"PIC Level", i32 2}
31+
!12 = !{i32 7, !"frame-pointer", i32 2}
32+
!13 = !{!"clang version 19.0.0git ([email protected]:apple/llvm-project.git 6fa917db4566cab002b856a66e8ebba16f0e20a4)"}

llvm/test/CAS/armv7-cas.ll

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
; RUN: rm -rf %t && mkdir -p %t
2+
; RUN: llc --filetype=obj --mccas-verify --cas-backend --cas=%t/cas %s -o %t/watchos-cas.o
3+
; RUN: llvm-dwarfdump %t/watchos-cas.o | FileCheck %s
4+
; CHECK: .debug_info contents:
5+
; CHECK-NEXT: 0x{{[0-9a-f]+}}: Compile Unit: length = 0x{{[0-9a-f]+}}, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x04
6+
; REQUIRES: arm-registered-target
7+
8+
; ModuleID = '/tmp/a.cpp'
9+
source_filename = "/tmp/a.cpp"
10+
target datalayout = "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
11+
target triple = "thumbv7-apple-ios5.0.0"
12+
13+
@a = global i32 0, align 4, !dbg !0
14+
15+
!llvm.dbg.cu = !{!2}
16+
!llvm.module.flags = !{!7, !8, !9, !10, !11, !12}
17+
!llvm.ident = !{!13}
18+
19+
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
20+
!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !5, line: 1, type: !6, isLocal: false, isDefinition: true)
21+
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 19.0.0git ([email protected]:apple/llvm-project.git 6fa917db4566cab002b856a66e8ebba16f0e20a4)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/")
22+
!3 = !DIFile(filename: "/tmp/a.cpp", directory: "/Users/shubham/Development/llvm-project-cas/llvm-project/build_ninja")
23+
!4 = !{!0}
24+
!5 = !DIFile(filename: "/tmp/a.cpp", directory: "")
25+
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
26+
!7 = !{i32 7, !"Dwarf Version", i32 4}
27+
!8 = !{i32 2, !"Debug Info Version", i32 3}
28+
!9 = !{i32 1, !"wchar_size", i32 4}
29+
!10 = !{i32 1, !"min_enum_size", i32 4}
30+
!11 = !{i32 8, !"PIC Level", i32 2}
31+
!12 = !{i32 7, !"frame-pointer", i32 2}
32+
!13 = !{!"clang version 19.0.0git ([email protected]:apple/llvm-project.git 6fa917db4566cab002b856a66e8ebba16f0e20a4)"}

llvm/test/CAS/watchos-cas-dwarf5.ll

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
; RUN: rm -rf %t && mkdir -p %t
2+
; RUN: llc --filetype=obj --mccas-verify --cas-backend --cas=%t/cas %s -o %t/watchos-cas-dwarf5.o
3+
; RUN: llvm-dwarfdump %t/watchos-cas-dwarf5.o | FileCheck %s
4+
; CHECK: .debug_info contents:
5+
; CHECK-NEXT: 0x{{[0-9a-f]+}}: Compile Unit: length = 0x{{[0-9a-f]+}}, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x04
6+
; REQUIRES: arm-registered-target
7+
8+
; ModuleID = '/tmp/a.cpp'
9+
source_filename = "/tmp/a.cpp"
10+
target datalayout = "e-m:o-p:32:32-i64:64-i128:128-n32:64-S128"
11+
target triple = "arm64_32-apple-watchos11.0.0"
12+
13+
@a = global i32 0, align 4, !dbg !0
14+
15+
!llvm.dbg.cu = !{!2}
16+
!llvm.module.flags = !{!7, !8, !9, !10, !11, !12}
17+
!llvm.ident = !{!13}
18+
19+
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
20+
!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !5, line: 1, type: !6, isLocal: false, isDefinition: true)
21+
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 19.0.0git ([email protected]:apple/llvm-project.git eb2f92059e91645250d108b3331cc28243aeadbc)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/")
22+
!3 = !DIFile(filename: "/tmp/a.cpp", directory: "/Users/shubham/Development/llvm-project-cas/llvm-project/build_ninja", checksumkind: CSK_MD5, checksum: "5b8ff0b44df608b9bb47431c2b46f6ce")
23+
!4 = !{!0}
24+
!5 = !DIFile(filename: "/tmp/a.cpp", directory: "", checksumkind: CSK_MD5, checksum: "5b8ff0b44df608b9bb47431c2b46f6ce")
25+
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
26+
!7 = !{i32 7, !"Dwarf Version", i32 5}
27+
!8 = !{i32 2, !"Debug Info Version", i32 3}
28+
!9 = !{i32 1, !"wchar_size", i32 4}
29+
!10 = !{i32 8, !"PIC Level", i32 2}
30+
!11 = !{i32 7, !"uwtable", i32 1}
31+
!12 = !{i32 7, !"frame-pointer", i32 1}
32+
!13 = !{!"clang version 19.0.0git ([email protected]:apple/llvm-project.git eb2f92059e91645250d108b3331cc28243aeadbc)"}

0 commit comments

Comments
 (0)