[GHC] #9439: LlvmCodegen: Overzealous mangler incorrectly transforms user code

GHC ghc-devs at haskell.org
Thu Aug 14 04:20:59 UTC 2014


#9439: LlvmCodegen: Overzealous mangler incorrectly transforms user code
-------------------------------------+-------------------------------------
       Reporter:  bgamari            |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler (LLVM)    |                 Version:  7.8.2
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:
     Blocked By:                     |  None/Unknown
Related Tickets:                     |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 In an attempt to close #4210 the LLVM code generator's mangler was
 modified in
 ed67d290e7389bd87a6feea269a0275e0f0f5e2f 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).

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9439>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list