[llvm] [DWARF] Do not emit DWARF5 symbols in the case of DWARF2/3 + non-lldb (PR #110120)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 06:18:37 PDT 2024


linsinan1995 wrote:

I encountered an issue where clang may emit DWARF version 5 symbols when a dwarf version less than 4 is specified. This can lead to errors during software packaging on some systems due to dwz (dwz: <path-to-binary> Unknown DWARF DW_OP_163, which is DW_OP_entry_value), generating problematic debug information.

A simple reproduce case in X86:

```
void use(int * x, int * y) {
  *x += 4;
  *y -= 2;
}

int helper(int z_, int d_);
int x = 0;
int y = 1;

int  main(int argc, char *argv[]) {
   x = argc;
   y = argc + 3;
   use(&x, &y);
   return helper(x, y);
}
```



```
$ clang++ -O1 -gdwarf-3 test.cc  -c
$ llvm-dwarfdump --show-form --verbose --debug-info test.o | grep DW_OP_entry_value
                     [0x0000000000000024, 0x0000000000000029) ".text": DW_OP_entry_value(DW_OP_reg5 RDI))
                     [0x000000000000001c, 0x0000000000000029) ".text": DW_OP_entry_value(DW_OP_reg4 RSI))
```


https://github.com/llvm/llvm-project/pull/110120


More information about the llvm-commits mailing list