Merge "Kill <machine/exec.h>."
diff --git a/libc/arch-arm/include/machine/exec.h b/libc/arch-arm/include/machine/exec.h
deleted file mode 100644
index 227b207..0000000
--- a/libc/arch-arm/include/machine/exec.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $OpenBSD: exec.h,v 1.9 2003/04/17 03:42:14 drahn Exp $ */
-/* $NetBSD: exec.h,v 1.6 1994/10/27 04:16:05 cgd Exp $ */
-
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * 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 _ARM_EXEC_H_
-#define _ARM_EXEC_H_
-
-#define __LDPGSZ 4096
-
-#define NATIVE_EXEC_ELF
-
-#define ARCH_ELFSIZE 32
-
-#define ELF_TARG_CLASS ELFCLASS32
-#define ELF_TARG_DATA ELFDATA2LSB
-#define ELF_TARG_MACH EM_ARM
-
-#define _NLIST_DO_AOUT
-#define _NLIST_DO_ELF
-
-#define _KERN_DO_AOUT
-#define _KERN_DO_ELF
-
-#endif /* _ARM_EXEC_H_ */
diff --git a/libc/arch-arm64/include/machine/exec.h b/libc/arch-arm64/include/machine/exec.h
deleted file mode 100644
index 7437626..0000000
--- a/libc/arch-arm64/include/machine/exec.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $OpenBSD: exec.h,v 1.9 2003/04/17 03:42:14 drahn Exp $ */
-/* $NetBSD: exec.h,v 1.6 1994/10/27 04:16:05 cgd Exp $ */
-
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * 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 _AARCH64_EXEC_H_
-#define _AARCH64_EXEC_H_
-
-#define __LDPGSZ 4096
-
-#define NATIVE_EXEC_ELF
-
-#define ARCH_ELFSIZE 64
-
-#define ELF_TARG_CLASS ELFCLASS64 /* 64-bit objects */
-#define ELF_TARG_DATA ELFDATA2LSB
-#define ELF_TARG_MACH EM_AARCH64
-
-#define _NLIST_DO_AOUT
-#define _NLIST_DO_ELF
-
-#define _KERN_DO_AOUT
-#define _KERN_DO_ELF64
-
-#endif /* _AARCH64_EXEC_H_ */
diff --git a/libc/arch-mips/include/machine/exec.h b/libc/arch-mips/include/machine/exec.h
deleted file mode 100644
index 3c63f74..0000000
--- a/libc/arch-mips/include/machine/exec.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/* $OpenBSD: exec.h,v 1.1 2004/10/18 19:05:36 grange Exp $ */
-
-/*
- * Copyright (c) 1996-2004 Per Fogelstrom, Opsycon AB
- *
- * 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.
- *
- * 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 _MIPS64_EXEC_H_
-#define _MIPS64_EXEC_H_
-
-#define __LDPGSZ 4096
-
-/*
- * Define what exec "formats" we should handle.
- */
-#define NATIVE_EXEC_ELF
-#define NATIVE_ELFSIZE 64
-#define EXEC_SCRIPT
-
-/*
- * If included from sys/exec.h define kernels ELF format.
- */
-#ifdef __LP64__
-#define ARCH_ELFSIZE 64
-#define DB_ELFSIZE 64
-#define ELF_TARG_CLASS ELFCLASS64
-#else
-#define ARCH_ELFSIZE 32
-#define DB_ELFSIZE 32
-#define ELF_TARG_CLASS ELFCLASS32
-#endif
-
-#if defined(__MIPSEB__)
-#define ELF_TARG_DATA ELFDATA2MSB
-#else
-#define ELF_TARG_DATA ELFDATA2LSB
-#endif
-#define ELF_TARG_MACH EM_MIPS
-
-#define _NLIST_DO_ELF
-
-#if defined(_LP64)
-#define _KERN_DO_ELF64
-#if defined(COMPAT_O32)
-#define _KERN_DO_ELF
-#endif
-#else
-#define _KERN_DO_ELF
-#endif
-
-/* Information taken from MIPS ABI supplemental */
-
-/* Architecture dependent Segment types - p_type */
-#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */
-
-/* Architecture dependent d_tag field for Elf32_Dyn. */
-#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime Linker Interface ID */
-#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
-#define DT_MIPS_ICHECKSUM 0x70000003 /* Cksum of ext. str. and com. sizes */
-#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
-#define DT_MIPS_FLAGS 0x70000005 /* Flags */
-#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Segment base address */
-#define DT_MIPS_CONFLICT 0x70000008 /* Adr of .conflict section */
-#define DT_MIPS_LIBLIST 0x70000009 /* Address of .liblist section */
-#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local .GOT entries */
-#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of .conflict entries */
-#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of .liblist entries */
-#define DT_MIPS_SYMTABNO 0x70000011 /* Number of .dynsym entries */
-#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
-#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in .dynsym */
-#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
-#define DT_MIPS_RLD_MAP 0x70000016 /* Address of debug map pointer */
-
-#define DT_PROCNUM (DT_MIPS_RLD_MAP - DT_LOPROC + 1)
-
-/*
- * Legal values for e_flags field of Elf32_Ehdr.
- */
-#define EF_MIPS_NOREORDER 0x00000001 /* .noreorder was used */
-#define EF_MIPS_PIC 0x00000002 /* Contains PIC code */
-#define EF_MIPS_CPIC 0x00000004 /* Uses PIC calling sequence */
-#define EF_MIPS_ABI2 0x00000020 /* -n32 on Irix 6 */
-#define EF_MIPS_32BITMODE 0x00000100 /* 64 bit in 32 bit mode... */
-#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */
-#define E_MIPS_ARCH_1 0x00000000
-#define E_MIPS_ARCH_2 0x10000000
-#define E_MIPS_ARCH_3 0x20000000
-#define E_MIPS_ARCH_4 0x30000000
-#define EF_MIPS_ABI 0x0000f000 /* ABI level */
-#define E_MIPS_ABI_NONE 0x00000000 /* ABI level not set */
-#define E_MIPS_ABI_O32 0x00001000
-#define E_MIPS_ABI_O64 0x00002000
-#define E_MIPS_ABI_EABI32 0x00004000
-#define E_MIPS_ABI_EABI64 0x00004000
-
-/*
- * Mips special sections.
- */
-#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */
-#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
-#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
-
-/*
- * Legal values for sh_type field of Elf32_Shdr.
- */
-#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */
-#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */
-#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */
-#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
-#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information */
-#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */
-
-/*
- * Legal values for sh_flags field of Elf32_Shdr.
- */
-#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */
-
-#if 0
-/*
- * Entries found in sections of type SHT_MIPS_GPTAB.
- */
-typedef union {
- struct {
- Elf32_Word gt_current_g_value; /* -G val used in compilation */
- Elf32_Word gt_unused; /* Not used */
- } gt_header; /* First entry in section */
- struct {
- Elf32_Word gt_g_value; /* If this val were used for -G */
- Elf32_Word gt_bytes; /* This many bytes would be used */
- } gt_entry; /* Subsequent entries in section */
-} Elf32_gptab;
-
-/*
- * Entry found in sections of type SHT_MIPS_REGINFO.
- */
-typedef struct {
- Elf32_Word ri_gprmask; /* General registers used */
- Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */
- Elf32_Sword ri_gp_value; /* $gp register value */
-} Elf32_RegInfo;
-#endif
-
-
-/*
- * Mips relocations.
- */
-
-#define R_MIPS_NONE 0 /* No reloc */
-#define R_MIPS_16 1 /* Direct 16 bit */
-#define R_MIPS_32 2 /* Direct 32 bit */
-#define R_MIPS_REL32 3 /* PC relative 32 bit */
-#define R_MIPS_26 4 /* Direct 26 bit shifted */
-#define R_MIPS_HI16 5 /* High 16 bit */
-#define R_MIPS_LO16 6 /* Low 16 bit */
-#define R_MIPS_GPREL16 7 /* GP relative 16 bit */
-#define R_MIPS_LITERAL 8 /* 16 bit literal entry */
-#define R_MIPS_GOT16 9 /* 16 bit GOT entry */
-#define R_MIPS_PC16 10 /* PC relative 16 bit */
-#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
-#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
-
-#define R_MIPS_64 18
-
-#define R_MIPS_REL32_64 ((R_MIPS_64 << 8) | R_MIPS_REL32)
-
-
-#endif /* !_MIPS64_EXEC_H_ */
diff --git a/libc/arch-mips64/include/machine/exec.h b/libc/arch-mips64/include/machine/exec.h
deleted file mode 100644
index 3c63f74..0000000
--- a/libc/arch-mips64/include/machine/exec.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/* $OpenBSD: exec.h,v 1.1 2004/10/18 19:05:36 grange Exp $ */
-
-/*
- * Copyright (c) 1996-2004 Per Fogelstrom, Opsycon AB
- *
- * 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.
- *
- * 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 _MIPS64_EXEC_H_
-#define _MIPS64_EXEC_H_
-
-#define __LDPGSZ 4096
-
-/*
- * Define what exec "formats" we should handle.
- */
-#define NATIVE_EXEC_ELF
-#define NATIVE_ELFSIZE 64
-#define EXEC_SCRIPT
-
-/*
- * If included from sys/exec.h define kernels ELF format.
- */
-#ifdef __LP64__
-#define ARCH_ELFSIZE 64
-#define DB_ELFSIZE 64
-#define ELF_TARG_CLASS ELFCLASS64
-#else
-#define ARCH_ELFSIZE 32
-#define DB_ELFSIZE 32
-#define ELF_TARG_CLASS ELFCLASS32
-#endif
-
-#if defined(__MIPSEB__)
-#define ELF_TARG_DATA ELFDATA2MSB
-#else
-#define ELF_TARG_DATA ELFDATA2LSB
-#endif
-#define ELF_TARG_MACH EM_MIPS
-
-#define _NLIST_DO_ELF
-
-#if defined(_LP64)
-#define _KERN_DO_ELF64
-#if defined(COMPAT_O32)
-#define _KERN_DO_ELF
-#endif
-#else
-#define _KERN_DO_ELF
-#endif
-
-/* Information taken from MIPS ABI supplemental */
-
-/* Architecture dependent Segment types - p_type */
-#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */
-
-/* Architecture dependent d_tag field for Elf32_Dyn. */
-#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime Linker Interface ID */
-#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
-#define DT_MIPS_ICHECKSUM 0x70000003 /* Cksum of ext. str. and com. sizes */
-#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
-#define DT_MIPS_FLAGS 0x70000005 /* Flags */
-#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Segment base address */
-#define DT_MIPS_CONFLICT 0x70000008 /* Adr of .conflict section */
-#define DT_MIPS_LIBLIST 0x70000009 /* Address of .liblist section */
-#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local .GOT entries */
-#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of .conflict entries */
-#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of .liblist entries */
-#define DT_MIPS_SYMTABNO 0x70000011 /* Number of .dynsym entries */
-#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
-#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in .dynsym */
-#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
-#define DT_MIPS_RLD_MAP 0x70000016 /* Address of debug map pointer */
-
-#define DT_PROCNUM (DT_MIPS_RLD_MAP - DT_LOPROC + 1)
-
-/*
- * Legal values for e_flags field of Elf32_Ehdr.
- */
-#define EF_MIPS_NOREORDER 0x00000001 /* .noreorder was used */
-#define EF_MIPS_PIC 0x00000002 /* Contains PIC code */
-#define EF_MIPS_CPIC 0x00000004 /* Uses PIC calling sequence */
-#define EF_MIPS_ABI2 0x00000020 /* -n32 on Irix 6 */
-#define EF_MIPS_32BITMODE 0x00000100 /* 64 bit in 32 bit mode... */
-#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */
-#define E_MIPS_ARCH_1 0x00000000
-#define E_MIPS_ARCH_2 0x10000000
-#define E_MIPS_ARCH_3 0x20000000
-#define E_MIPS_ARCH_4 0x30000000
-#define EF_MIPS_ABI 0x0000f000 /* ABI level */
-#define E_MIPS_ABI_NONE 0x00000000 /* ABI level not set */
-#define E_MIPS_ABI_O32 0x00001000
-#define E_MIPS_ABI_O64 0x00002000
-#define E_MIPS_ABI_EABI32 0x00004000
-#define E_MIPS_ABI_EABI64 0x00004000
-
-/*
- * Mips special sections.
- */
-#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */
-#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
-#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
-
-/*
- * Legal values for sh_type field of Elf32_Shdr.
- */
-#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */
-#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */
-#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */
-#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
-#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information */
-#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */
-
-/*
- * Legal values for sh_flags field of Elf32_Shdr.
- */
-#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */
-
-#if 0
-/*
- * Entries found in sections of type SHT_MIPS_GPTAB.
- */
-typedef union {
- struct {
- Elf32_Word gt_current_g_value; /* -G val used in compilation */
- Elf32_Word gt_unused; /* Not used */
- } gt_header; /* First entry in section */
- struct {
- Elf32_Word gt_g_value; /* If this val were used for -G */
- Elf32_Word gt_bytes; /* This many bytes would be used */
- } gt_entry; /* Subsequent entries in section */
-} Elf32_gptab;
-
-/*
- * Entry found in sections of type SHT_MIPS_REGINFO.
- */
-typedef struct {
- Elf32_Word ri_gprmask; /* General registers used */
- Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */
- Elf32_Sword ri_gp_value; /* $gp register value */
-} Elf32_RegInfo;
-#endif
-
-
-/*
- * Mips relocations.
- */
-
-#define R_MIPS_NONE 0 /* No reloc */
-#define R_MIPS_16 1 /* Direct 16 bit */
-#define R_MIPS_32 2 /* Direct 32 bit */
-#define R_MIPS_REL32 3 /* PC relative 32 bit */
-#define R_MIPS_26 4 /* Direct 26 bit shifted */
-#define R_MIPS_HI16 5 /* High 16 bit */
-#define R_MIPS_LO16 6 /* Low 16 bit */
-#define R_MIPS_GPREL16 7 /* GP relative 16 bit */
-#define R_MIPS_LITERAL 8 /* 16 bit literal entry */
-#define R_MIPS_GOT16 9 /* 16 bit GOT entry */
-#define R_MIPS_PC16 10 /* PC relative 16 bit */
-#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
-#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
-
-#define R_MIPS_64 18
-
-#define R_MIPS_REL32_64 ((R_MIPS_64 << 8) | R_MIPS_REL32)
-
-
-#endif /* !_MIPS64_EXEC_H_ */
diff --git a/libc/arch-x86/include/machine/exec.h b/libc/arch-x86/include/machine/exec.h
deleted file mode 100644
index d091741..0000000
--- a/libc/arch-x86/include/machine/exec.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $OpenBSD: exec.h,v 1.9 2003/04/17 03:42:14 drahn Exp $ */
-/* $NetBSD: exec.h,v 1.6 1994/10/27 04:16:05 cgd Exp $ */
-
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * 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 _I386_EXEC_H_
-#define _I386_EXEC_H_
-
-#define __LDPGSZ 4096
-
-#define NATIVE_EXEC_ELF
-
-#define ARCH_ELFSIZE 32
-
-#define ELF_TARG_CLASS ELFCLASS32
-#define ELF_TARG_DATA ELFDATA2LSB
-#define ELF_TARG_MACH EM_386 /* XXX - EM_486 is currently unused
- by all OSs/compilers/linkers */
-
-#define _NLIST_DO_AOUT
-#define _NLIST_DO_ELF
-
-#define _KERN_DO_AOUT
-#define _KERN_DO_ELF
-
-#endif /* _I386_EXEC_H_ */
diff --git a/libc/arch-x86_64/include/machine/exec.h b/libc/arch-x86_64/include/machine/exec.h
deleted file mode 100644
index 829351c..0000000
--- a/libc/arch-x86_64/include/machine/exec.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $OpenBSD: exec.h,v 1.4 2012/09/11 15:44:17 deraadt Exp $ */
-/*
- * Written by Artur Grabowski <art@openbsd.org> Public Domain
- */
-
-#ifndef _MACHINE_EXEC_H_
-#define _MACHINE_EXEC_H_
-
-#define __LDPGSZ 4096
-
-#define ARCH_ELFSIZE 64
-
-#define ELF_TARG_CLASS ELFCLASS64
-#define ELF_TARG_DATA ELFDATA2LSB
-#define ELF_TARG_MACH EM_X86_64
-
-#define _NLIST_DO_ELF
-#define _KERN_DO_ELF64
-
-#endif
diff --git a/linker/linker_phdr.cpp b/linker/linker_phdr.cpp
index 61ae5ab..ffd4de2 100644
--- a/linker/linker_phdr.cpp
+++ b/linker/linker_phdr.cpp
@@ -29,7 +29,6 @@
#include "linker_phdr.h"
#include <errno.h>
-#include <machine/exec.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -38,6 +37,20 @@
#include "linker.h"
#include "linker_debug.h"
+static int GetTargetElfMachine() {
+#if defined(__arm__)
+ return EM_ARM;
+#elif defined(__aarch64__)
+ return EM_AARCH64;
+#elif defined(__i386__)
+ return EM_386;
+#elif defined(__mips__)
+ return EM_MIPS;
+#elif defined(__x86_64__)
+ return EM_X86_64;
+#endif
+}
+
/**
TECHNICAL NOTE ON ELF LOADING.
@@ -200,7 +213,7 @@
return false;
}
- if (header_.e_machine != ELF_TARG_MACH) {
+ if (header_.e_machine != GetTargetElfMachine()) {
DL_ERR("\"%s\" has unexpected e_machine: %d", name_, header_.e_machine);
return false;
}