[PATCH] D25822: [DWARF parsers] - Add a way to get section indices when call DWARFUnit::collectAddressRanges()

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 01:14:36 PDT 2016


grimar added a comment.

In https://reviews.llvm.org/D25822#578766, @evgeny777 wrote:

> In the current implementation of LLVM DWARF parser LowPC and HighPC are offsets from the start of the **section**. This causes problems when object file has comdat groups or was compiled with -ffunction-sections. I think that problem can be solved if LowPC and HighPC would offsets from the start of the **file** not section. This , to my understanding, can be done quite easily by adding sh_offset to R.Value in DWARFContextInMemory constructor. After that all SecNdx related stuff can be removed: section index can be easily reconstructed given file offset. What do you think?


I am not sure that is correct thing to do. From DWARF manual: "The value of the DW_AT_low_pc attribute is the **relocated address** of the first
instruction associated with the entity.". If we do the change you suggest we will end up with API that is called getLowAndHighPC() but returns the absolute values instead of relocatable values, so it will be a misnaming I think. 
I also not sure that changing R.value will not break anything else (that not only used for lowPC/highPC), though that is different question.

Interesting to hear other opinions, but now I prefer either my or Greg's suggested solution to use FileAddress struct.


https://reviews.llvm.org/D25822





More information about the llvm-commits mailing list