Index: head/contrib/elftoolchain/brandelf/brandelf.c =================================================================== --- head/contrib/elftoolchain/brandelf/brandelf.c +++ head/contrib/elftoolchain/brandelf/brandelf.c @@ -46,11 +46,6 @@ ELFTC_VCSID("$Id: brandelf.c 3440 2016-04-07 14:51:47Z emaste $"); -/* Backwards compatability for older FreeBSD releases. */ -#ifndef ELFOSABI_CLOUDABI -#define ELFOSABI_CLOUDABI 17 -#endif - static int elftype(const char *); static const char *iselftype(int); static void printelftypes(void); Index: head/contrib/elftoolchain/elfcopy/main.c =================================================================== --- head/contrib/elftoolchain/elfcopy/main.c +++ head/contrib/elftoolchain/elfcopy/main.c @@ -41,11 +41,6 @@ ELFTC_VCSID("$Id: main.c 3446 2016-05-03 01:31:17Z emaste $"); -/* Backwards compatability for older FreeBSD releases. */ -#ifndef ELFOSABI_CLOUDABI -#define ELFOSABI_CLOUDABI 17 -#endif - enum options { ECP_ADD_GNU_DEBUGLINK, Index: head/contrib/elftoolchain/elfdump/elfdump.c =================================================================== --- head/contrib/elftoolchain/elfdump/elfdump.c +++ head/contrib/elftoolchain/elfdump/elfdump.c @@ -52,14 +52,6 @@ ELFTC_VCSID("$Id: elfdump.c 3474 2016-05-17 20:44:53Z emaste $"); -/* Backwards compatability for older FreeBSD releases. */ -#ifndef EM_IAMCU -#define EM_IAMCU 6 -#endif -#ifndef EM_RISCV -#define EM_RISCV 243 -#endif - #if defined(ELFTC_NEED_ELF_NOTE_DEFINITION) #include "native-elf-format.h" #if ELFTC_CLASS == ELFCLASS32 Index: head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c =================================================================== --- head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c +++ head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c @@ -28,11 +28,6 @@ ELFTC_VCSID("$Id: libdwarf_reloc.c 3198 2015-05-14 18:36:19Z emaste $"); -/* Backwards compatability for older FreeBSD releases. */ -#ifndef EM_IAMCU -#define EM_IAMCU 6 -#endif - Dwarf_Unsigned _dwarf_get_reloc_type(Dwarf_P_Debug dbg, int is64) { Index: head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c =================================================================== --- head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c +++ head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c @@ -31,14 +31,6 @@ #include #include -/* Backwards compatability for older FreeBSD releases. */ -#ifndef EM_IAMCU -#define EM_IAMCU 6 -#endif -#ifndef EM_RISCV -#define EM_RISCV 243 -#endif - const char * elftc_reloc_type_str(unsigned int mach, unsigned int type) { Index: head/contrib/elftoolchain/readelf/readelf.c =================================================================== --- head/contrib/elftoolchain/readelf/readelf.c +++ head/contrib/elftoolchain/readelf/readelf.c @@ -50,15 +50,6 @@ ELFTC_VCSID("$Id: readelf.c 3469 2016-05-15 23:16:09Z emaste $"); /* Backwards compatability for older FreeBSD releases. */ -#ifndef ELFOSABI_CLOUDABI -#define ELFOSABI_CLOUDABI 17 -#endif -#ifndef EM_IAMCU -#define EM_IAMCU 6 -#endif -#ifndef EM_RISCV -#define EM_RISCV 243 -#endif #ifndef STB_GNU_UNIQUE #define STB_GNU_UNIQUE 10 #endif Index: head/lib/libelftc/Makefile =================================================================== --- head/lib/libelftc/Makefile +++ head/lib/libelftc/Makefile @@ -29,4 +29,17 @@ MAN= +# This same hack is in lib/libelf/Makefile and usr.bin/readelf/Makefile +# We need to link against the correct version of these files. One +# solution is to include ../../sys in the include path. This causes +# problems when a header file in sys depends on a file in another +# part of the tree, e.g. a machine dependent header. +# +SRCS+= sys/elf_common.h +CLEANDIRS= sys +CFLAGS+= -I. +sys/elf_common.h: ${SRCTOP}/sys/${.TARGET} .NOMETA + mkdir -p ${.OBJDIR}/sys + ln -sf ${.ALLSRC} ${.TARGET} + .include