[PATCH] D31464: [ELF] - Stop producing broken entries in .debug_ranges section

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 03:30:50 PDT 2017


grimar added inline comments.


================
Comment at: ELF/InputSection.cpp:533-538
+    // If address range list contains entry that belongs to discarded
+    // section, we should perform a fix up. We can not write zero as start and
+    // end address because that would mean unexpected end of range. So we put a
+    // placeholder value equal to 1, that is correct to do because a range list
+    // entry whose begining and end adress are equal has no effect, because size
+    // of range is zero in such case.
----------------
jhenderson wrote:
> grimar wrote:
> > jhenderson wrote:
> > > A few grammar nits and minor improvements to this comment. I suggest the following:
> > > 
> > > "If an address range list contains an entry that belongs to a discarded section, we should perform a fix-up. We cannot write zero as the start and end address because such a pair is an end of range list marker in the .debug_ranges section. We put a placeholder value equal to 1, which is fine because a range list entry whose beginning and end address are equal has no effect, because the size of the range is zero in such case."
> > Fixed. thanks !
> Sorry, one more grammar nit I missed - the last bit should say "in such a case."
Thanks !


================
Comment at: ELF/InputSection.cpp:545
 
+static bool isInDiscardedSection(SymbolBody &Body) {
+  DefinedRegular *D = dyn_cast<DefinedRegular>(&Body);
----------------
jhenderson wrote:
> I think this can be a const reference.
We usually do not use const references in LLD.
Its a bit complicated. I think no const is consistent with code and ok here.


https://reviews.llvm.org/D31464





More information about the llvm-commits mailing list