Open llvmbot opened 10 years ago
mentioned in issue llvm/llvm-bugzilla-archive#25809
Bug llvm/llvm-bugzilla-archive#25809 has been marked as a duplicate of this bug.
I like the solution to part #1.
2 is a bit weird, why couldn't we just emit a new label for the contents of
the line section for each compile unit? i.e. there's no back label from line so we can just reference the label for the part of the section we care about.
because we don't print .debug_line, the assembler does. All that there is in the .s file is
.section .debug_line,"",@progbits
.Lsection_line: .section .debug_loc,"",@progbits ....
we need a directive that gives us the offset (like item 2 in the description) or a way to make the printing explicit, like
.section .debug_line,"",@progbits
.Lsection_line1: .debug_line_for_cu1 .Lsection_line2: .debug_line_for_cu2 .section .debug_loc,"",@progbits
I like the solution to part #1.
This is now the last use of hasRawTextSupport in all of llvm.
Extended Description
Using .file and .loc produces assembly files that a quiet a bit more readable. Unfortunately, using those we are currently not able to represent multiple compile units in one .s file. This means that the output we produce during LTO is different if emitting assembly or object files.
There are two problems
1) The .file directive can only be of the forms .file NUM PATH or .file NUM DIR PATH
2) The .debug_info section is still printed manually, and it needs an offset into the .debug_line section for DW_AT_stmt_list. With .loc we only know the offset of the first compilation unit (it is always 0).
A first idea on how to fix this
.file NUM DIR CU_NUM
not sure if there is value in accepting ".file NUM CU_NUM".
the meaning of having
.file 42 "bar" "foo" 2 .file 43 "bar foo" 3
is that entry number 42 is for compile unit 2 and entry 43 is for compile unit 3. Omitting the compile unit just means compile unit 0. The numbers passed to .file are still unique. That allows .loc to remain unchanged.
.offset_of_cu_in_debug_lines 0
instead of
.long .Lsection_line # DW_AT_stmt_list
and it would also work for the other compile units.