Hello,
I'm curious if it's possible to provide /usr/include/elf.h file on OpenBSD to
improve its niceness to software porting from other Unixes. Following patch
adds this for me and is tested with GHC where I'd like to kill code like:
#if !defined(openbsd_HOST_OS)
# include <elf.h>
#else
/* openbsd elf has things in different places, with diff names */
# include <elf_abi.h>
#endif
I assume other apps dealing with ELF needs to do the similar thing for OpenBSD
support. I've checked and /usr/include/elf.h is available on Solaris 10,
Solaris 11, various Linuxes, NetBSD 7.x and FreeBSD 10.x. In patch below, elf.h
is a result of copy of elf_abi.h with small edit.
Thanks,
Karel
diff --git a/include/Makefile b/include/Makefile
index 1d7f894b595..f8d8f141af2 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -11,7 +11,8 @@
FILES= a.out.h ar.h asr.h assert.h bitstring.h blf.h bsd_auth.h \
complex.h cpio.h ctype.h curses.h db.h dirent.h disktab.h \
- dlfcn.h elf_abi.h err.h errno.h fenv.h float.h fnmatch.h fstab.h fts.h \
+ dlfcn.h elf.h elf_abi.h err.h errno.h fenv.h float.h fnmatch.h fstab.h \
+ fts.h \
ftw.h getopt.h glob.h grp.h icdb.h ieeefp.h ifaddrs.h inttypes.h \
iso646.h kvm.h langinfo.h libgen.h limits.h link.h link_elf.h \
locale.h login_cap.h math.h md5.h memory.h ndbm.h netdb.h netgroup.h \
diff --git a/include/elf.h b/include/elf.h
new file mode 100644
index 00000000000..c1bc247cc3c
--- /dev/null
+++ b/include/elf.h
@@ -0,0 +1,33 @@
+/* $OpenBSD: elf.h,v 1.4 1996/05/22 07:46:22 etheisen Exp $ */
+/*
+ * Copyright (c) 1996 Erik Theisen
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _ELF_H_
+#define _ELF_H_
+
+#include <sys/exec_elf.h>
+
+#endif /* _ELF_H_ */