Closed yota9 closed 2 years ago
This is needed for the case if we have the input binary like this:
< 0><0x0000000b> DW_TAG_compile_unit
DW_AT_name sync
DW_AT_language DW_LANG_Go
DW_AT_stmt_list 0x00000000
DW_AT_low_pc 0x000a3c40
DW_AT_ranges 0x00000000
ranges: 2 at .debug_ranges offset 0 (0x00000000) (32 bytes)
[ 0] range entry 0x00000000 0x0000129a
[ 1] range end 0x00000000 0x00000000
DW_AT_comp_dir .
DW_AT_producer Go cmd/compile go1.17.3; -shared regabi
<Unknown AT value 0x2905> sync
The DW_AT_low_pc won't be updated and the address will be incorrect for the output. As I understand the gdb will use it's value as the range base, so the debugging won't work as expected (e.g. show sources & etc). After the patching the range entries will be written in absolute values and the low_pc must be zeroed. After BOLT with this patch:
DW_AT_low_pc 0x00000000
DW_AT_ranges 0x00000010
ranges: 21 at .debug_ranges offset 16 (0x00000010) (336 bytes)
[ 0] range entry 0x00457056 0x004572e3
[ 1] range entry 0x00457300 0x00457344
[ 2] range entry 0x00457344 0x00457419
[ 3] range entry 0x0045741a 0x0045754c
.....
Hi.
Thanks for the update. There is an internal patch that I am working on that changes how we handle .debug_info from update to "re-write". This also affects that code. Would you mind waiting until that's in and rebasing on it?
Hello @ayermolo ! Sure, also could you please tell me what do you think about #267 patch? Or you mean to rebase both the patches? I hope there won't be a lot of changes in these places :)
It looks fine. That whole mess with indirect will be simplified. We will be directly creating patches with forms we want.
Would it be possible to add a test for this?
@aaupov I've found one more problem, after the "Rewrite of .debug_info section" patch I've got error in dwarfdump, didn't investigate it yet: dwarfdump ERROR: dwarf_child: DW_DLE_ABBREV_MISSING(394) Unable to find abbrev for DIE
@yota9 can you file a bug with repro, and assign it to me?
@yota9 can you file a bug with repro, and assign it to me?
Sure, https://github.com/facebookincubator/BOLT/issues/274 but I don't have rights to assign issues :) Thanks!
Re-opened in https://reviews.llvm.org/D117216
In case the case the DW_AT_ranges tag already exists for the object the low pc values won't be updated and will be incorrect in after-bolt binaries.
Vladislav Khmelevsky, Advanced Software Technology Lab, Huawei