[llvm-dev] Unnamed symbol in object symbol table

陆旭凡 via llvm-dev
Thu, 23 Dec 2021 08:54:47 -0000

As far as I known, for temp labels, only MCAsmStreamer will use name on
temp labels, other MCStreamers will emit an unnamed temp symbol for temp
label.

In RISCV, because of some dwarf sections need to use temp label (like
section's begin label) to compute section length, these temp labels will be
placed in the object file's symbol table.  For example:

```
$ readelf --syms hello.o
Symbol table '.symtab' contains 24 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS hello.c
     2: 0000000000000002     0 NOTYPE  LOCAL  DEFAULT    2
     3: 0000000000000002     0 NOTYPE  LOCAL  DEFAULT    2
     4: 0000000000000002     0 NOTYPE  LOCAL  DEFAULT    2
     5: 0000000000000004     0 NOTYPE  LOCAL  DEFAULT    2
     6: 0000000000000008     0 NOTYPE  LOCAL  DEFAULT    2
     7: 0000000000000008     0 NOTYPE  LOCAL  DEFAULT    2
     8: 000000000000000a     0 NOTYPE  LOCAL  DEFAULT    2
```
The second symbol to 8th symbol are unnamed symbols.

However, llvm's JITLink only allow named symbols.
How can I solve that ?
Make RISCVELFStreamer using name on temp labels? Or change JITLink ?
Or other ways ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20211223/9559f5b4/attachment.html>