<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>>>There still exist another problem: <br>
</p>
<div style="color: rgb(33, 33, 33);">
<div>
<div>
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<div style="color:rgb(33,33,33)">
<div>
<div>
<div dir="ltr">>> DWARF4: "A range list entry (but not a base address selection or end of list entry) whose beginning and</div>
<div dir="ltr">>>ending addresses are equal has no effect because the size of the range covered by such
</div>
<div dir="ltr">>>an entry is zero."<br>
<br>
>>DWARF5: "A bounded range entry whose beginning and ending address offsets are equal<br>
>>(including zero) indicates an empty range and may be ignored."<br>
<br>
>>These rules allow us to ignore zero-length address ranges. I.e., some tool reading DWARF is permitted to ignore related DWARF entries.
</div>
</div>
</div>
</div>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<div style="color:rgb(33,33,33)">
<div>
<div></div>
</div>
</div>
</div>
</blockquote>
<div><br>
>I agree it allows consumers to ignore that entry in the range list because that entry is zero-length/equivalent to not being present at all - I don't think that >means consumers can ignore the DIE that refers to this range list. I think it's valid DWARF to
have a CU that only describes types, without any code attached >to it at all. Or for a subprogram that's been eliminated to still be used by a consumer for name lookup purposes - so the consumer can tell the user there is a >function called "f1" and tell the
user what parameter types, return type it has, etc - not ignore it entirely.</div>
<div><br>
</div>
<div>Probably it relies on interpretation. And then it would be good to clarify that question in the DWARF standard.
</div>
<div>I think there is a difference when CU does not relate to any address. And when it relates to invalid
</div>
<div>address(deleted code). Probably, these two situations should be handled differently: <br>
<br>
1. CU that only describes types without any code attached to it should not be ignored by the tools.<br>
2. CU that relates to the deleted code could be removed/ignored by the tools.<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<div style="color:rgb(33,33,33)">
<div>
<div></div>
</div>
</div>
</div>
</blockquote>
<div dir="ltr" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<div style="color:rgb(33,33,33)">
<div>
<div>
<div dir="ltr">>> In that case, there could be ignored essential descriptions. That problem could happen with -flto=thin
</div>
<div dir="ltr">>> example <a href="https://reviews.llvm.org/D54747#1503720" target="_blank">
https://reviews.llvm.org/D54747#1503720</a> . In this example, all type definitions except one were
</div>
<div dir="ltr">>> replaced with declarations by thinlto. The definition, which was left, is in a piece of debug info related to
</div>
<div dir="ltr">>> deleted code. According to zero-length rule, that definition could be ignored, and finally, incomplete debug
</div>
<div dir="ltr">>> info could be used.<br>
</div>
</div>
</div>
</div>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<div style="color:rgb(33,33,33)">
<div>
<div></div>
</div>
</div>
</div>
</blockquote>
<div><br>
> Yeah, I think the bug there is the linker dropping object files just because they have no exxecutable
</div>
<div>> code in them - I think the patch that did that was reverted, if I'm remembering correctly.<br>
</div>
<div>Right. The patch was reverted. But that problem is actual for any tool which tries to remove debug
</div>
<div>info related to garbage collected code. For example, that problem exists for dsymutil:<br>
<br>
$ cat a.cpp<br>
int f();<br>
int main() {<br>
return f();<br>
}<br>
<br>
$ cat b.cpp<br>
struct Foo {<br>
int x, y;<br>
};<br>
int f() {<br>
volatile Foo var;<br>
var.x = 13;<br>
var.y = 42;<br>
return var.x + var.y;<br>
}<br>
<br>
$ clang++ a.cpp b.cpp -O -g -flto=thin -Wl,-dead_strip<br>
$ dsymutil a.out<br>
$ llvm-dwarfdump -a a.out.dSYM/Contents/Resources/DWARF/a.out | grep Foo<br>
DW_AT_type (0x00000000000000b1 "volatile Foo")<br>
DW_AT_type (0x00000000000000b6 "Foo")<br>
DW_AT_name ("Foo") <<<<<<<<<<<<<<<<<< that is a declaration(definition is removed)<br>
0x000000af: "Foo"<br>
<br>
i.e. Probably we need to clarify that question in the standard: whether it is allowed to
</div>
<div>remove/ignore DIEs related to deleted code.</div>
<div>So that tools(dsymutil/DWARF aware linker) correctly handle such situations.</div>
<div><br>
</div>
<div>If it would be necessary to analyze debug info related to deleted code </div>
<div>(whether it contains something used in other parts of debug info) </div>
<div>then the linking process will become even more slow.</div>
<div>It would be better to not allow to generate such closely-coupled debug info.
<br>
</div>
<div class="gmail_quote"><br>
</div>
</div>
<div class="gmail_quote">Thank You, Alexey.<br>
<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>