[flang-commits] [flang] [flang] Remove hardcoded bits from AddDebugInfo. (PR #89231)

Abid Qadeer via flang-commits flang-commits at lists.llvm.org
Tue Apr 23 03:15:38 PDT 2024


abidh wrote:

> Thank you for this work @abidh! Do you know or have some pointers to how Clang handles `DW_AT_name` and `DW_AT_comp_dir` generation in the LTO case, when multiple LLVM modules end up being linked into a single LLVM module? Is it using some artificial module name in this case?

I have seen that `gcc` can generate compilation unit with `<artifical>` as file name when using lto. Please see discussion in the following thread.
https://lists.dwarfstd.org/pipermail/dwarf-discuss/2022-November/002180.html

I am not sure whether `clang` generates an artificial compile unit or not. I tried a simple example with 2 files with both `clang` and `gcc`. I see that `clang` generates 2 compile units with actual file name. `GCC` generates one extra compile unit with `<artificial>` name. The `DW_AT_comp_dir` is same in all case and point to the current working directory.
```

$ clang -flto -g  a.c main.c
DW_AT_name        : (indexed string: 0x1): a.c
DW_AT_name        : (indexed string: 0x5): main.c

$ gcc -flto -g  a.c main.c
DW_AT_name        : (indirect line string, offset: 0x0): <artificial>
DW_AT_name        : (indirect line string, offset: 0x2e): a.c
DW_AT_name        : (indirect line string, offset: 0x32): main.c

```
This probably does not answer your question. I will try to dig more.


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


More information about the flang-commits mailing list