[llvm-dev] LLD symbol types for defsym

Shoaib Meenai via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 3 11:23:41 PDT 2020


I noticed that LLD doesn’t preserve the symbol type for a defsym directive. For example:

$ cat f.c
void f() {}

$ clang -c f.c
$ ld.lld -shared --defsym=g=f f.o
$ objdump -T a.out
DYNAMIC SYMBOL TABLE:
00000000000012a0 g    DF .text  0000000000000006 f
00000000000012a0 g    D  .text  0000000000000000 g

f is marked as a function symbol, but g is not.

I recognize this is hard to do in the general case, where you can have e.g. arithmetic being performed in the defsym, but in this particular case, it would seem desirable for the alias symbol to have the same type for the target. My question is if this will end up making any difference in practice. The case I'm concerned about in particular is ARM-Thumb interworking, where I believe there might be some logic that's based on symbol types. Is there any possibility that we'll have issues with that logic because of the alias not being marked as a function symbol?



More information about the llvm-dev mailing list