Issue 117317
Summary Clang emits wrong (escaped) path in preprocessor+assembler output on Windows
Labels debuginfo, platform:windows
Assignees
Reporter aykevl
    Take this very simple assembly file:

```asm
foobar:
 nop
```

If I compile without the preprocessor, the `DW_AT_decl_file` under `DW_TAG_label` looks more or less correct:

```
$ clang -g --target=thumbv6m-unknown-unknown-eabi -c -o tmp/test.o "C:\Users\Ayke\src\tinygo\tinygo\tmp\test.s"

$ llvm-dwarfdump tmp/test.o
tmp/test.o:     file format elf32-littlearm

.debug_info contents:
0x00000000: Compile Unit: length = 0x0000006c, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x04 (next unit at 0x00000070)

0x0000000c: DW_TAG_compile_unit
 DW_AT_stmt_list   (0x00000000)
              DW_AT_low_pc (0x00000000)
              DW_AT_high_pc     (0x00000002)
 DW_AT_name        ("tmp\\test.s")
              DW_AT_comp_dir ("C:\\Users\\Ayke\\src\\tinygo\\tinygo")
 DW_AT_producer    ("clang version 19.1.4")
              DW_AT_language (DW_LANG_Mips_Assembler)

0x0000005b:   DW_TAG_label
 DW_AT_name      ("foobar")
                DW_AT_decl_file ("C:\Users\Ayke\src\tinygo\tinygo/tmp\test.s")
 DW_AT_decl_line (1)
                DW_AT_low_pc (0x00000000)

0x0000006f:   NULL
```

(There's a forward slash there for some reason, but that's not what this bug is about).

But when I compile with the preprocessor enabled (note `test.S` instead of `test.s`), the `DW_AT_decl_file` path seems to be escaped:

```
$ ~/scoop/apps/llvm/current/bin/clang -g --target=thumbv6m-unknown-unknown-eabi -c -o tmp/test.o "C:\Users\Ayke\src\tinygo\tinygo\tmp\test.S"

$ llvm-dwarfdump tmp/test.o
tmp/test.o:     file format elf32-littlearm

.debug_info contents:
0x00000000: Compile Unit: length = 0x00000093, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x04 (next unit at 0x00000097)

0x0000000c: DW_TAG_compile_unit
 DW_AT_stmt_list   (0x00000000)
              DW_AT_low_pc (0x00000000)
              DW_AT_high_pc     (0x00000002)
 DW_AT_name ("C:\\\\Users\\\\Ayke\\\\src\\\\tinygo\\\\tinygo\\\\tmp\\\\test.S")
 DW_AT_comp_dir ("C:\\Users\\Ayke\\src\\tinygo\\tinygo")
 DW_AT_producer    ("clang version 19.1.4")
              DW_AT_language (DW_LANG_Mips_Assembler)

0x00000082:   DW_TAG_label
 DW_AT_name      ("foobar")
                DW_AT_decl_file ("C:\\Users\\Ayke\\src\\tinygo\\tinygo\\tmp\\test.S")
 DW_AT_decl_line (8)
                DW_AT_low_pc (0x00000000)

0x00000096:   NULL
```

Also, the `DW_AT_name` even looks double-escaped!

This is my Clang version:

```
$ clang --version
clang version 19.1.4
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Users\Ayke\scoop\apps\llvm\19.1.4\bin
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to