This patch adds handling of DW_OP_addrx and DW_OP_constx expression operands.
In --update case these operands are preserved as is. Otherwise they are
converted into the DW_OP_addr and DW_OP_const[*]u correspondingly.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h | ||
---|---|---|
58–72 | Instead of wrapping PatchLocation in another struct, would it make sense to add the RelocAdjustment to the PatchLocation itself? | |
llvm/lib/DWARFLinker/DWARFLinker.cpp | ||
1216 | ||
1235 | ||
1249 | ||
llvm/tools/dsymutil/DwarfLinkerForBinary.cpp | ||
1022–1060 | The code to parse the exprloc here is very similar to that in the dsymutil variant. Any chance we could hoist some of this logic into the DWARFLinker? |
addressed comments. Deleted PatchWithRelocAdjustment. Refactored code parsing the exprloc.
Hi, it appears that this patch is causing some failures on the big endian PPC bots, such as:
https://lab.llvm.org/buildbot/#/builders/93/builds/14929
https://lab.llvm.org/buildbot/#/builders/231/builds/11866
If you're able to help take a look at this, that would be greatly appreciated.
Thank you for reporting the issue, the https://reviews.llvm.org/rGddf5bfd6e6e2fc5b94718a29e718b4f821a3b853 should fix it.
Looks like this broke the lldb matrix bots for DWARFv2: https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/6580/execution/node/54/log/
******************** Failed Tests (2): lldb-api :: lang/c/tls_globals/TestTlsGlobals.py lldb-api :: lang/cpp/thread_local/TestThreadLocal.py
The problem is that dsymutil strips out thread_local variables when the binary is compiled with -gdwarf-2.
Reproducer:
int storage = 45; thread_local int tl_global_int = 123; thread_local int *tl_global_ptr = &storage; int main(int argc, char **argv) { thread_local int tl_local_int = 321; thread_local int *tl_local_ptr = nullptr; tl_local_ptr = &tl_local_int; tl_local_int++; return 0; // Set breakpoint here } clang++ -g -O0 -gdwarf-2 -c main.cpp -o main.o -std=c++2a clang++ main.o -o a.out dsymutil a.out dwarfdump a.out.dSYM --find tl_global_ptr
Observe that there is no entry for tl_global_ptr anymore. Compiling with -gdwarf-4 doesn't behave this way.
FWIW, depending on what the actual problem is, you don't need to go out of your way to fix TLS on dwarf 2. I'd be fine with marking these tests as requiring DWARF 4+ in the LLDB test suite if that makes sense.
Instead of wrapping PatchLocation in another struct, would it make sense to add the RelocAdjustment to the PatchLocation itself?