
#10046: Linker script patch in rts/Linker.c doesn't work for (non-C or non-en..) locales -------------------------------------+------------------------------------- Reporter: hgolden | Owner: simonmar Type: bug | Status: new Priority: normal | Milestone: 7.12.1 Component: Runtime | Version: 7.8.4 System | Operating System: Unknown/Multiple Keywords: linker | Type of failure: Incorrect result script | at runtime Architecture: | Blocked By: Unknown/Multiple | Related Tickets: 2615, 9237 Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Please see ticket:2615#comment:40 and replies. This error only occurs on systems where linker scripts are used. The linker script patch (as it has evolved) assumes that the error messages it will receive are in English. This would be true if the locale (LC_MESSAGES) is C or en (or one of the en variants). However, in other locales, the message will be in a different language. Unfortunately, the semantics of POSIX dlerror() specify that the error is returned as a pointer to a human-readable text string, rather than an error code. The string returned depends on the locale. The code could be made more robust by momentarily changing the locale (LC_MESSAGES) to C before calling dlerror() and reverting it to its previous value immediately after. This has been tested on a zh_CN.utf-8 (see ticket:2615#comment:42) and works. The only concern I have is in the case of multithreaded code that _might_ be affected if it is running while the locale is changed. I don't know enough to know if this is a real issue or not, nor do I know how to deal with it if necessary. Also see ticket:9237 for another corner case in the linker script code that should be dealt with at the same time. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10046 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler