summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2016-06-05 23:05:14 +0000
committerbdrewery <bdrewery@FreeBSD.org>2016-06-05 23:05:14 +0000
commit3456e2d15bd813b18a8e16b7b309dd6ca35b8f5b (patch)
tree3a83a4cae9bd6509e05ca1cc1b2870ee113f848f
parent65190668661ad93b1ab4bffe3013104a8a2baa6f (diff)
downloadFreeBSD-src-3456e2d15bd813b18a8e16b7b309dd6ca35b8f5b.zip
FreeBSD-src-3456e2d15bd813b18a8e16b7b309dd6ca35b8f5b.tar.gz
Use the in-tree sys/elf_common.h to build libelftc.
This fixes build failures on older releases that lack various definitions such as EM_AARCH64 (which was unfixed before this). Revert all of the recent compatibility changes that worked around this problem. This uses the same method of using the in-tree header as lib/libelf, lib/libdwarf and usr.bin/readelf. Reviewed by: emaste Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D6734
-rw-r--r--contrib/elftoolchain/brandelf/brandelf.c5
-rw-r--r--contrib/elftoolchain/elfcopy/main.c5
-rw-r--r--contrib/elftoolchain/elfdump/elfdump.c8
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_reloc.c5
-rw-r--r--contrib/elftoolchain/libelftc/elftc_reloc_type_str.c8
-rw-r--r--contrib/elftoolchain/readelf/readelf.c9
-rw-r--r--lib/libelftc/Makefile13
7 files changed, 13 insertions, 40 deletions
diff --git a/contrib/elftoolchain/brandelf/brandelf.c b/contrib/elftoolchain/brandelf/brandelf.c
index d41b926..7cc93f0 100644
--- a/contrib/elftoolchain/brandelf/brandelf.c
+++ b/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);
diff --git a/contrib/elftoolchain/elfcopy/main.c b/contrib/elftoolchain/elfcopy/main.c
index 89ffab2..ebc0c92 100644
--- a/contrib/elftoolchain/elfcopy/main.c
+++ b/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,
diff --git a/contrib/elftoolchain/elfdump/elfdump.c b/contrib/elftoolchain/elfdump/elfdump.c
index 36a8dfd..cf27ea6 100644
--- a/contrib/elftoolchain/elfdump/elfdump.c
+++ b/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
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_reloc.c b/contrib/elftoolchain/libdwarf/libdwarf_reloc.c
index 19325c1..15bae9c 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_reloc.c
+++ b/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)
{
diff --git a/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
index 1e977a7..a22a1be 100644
--- a/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
+++ b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
@@ -31,14 +31,6 @@
#include <libelftc.h>
#include <stdio.h>
-/* 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)
{
diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c
index fcfc75d..79cb8b7 100644
--- a/contrib/elftoolchain/readelf/readelf.c
+++ b/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
diff --git a/lib/libelftc/Makefile b/lib/libelftc/Makefile
index eed7acf..5a9d17d 100644
--- a/lib/libelftc/Makefile
+++ b/lib/libelftc/Makefile
@@ -29,4 +29,17 @@ CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
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 <bsd.lib.mk>
OpenPOWER on IntegriCloud