mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2024-12-26 00:22:47 +00:00
tools/libelf: remove unneeded host library
This old ELF library dating to 2009 used to be necessary on MacOS but
is not required for building the kernel or tools since [1]. On Linux
systems, libelf is already an OpenWRT build-system prerequisite [2].
Presence of the older library can mask or conflict with the system libelf
and lead to build errors, as seen compiling Linux kernels since v5.8 or
host tools such as dwarves (e.g. pahole).
Remove the unnecessary tools/libelf library and avoid the related issues.
[1] 5f8e587240
("build: force disable stack validation during kernel build
on non-linux systems")
[2] https://openwrt.org/docs/guide-developer/build-system/install-buildsystem#prerequisites
Tested-by: Rosen Penev <rosenp@gmail.com> (Linux)
Tested-by: Georgi Valkov <gvalkov@abv.bg> (MacOS)
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
This commit is contained in:
parent
29e2be69c4
commit
bf4aa0c6a2
@ -28,7 +28,7 @@ tools-y += mklibs mm-macros mtd-utils mtools padjffs2 patch-image
|
||||
tools-y += patchelf pkgconf quilt squashfskit4 sstrip xxd zip zlib zstd
|
||||
tools-$(BUILD_B43_TOOLS) += b43-tools
|
||||
tools-$(BUILD_ISL) += isl
|
||||
tools-$(BUILD_TOOLCHAIN) += expat gmp libelf mpc mpfr
|
||||
tools-$(BUILD_TOOLCHAIN) += expat gmp mpc mpfr
|
||||
tools-$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini) += genext2fs
|
||||
tools-$(CONFIG_TARGET_ath79) += lzma-old squashfs
|
||||
tools-$(CONFIG_TARGET_mxs) += elftosb sdimage
|
||||
@ -53,7 +53,6 @@ $(curdir)/flex/compile := $(curdir)/libtool/compile
|
||||
$(curdir)/gengetopt/compile := $(curdir)/libtool/compile
|
||||
$(curdir)/gmp/compile := $(curdir)/libtool/compile
|
||||
$(curdir)/isl/compile := $(curdir)/gmp/compile
|
||||
$(curdir)/libelf/compile := $(curdir)/libtool/compile
|
||||
$(curdir)/libressl/compile := $(curdir)/pkgconf/compile
|
||||
$(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile
|
||||
$(curdir)/lzma-old/compile := $(curdir)/zlib/compile
|
||||
|
@ -1,58 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libelf
|
||||
PKG_VERSION:=0.8.13
|
||||
PKG_HASH:=591a9b4ec81c1f2042a97aa60564e0cb79d041c52faa7416acb38bc95bd2c76d
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:= \
|
||||
http://distfiles.gentoo.org/distfiles/ \
|
||||
http://distcache.freebsd.org/ports-distfiles/
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
|
||||
HOST_FIXUP:=autoreconf
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
PKG_REMOVE_FILES :=
|
||||
|
||||
HOST_CONFIGURE_ARGS += \
|
||||
--disable-shared \
|
||||
--enable-elf64
|
||||
|
||||
define Host/Configure
|
||||
(cd $(HOST_BUILD_DIR)/$(3); \
|
||||
$(HOST_CONFIGURE_CMD) \
|
||||
$(HOST_CONFIGURE_ARGS); \
|
||||
)
|
||||
endef
|
||||
|
||||
|
||||
define Host/Compile
|
||||
+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/lib/ libelf.a
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_HOST)/{lib/pkgconfig,include/libelf}
|
||||
$(CP) $(HOST_BUILD_DIR)/lib/{elf_repl.h,gelf.h,libelf.h,nlist.h,sys_elf.h} \
|
||||
$(STAGING_DIR_HOST)/include/libelf/
|
||||
$(CP) $(HOST_BUILD_DIR)/lib/libelf.a $(STAGING_DIR_HOST)/lib/
|
||||
$(CP) $(HOST_BUILD_DIR)/libelf.pc $(STAGING_DIR_HOST)/lib/pkgconfig/
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -rf $(STAGING_DIR_HOST)/include/libelf
|
||||
rm -f $(STAGING_DIR_HOST)/lib/libelf.a
|
||||
rm -f $(STAGING_DIR_HOST)/lib/pkgconfig/libelf.pc
|
||||
$(call Host/Clean/Default)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
@ -1,198 +0,0 @@
|
||||
--- a/lib/elf_repl.h
|
||||
+++ b/lib/elf_repl.h
|
||||
@@ -45,7 +45,7 @@ typedef __libelf_u32_t Elf32_Word;
|
||||
#define ELF32_FSZ_SWORD 4
|
||||
#define ELF32_FSZ_WORD 4
|
||||
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
|
||||
typedef __libelf_u64_t Elf64_Addr;
|
||||
typedef __libelf_u16_t Elf64_Half;
|
||||
@@ -93,7 +93,7 @@ typedef struct {
|
||||
Elf32_Half e_shstrndx;
|
||||
} Elf32_Ehdr;
|
||||
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
typedef struct {
|
||||
unsigned char e_ident[EI_NIDENT];
|
||||
Elf64_Half e_type;
|
||||
@@ -307,7 +307,7 @@ typedef struct {
|
||||
Elf32_Word sh_entsize;
|
||||
} Elf32_Shdr;
|
||||
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
typedef struct {
|
||||
Elf64_Word sh_name;
|
||||
Elf64_Word sh_type;
|
||||
@@ -434,7 +434,7 @@ typedef struct {
|
||||
Elf32_Half st_shndx;
|
||||
} Elf32_Sym;
|
||||
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
typedef struct {
|
||||
Elf64_Word st_name;
|
||||
unsigned char st_info;
|
||||
@@ -457,7 +457,7 @@ typedef struct {
|
||||
#define ELF32_ST_TYPE(i) ((i)&0xf)
|
||||
#define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
|
||||
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
#define ELF64_ST_BIND(i) ((i)>>4)
|
||||
#define ELF64_ST_TYPE(i) ((i)&0xf)
|
||||
#define ELF64_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
|
||||
@@ -495,7 +495,7 @@ typedef struct {
|
||||
* Macros for manipulating st_other
|
||||
*/
|
||||
#define ELF32_ST_VISIBILITY(o) ((o)&0x3)
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
#define ELF64_ST_VISIBILITY(o) ((o)&0x3)
|
||||
#endif /* __LIBELF64 */
|
||||
|
||||
@@ -521,7 +521,7 @@ typedef struct {
|
||||
Elf32_Sword r_addend;
|
||||
} Elf32_Rela;
|
||||
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
typedef struct {
|
||||
Elf64_Addr r_offset;
|
||||
Elf64_Xword r_info;
|
||||
@@ -541,7 +541,7 @@ typedef struct {
|
||||
#define ELF32_R_TYPE(i) ((unsigned char)(i))
|
||||
#define ELF32_R_INFO(s,t) (((s)<<8)+(unsigned char)(t))
|
||||
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
#define ELF64_R_SYM(i) ((Elf64_Xword)(i)>>32)
|
||||
#define ELF64_R_TYPE(i) ((i)&0xffffffffL)
|
||||
#define ELF64_R_INFO(s,t) (((Elf64_Xword)(s)<<32)+((t)&0xffffffffL))
|
||||
@@ -556,7 +556,7 @@ typedef struct {
|
||||
Elf32_Word n_type; /* descriptor type */
|
||||
} Elf32_Nhdr;
|
||||
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
/* Solaris and GNU use this layout. Be compatible. */
|
||||
/* XXX: Latest ELF specs say it's 64-bit!!! */
|
||||
typedef struct {
|
||||
@@ -587,7 +587,7 @@ typedef struct {
|
||||
Elf32_Word p_align;
|
||||
} Elf32_Phdr;
|
||||
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
typedef struct {
|
||||
Elf64_Word p_type;
|
||||
Elf64_Word p_flags;
|
||||
@@ -654,7 +654,7 @@ typedef struct {
|
||||
} d_un;
|
||||
} Elf32_Dyn;
|
||||
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
typedef struct {
|
||||
Elf64_Sxword d_tag;
|
||||
union {
|
||||
@@ -798,7 +798,7 @@ typedef struct {
|
||||
Elf32_Half si_flags;
|
||||
} Elf32_Syminfo;
|
||||
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
typedef struct {
|
||||
Elf64_Half si_boundto;
|
||||
Elf64_Half si_flags;
|
||||
@@ -863,7 +863,7 @@ typedef struct {
|
||||
|
||||
typedef Elf32_Half Elf32_Versym;
|
||||
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
|
||||
typedef struct {
|
||||
Elf64_Half vd_version;
|
||||
@@ -933,7 +933,7 @@ typedef Elf64_Half Elf64_Versym;
|
||||
/*
|
||||
* Move section
|
||||
*/
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
|
||||
typedef struct {
|
||||
Elf32_Lword m_value;
|
||||
@@ -973,7 +973,7 @@ typedef struct {
|
||||
} c_un;
|
||||
} Elf32_Cap;
|
||||
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
|
||||
typedef struct {
|
||||
Elf64_Xword c_tag;
|
||||
--- a/lib/gelf.h
|
||||
+++ b/lib/gelf.h
|
||||
@@ -22,15 +22,15 @@
|
||||
#ifndef _GELF_H
|
||||
#define _GELF_H
|
||||
|
||||
-#if __LIBELF_INTERNAL__
|
||||
+#if defined(__LIBELF_INTERNAL__)
|
||||
#include <libelf.h>
|
||||
#else /* __LIBELF_INTERNAL__ */
|
||||
#include <libelf/libelf.h>
|
||||
#endif /* __LIBELF_INTERNAL__ */
|
||||
|
||||
-#if __LIBELF_NEED_LINK_H
|
||||
+#if defined(__LIBELF_NEED_LINK_H)
|
||||
#include <link.h>
|
||||
-#elif __LIBELF_NEED_SYS_LINK_H
|
||||
+#elif defined(__LIBELF_NEED_SYS_LINK_H)
|
||||
#include <sys/link.h>
|
||||
#endif /* __LIBELF_NEED_LINK_H */
|
||||
|
||||
@@ -71,7 +71,7 @@ typedef Elf64_Sym GElf_Sym;
|
||||
/*
|
||||
* Symbol versioning
|
||||
*/
|
||||
-#if __LIBELF_SYMBOL_VERSIONS
|
||||
+#if defined(__LIBELF_SYMBOL_VERSIONS)
|
||||
typedef Elf64_Verdef GElf_Verdef;
|
||||
typedef Elf64_Verneed GElf_Verneed;
|
||||
typedef Elf64_Verdaux GElf_Verdaux;
|
||||
--- a/lib/libelf.h
|
||||
+++ b/lib/libelf.h
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <stddef.h> /* for size_t */
|
||||
#include <sys/types.h>
|
||||
|
||||
-#if __LIBELF_INTERNAL__
|
||||
+#if defined(__LIBELF_INTERNAL__)
|
||||
#include <sys_elf.h>
|
||||
#else /* __LIBELF_INTERNAL__ */
|
||||
#include <libelf/sys_elf.h>
|
||||
@@ -224,7 +224,7 @@ extern Elf_Data *elf32_xlatetom __P((Elf
|
||||
*/
|
||||
extern long elf32_checksum __P((Elf *__elf));
|
||||
|
||||
-#if __LIBELF64
|
||||
+#if defined(__LIBELF64)
|
||||
/*
|
||||
* 64-bit ELF functions
|
||||
* Not available on all platforms
|
||||
--- a/lib/sys_elf.h.in
|
||||
+++ b/lib/sys_elf.h.in
|
||||
@@ -116,7 +116,7 @@ Foundation, Inc., 51 Franklin Street, Fi
|
||||
# define ELF64_R_INFO(s,t) (((Elf64_Xword)(s)<<32)+((t)&0xffffffffL))
|
||||
# endif /* ELF64_R_SYM */
|
||||
|
||||
-# if __LIBELF64_LINUX
|
||||
+# if defined(__LIBELF64_LINUX)
|
||||
typedef __libelf_u64_t Elf64_Addr;
|
||||
typedef __libelf_u16_t Elf64_Half;
|
||||
typedef __libelf_u64_t Elf64_Off;
|
Loading…
Reference in New Issue
Block a user