[PATCH] D147066: [DWARFLinker][DWARFv5] Add handling of DW_OP_addrx and DW_OP_constx expression operands.

Michael Buch via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 04:16:45 PDT 2023


Michael137 added a comment.

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.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147066/new/

https://reviews.llvm.org/D147066



More information about the llvm-commits mailing list