Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DWARF] Use ULEB128 and not just one byte for directory indices #109067

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ void DwarfStreamer::emitLineTablePrologueV5IncludeAndFileTable(
LineSectionSize += MS->emitULEB128IntValue(StrForm);

LineSectionSize += MS->emitULEB128IntValue(dwarf::DW_LNCT_directory_index);
LineSectionSize += MS->emitULEB128IntValue(dwarf::DW_FORM_data1);
LineSectionSize += MS->emitULEB128IntValue(dwarf::DW_FORM_udata);

if (HasChecksums) {
LineSectionSize += MS->emitULEB128IntValue(dwarf::DW_LNCT_MD5);
Expand All @@ -952,8 +952,7 @@ void DwarfStreamer::emitLineTablePrologueV5IncludeAndFileTable(
// file_names (sequence of file name entries).
for (auto File : P.FileNames) {
emitLineTableString(P, File.Name, DebugStrPool, DebugLineStrPool);
MS->emitInt8(File.DirIdx);
LineSectionSize += 1;
LineSectionSize += MS->emitULEB128IntValue(File.DirIdx);
if (HasChecksums) {
MS->emitBinaryData(
StringRef(reinterpret_cast<const char *>(File.Checksum.data()),
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/DWARFLinker/Parallel/DebugLineSectionEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class DebugLineSectionEmitter {
encodeULEB128(FileNameForm, Section.OS);

encodeULEB128(dwarf::DW_LNCT_directory_index, Section.OS);
encodeULEB128(dwarf::DW_FORM_data1, Section.OS);
encodeULEB128(dwarf::DW_FORM_udata, Section.OS);

if (HasChecksums) {
encodeULEB128(dwarf::DW_LNCT_MD5, Section.OS);
Expand All @@ -242,7 +242,7 @@ class DebugLineSectionEmitter {
// A null-terminated string containing the full or relative path name of a
// source file.
Section.emitString(FileNameForm, *FileNameStr);
Section.emitIntVal(File.DirIdx, 1);
encodeULEB128(File.DirIdx, Section.OS);

if (HasChecksums) {
assert((File.Checksum.size() == 16) &&
Expand Down
Loading
Loading