llvm-project
7472be22 - [BOLT][DWARF] Keep rewritten locexpr record with base type reference (#242064)

Commit
1 day ago
[BOLT][DWARF] Keep rewritten locexpr record with base type reference (#242064) Some DWARF location expressions contain both an address index and a reference to a type DIE, e.g. "DW_OP_addrx 128, DW_OP_convert <int>". BOLT updates them in two steps: 1. DWARFRewriter replaces the address index with the index of the address in the new .debug_addr. 2. Later, once the final DIE offsets are known, DIEBuilder fills in the offset of the type DIE. Step 2 rebuilt the expression from the input file, so it undid step 1 and put the old address index back. The index is a ULEB128, so the old and new values can take a different number of bytes. The expression then no longer had the size the unit was laid out with, so the unit length was wrong and tools reading the DWARF lost every unit after it. Make step 2 start from the expression written by step 1. For that, step 1 now always writes the input offset of the type DIE, and step 2 replaces it with the output offset. Step 1 used to write 0 when the type DIE was not created yet, for which step 2 was not able to update. Assisted-by: opus-5.5
Author
Parents
Loading