https://bugs.llvm.org/show_bug.cgi?id=46502

            Bug ID: 46502
           Summary: [lto] Module asm symbols don't show in IR symbol table
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

For example:

$ cat /tmp/x.c
void foo() {}

asm(".globl bar      \n"
    "bar:            \n"
    "  xor %eax, %eax\n"
    "  ret           \n");

$ clang -c -flto=thin /tmp/x.c

$ llvm-nm x.o
---------------- T foo


I expected bar to show up in the symbol table. I can see it getting processed
by ModuleSymbolTable::CollectAsmSymbols() but it doesn't seem to make it all
the way?



But even though it's not showing in the symbol table, linking against it seems
to work:

$ cat /tmp/y.c
extern void foo();
extern void bar();

int main() {
  foo();
  bar();
  return 0;
};

$ clang -flto=thin /tmp/y.c /tmp/x.c -fuse-ld=lld

$ ./a.out && echo ok
ok


Isn't the symbol table needed to resolve the 'bar' reference? Or does it
somehow work because we're linking the LLVM modules together anyway?





pcc: I can't really tell if this is a bug or if I'm missing something about how
this works.

If it is a bug, maybe the problem is how Builder::addSymbol() in IRSymtab.cpp
bails out because the symbol isn't a GlobalValue?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to