$NetBSD: patch-ad,v 1.3 2000/06/20 21:50:20 jlam Exp $

--- dyn_load.c.orig	Wed Apr 26 09:01:16 2000
+++ dyn_load.c	Sat May  6 04:48:00 2000
@@ -50,7 +50,8 @@
 #if !defined(SUNOS4) && !defined(SUNOS5DL) && !defined(IRIX5) && \
     !defined(MSWIN32) && !(defined(ALPHA) && defined(OSF1)) && \
     !defined(HPUX) && !(defined(LINUX) && defined(__ELF__)) && \
-    !defined(RS6000) && !defined(SCO_ELF)
+    !defined(RS6000) && !defined(SCO_ELF) && \
+    !(defined(NETBSD) && defined(__ELF__))
  --> We only know how to find data segments of dynamic libraries for the
  --> above.  Additional SVR4 variants might not be too
  --> hard to add.
@@ -297,14 +298,19 @@
 # endif /* !USE_PROC ... */
 # endif /* SUNOS */
 
-#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF)
+#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
+    (defined(NETBSD) && defined(__ELF__))
 
 /* Dynamic loading code for Linux running ELF. Somewhat tested on
  * Linux/x86, untested but hopefully should work on Linux/Alpha. 
  * This code was derived from the Solaris/ELF support. Thanks to
  * whatever kind soul wrote that.  - Patrick Bridges */
 
+#if defined(NETBSD)
+#include <sys/exec_elf.h>
+#else
 #include <elf.h>
+#endif
 #include <link.h>
 
 /* Newer versions of Linux/Alpha and Linux/x86 define this macro.  We