LlvmCodegen: Overzealous mangler incorrectly transforms user code
In an attempt to close #4210 (closed) the LLVM code generator's mangler was modified in
ed67d290 to rewrite symbol types from
@object. This was done in order to prevent the linker from sending reference through the PLT which breaks info tables.
Unfortunately, this mangling was a simple text replacement of
@object in the assembler produced by LLVM and made no attempt to distinguish
.type directives (which the mangling targets) from other occurrences of the token. As rwbarton unfortunately found out, this means that any occurrences of
"@function" in user code (e.g. the LLVM backend itself while compiling GHC) will be rewritten to
"@object" in the produced object. Hilarity ensues.
This can be demonstrated by the simple test
main = putStrLn "@function", which prints
@object in the affected releases (7.8.1 through 7.8.3 thusfar).