$OpenBSD: patch-rts_Linker_c,v 1.9 2015/01/01 19:25:36 kili Exp $

Workaround error: unknown symbol '__guard_local'.

Dissable check for .init_array sections, we don't have them.

--- rts/Linker.c.orig	Mon Dec 15 15:36:16 2014
+++ rts/Linker.c	Mon Dec 29 10:24:49 2014
@@ -849,6 +849,14 @@ typedef struct _RtsSymbolVal {
 #define RTS_DARWIN_ONLY_SYMBOLS
 #endif
 
+#if defined(openbsd_HOST_OS)
+#define RTS_OPENBSD_ONLY_SYMBOLS                            \
+     SymE_NeedsProto(__guard_local)                         \
+     SymE_NeedsProto(__stack_smash_handler)
+#else
+#define RTS_OPENBSD_ONLY_SYMBOLS
+#endif
+
 #ifndef SMP
 # define MAIN_CAP_SYM SymI_HasProto(MainCapability)
 #else
@@ -1434,6 +1442,7 @@ RTS_POSIX_ONLY_SYMBOLS
 RTS_MINGW_ONLY_SYMBOLS
 RTS_CYGWIN_ONLY_SYMBOLS
 RTS_DARWIN_ONLY_SYMBOLS
+RTS_OPENBSD_ONLY_SYMBOLS
 RTS_LIBGCC_SYMBOLS
 RTS_LIBFFI_SYMBOLS
 #undef SymI_NeedsProto
@@ -1469,6 +1478,7 @@ static RtsSymbolVal rtsSyms[] = {
       RTS_MINGW_ONLY_SYMBOLS
       RTS_CYGWIN_ONLY_SYMBOLS
       RTS_DARWIN_ONLY_SYMBOLS
+      RTS_OPENBSD_ONLY_SYMBOLS
       RTS_LIBGCC_SYMBOLS
       RTS_LIBFFI_SYMBOLS
 #if defined(darwin_HOST_OS) && defined(i386_HOST_ARCH)
@@ -4981,11 +4991,13 @@ static int getSectionKind_ELF( Elf_Shdr *hdr, int *is_
         return SECTIONKIND_CODE_OR_RODATA;
     }
 
+#ifndef openbsd_HOST_OS  
     if (hdr->sh_type == SHT_INIT_ARRAY
         && (hdr->sh_flags & SHF_ALLOC) && (hdr->sh_flags & SHF_WRITE)) {
        /* .init_array section */
         return SECTIONKIND_INIT_ARRAY;
     }
+#endif
 
     if (hdr->sh_type == SHT_NOBITS
         && (hdr->sh_flags & SHF_ALLOC) && (hdr->sh_flags & SHF_WRITE)) {
