From c70816ace73c6df874bc2056c317f52535e620cf Mon Sep 17 00:00:00 2001 From: Wolfgang Thaller Date: Thu, 28 Sep 2017 23:44:08 +0200 Subject: [PATCH] hack libelf to work --- libelf/include/elf.h | 6 ------ libelf/src/common.h | 3 +-- libelf/src/config.h | 9 +++++++-- libelf/src/elf32_checksum.c | 2 +- libelf/src/elf32_fsize.c | 5 +++-- libelf/src/elf32_updatenull.c | 2 +- libelf/src/elf32_xlatetof.c | 2 +- libelf/src/elf32_xlatetom.c | 2 +- libelf/src/elf_error.c | 3 ++- libelf/src/elf_getarsym.c | 4 +--- libelf/src/gelf_xlate.c | 2 +- libelf/src/libelfP.h | 4 ++-- 12 files changed, 21 insertions(+), 23 deletions(-) diff --git a/libelf/include/elf.h b/libelf/include/elf.h index fa35203dfe..f66da00a07 100644 --- a/libelf/include/elf.h +++ b/libelf/include/elf.h @@ -19,10 +19,6 @@ #ifndef _ELF_H #define _ELF_H 1 -#include - -__BEGIN_DECLS - /* Standard ELF types. */ #include @@ -3683,6 +3679,4 @@ enum #define R_BPF_NONE 0 /* No reloc */ #define R_BPF_MAP_FD 1 /* Map fd to pointer */ -__END_DECLS - #endif /* elf.h */ diff --git a/libelf/src/common.h b/libelf/src/common.h index 744f1bb813..85a7c1f9d1 100644 --- a/libelf/src/common.h +++ b/libelf/src/common.h @@ -31,10 +31,9 @@ #define _COMMON_H 1 #include -#include -#include #include #include +#include "portable_endian.h" #include "libelfP.h" diff --git a/libelf/src/config.h b/libelf/src/config.h index 400cdc6e77..13e8bdb026 100644 --- a/libelf/src/config.h +++ b/libelf/src/config.h @@ -56,8 +56,10 @@ #define N_(Str) Str /* Compiler-specific definitions. */ -#define strong_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((alias (#name))); +//#define strong_alias(name, aliasname) \ + // extern __typeof (name) aliasname __attribute__ ((alias (#name))); + +#define strong_alias(name, aliasname) #ifdef __i386__ # define internal_function __attribute__ ((regparm (3), stdcall)) @@ -186,5 +188,8 @@ asm (".section predict_data, \"aw\"; .previous\n" # define COMPAT_VERSION(name, version, prefix) error "should use #ifdef SYMBOL_VERSIONING" #endif +#define bswap_16(x) __builtin_bswap16(x) +#define bswap_32(x) __builtin_bswap32(x) +#define bswap_64(x) __builtin_bswap64(x) #endif /* eu-config.h */ diff --git a/libelf/src/elf32_checksum.c b/libelf/src/elf32_checksum.c index f9dfccb2c0..aab19ff8b2 100644 --- a/libelf/src/elf32_checksum.c +++ b/libelf/src/elf32_checksum.c @@ -32,7 +32,6 @@ #endif #include -#include #include #include #include @@ -40,6 +39,7 @@ #include "gelf.h" #include "libelfP.h" #include "elf-knowledge.h" +#include "portable_endian.h" #ifndef LIBELFBITS # define LIBELFBITS 32 diff --git a/libelf/src/elf32_fsize.c b/libelf/src/elf32_fsize.c index fddae91ed2..df0fcc78fb 100644 --- a/libelf/src/elf32_fsize.c +++ b/libelf/src/elf32_fsize.c @@ -64,5 +64,6 @@ elfw2(LIBELFBITS, fsize) (Elf_Type type, size_t count, unsigned int version) * __libelf_type_sizes[0][ELFW(ELFCLASS,LIBELFBITS) - 1][type]); #endif } -#define local_strong_alias(n1, n2) strong_alias (n1, n2) -local_strong_alias (elfw2(LIBELFBITS, fsize), __elfw2(LIBELFBITS, msize)) + +//#define local_strong_alias(n1, n2) strong_alias (n1, n2) +//local_strong_alias (elfw2(LIBELFBITS, fsize), __elfw2(LIBELFBITS, msize)) diff --git a/libelf/src/elf32_updatenull.c b/libelf/src/elf32_updatenull.c index d83c0b3f0c..99cd6d1e08 100644 --- a/libelf/src/elf32_updatenull.c +++ b/libelf/src/elf32_updatenull.c @@ -32,7 +32,6 @@ #endif #include -#include #include #include #include @@ -40,6 +39,7 @@ #include #include "libelfP.h" #include "elf-knowledge.h" +#include "portable_endian.h" #ifndef LIBELFBITS # define LIBELFBITS 32 diff --git a/libelf/src/elf32_xlatetof.c b/libelf/src/elf32_xlatetof.c index ac4eaf400c..923b085668 100644 --- a/libelf/src/elf32_xlatetof.c +++ b/libelf/src/elf32_xlatetof.c @@ -32,10 +32,10 @@ #endif #include -#include #include #include "libelfP.h" +#include "portable_endian.h" #ifndef LIBELFBITS # define LIBELFBITS 32 diff --git a/libelf/src/elf32_xlatetom.c b/libelf/src/elf32_xlatetom.c index 13cd485dba..36c942ffda 100644 --- a/libelf/src/elf32_xlatetom.c +++ b/libelf/src/elf32_xlatetom.c @@ -32,10 +32,10 @@ #endif #include -#include #include #include "libelfP.h" +#include "portable_endian.h" #ifndef LIBELFBITS # define LIBELFBITS 32 diff --git a/libelf/src/elf_error.c b/libelf/src/elf_error.c index 05cb43b110..ffddfdd229 100644 --- a/libelf/src/elf_error.c +++ b/libelf/src/elf_error.c @@ -32,13 +32,14 @@ #endif #include -#include +//#include #include #include #include #include "libelfP.h" +#define N_(x) x /* The error number. */ static /* __thread */ int global_error; diff --git a/libelf/src/elf_getarsym.c b/libelf/src/elf_getarsym.c index 1f031fcaab..ab4c05b85a 100644 --- a/libelf/src/elf_getarsym.c +++ b/libelf/src/elf_getarsym.c @@ -32,8 +32,6 @@ #endif #include -#include -#include #include #include #include @@ -44,7 +42,7 @@ #include #include #include "libelfP.h" - +#include "portable_endian.h" static int read_number_entries (uint64_t *nump, Elf *elf, size_t *offp, bool index64_p) diff --git a/libelf/src/gelf_xlate.c b/libelf/src/gelf_xlate.c index f3d3b7a06f..073bc9d41d 100644 --- a/libelf/src/gelf_xlate.c +++ b/libelf/src/gelf_xlate.c @@ -31,12 +31,12 @@ # include #endif -#include #include #include #include #include "libelfP.h" +#include "portable_endian.h" #ifndef LIBELFBITS # define LIBELFBITS 32 diff --git a/libelf/src/libelfP.h b/libelf/src/libelfP.h index 7ee6625a45..66f6b9ea9a 100644 --- a/libelf/src/libelfP.h +++ b/libelf/src/libelfP.h @@ -40,8 +40,8 @@ #include /* gettext helper macros. */ -#define _(Str) dgettext ("elfutils", Str) - +//#define _(Str) dgettext ("elfutils", Str) +#define _(Str) Str /* Helper Macros to write 32 bit and 64 bit functions. */ #define __elfw2_(Bits, Name) __elf##Bits##_##Name