[LLVMdev] Why do we mangle names in llvm?

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Tue Feb 8 19:04:13 PST 2011


When we produce IL for

int f(void) {...}

it looks like

define i32 @f() {....

and llvm is then responsible for adding the '_' prefix:

_f:
....

Why do we have this division? Wouldn't it be better for the IL to have 
the '_':

define i32 @_f() {....

This causes problems with LTO because the symbols seem by the first pass 
are not the same as the ones seen once the final .o is produced. It can 
be fixed by having libLTO call void Mangler::getNameWithPrefix, but I 
was wondering if it wouldn't be better the avoid mangling in LLVM 
completely.

Cheers,
Rafael



More information about the llvm-dev mailing list