Skip to content

llvm assembler does not emit the correct symbol names when escaped characters are present #138390

@midnightveil

Description

@midnightveil

assembler

https://godbolt.org/z/ac1vev5nh

.type	"hello \" world", @object
"hello \" world":
    .zero	1

In GCC's as:

Symbol table '.symtab' contains 2 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 OBJECT  LOCAL  DEFAULT    1 hello " world

In Clang's as:

Symbol table '.symtab' contains 2 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 OBJECT  LOCAL  DEFAULT    2 hello \" world

c frontend

This then seems to make -save-temps have different output to without it:

https://godbolt.org/z/4sa7e5dq4

clang -save-temps main.c -o clang.o gives:

Symbol table '.symtab' contains 10 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
...
     4: 0000000000403000     4 OBJECT  GLOBAL DEFAULT    4 hello \" world
...

Without -save-temps:

Symbol table '.symtab' contains 10 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
...
     7: 0000000000403000     4 OBJECT  GLOBAL DEFAULT    4 hello " world
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions