[commit: ghc] master: rts: fix build failure on OpenBSD (_DYNAMIC symbol collision) (1638350)

git at git.haskell.org git at git.haskell.org
Sat Dec 29 22:26:14 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1638350f0629365f20e97554e872d85b75f48d73/ghc

>---------------------------------------------------------------

commit 1638350f0629365f20e97554e872d85b75f48d73
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date:   Tue Dec 18 23:17:45 2018 +0000

    rts: fix build failure on OpenBSD (_DYNAMIC symbol collision)
    
    Summary:
    Build failure on OpenBSD-6.4 the the following:
    ```
    rts/RtsSymbols.c:994:1: error:
         error: redefinition of '_DYNAMIC' as different kind of symbol
        |
    994 | RTS_OPENBSD_ONLY_SYMBOLS
        | ^
    RTS_OPENBSD_ONLY_SYMBOLS
    ^
    ```
    
    On OpenBSD `_DYNAMIC` was always defined in `<elf.h>` headers
    but used not to be included.
    
    The change explicitly includes `<elf.h>` as a source of symbol definition.
    
    Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
    
    Test Plan: build-tested on OpenBSD-6.4
    
    Reviewers: bgamari, erikd, simonmar
    
    Subscribers: rwbarton, carter
    
    GHC Trac Issues: #15945
    
    Differential Revision: https://phabricator.haskell.org/D5461


>---------------------------------------------------------------

1638350f0629365f20e97554e872d85b75f48d73
 rts/RtsSymbols.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c
index 5091c90..123ee76 100644
--- a/rts/RtsSymbols.c
+++ b/rts/RtsSymbols.c
@@ -27,6 +27,10 @@
 #include <shfolder.h> /* SHGetFolderPathW */
 #endif
 
+#if defined(openbsd_HOST_OS)
+#include <elf.h> /* _DYNAMIC */
+#endif
+
 /* -----------------------------------------------------------------------------
  * Symbols to be inserted into the RTS symbol table.
  */
@@ -280,7 +284,7 @@
 #if defined(openbsd_HOST_OS)
 #define RTS_OPENBSD_ONLY_SYMBOLS                            \
      SymE_NeedsProto(__guard_local)                         \
-     SymE_NeedsProto(_DYNAMIC)
+     SymE_HasProto(_DYNAMIC)
 #else
 #define RTS_OPENBSD_ONLY_SYMBOLS
 #endif



More information about the ghc-commits mailing list