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 @function
to @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 @function
to @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).
Trac metadata
Trac field | Value |
---|---|
Version | 7.8.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (LLVM) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |