orbit icon indicating copy to clipboard operation
orbit copied to clipboard

Fix LLVM-based address computation Windows

Open florian-kuebler opened this issue 2 years ago • 0 comments

In our LLVM-based pdb file implementation, we compute the address of a function using the "Offset", the load bias (image base on Windows) and the executable section offset. We use the executable section offset is used as the Offset differs to the RVA by the section offset.

In particular, the executable section offset is used in Linux as, our module base address will start at the first executable section. However, on Windows modules start at the beginning of the file, so the executable section offset needs to set to 0.

This change changes from computing the function address to lookup the section offset (called Virtual address in LLVM) on the fly. This also fixes a bug, when multiple executable sections exists.

In order to be on par, we also set the "load address" (image base). This way, we will store the "desired virtual address" instead of the RVA, which is exactly what we do for PE/coff files on Linux. For all the computations that equals out anyways.

Test: Manually inspect computed addresses Bug: http://b/242015708

florian-kuebler avatar Aug 10 '22 14:08 florian-kuebler