elfutils: Fix build with uclibc/musl
Remove mempcpy patch its already in uclibc now refresh libargp patch to match latest elfutils Add ALLOW_EMPTY for musl core-image-cmdline-full asks for elfutils package to be added to package it has all eu-* tools but we dont build them on musl. nevertheless lets satisfy the dependency so image can build for musl Build libdw,libasm,libebl along with libelf enhance the musl portability patch to compile every other library except the eu-* tools Fix build on aarch64/musl issues Header inclusion ends up with duplicate definitions of iovec struct since uclibc defines the same in usersapce, we have been depending upong including the kernel header on aarch64, using sys/uio.h is the right approach Fix x86 build warning seen on musl (From OE-Core rev: a28c70455931e0b7e3449a76c3b9132bd572478b) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
047ad2c81a
commit
df95988e1e
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,47 @@
|
|||
Fix build on aarch64/musl
|
||||
|
||||
Errors
|
||||
|
||||
invalid operands to binary & (have 'long double' and 'unsigned int')
|
||||
|
||||
error: redefinition
|
||||
of 'struct iovec'
|
||||
struct iovec { void *iov_base; size_t iov_len; };
|
||||
^
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Index: elfutils-0.163/backends/aarch64_initreg.c
|
||||
===================================================================
|
||||
--- elfutils-0.163.orig/backends/aarch64_initreg.c
|
||||
+++ elfutils-0.163/backends/aarch64_initreg.c
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "system.h"
|
||||
#include <assert.h>
|
||||
#ifdef __aarch64__
|
||||
-# include <linux/uio.h>
|
||||
+# include <sys/uio.h>
|
||||
# include <sys/user.h>
|
||||
# include <sys/ptrace.h>
|
||||
/* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */
|
||||
@@ -82,7 +82,7 @@ aarch64_set_initial_registers_tid (pid_t
|
||||
|
||||
Dwarf_Word dwarf_fregs[32];
|
||||
for (int r = 0; r < 32; r++)
|
||||
- dwarf_fregs[r] = fregs.vregs[r] & 0xFFFFFFFF;
|
||||
+ dwarf_fregs[r] = (unsigned int)fregs.vregs[r] & 0xFFFFFFFF;
|
||||
|
||||
if (! setfunc (64, 32, dwarf_fregs, arg))
|
||||
return false;
|
||||
Index: elfutils-0.163/backends/arm_initreg.c
|
||||
===================================================================
|
||||
--- elfutils-0.163.orig/backends/arm_initreg.c
|
||||
+++ elfutils-0.163/backends/arm_initreg.c
|
||||
@@ -37,7 +37,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef __aarch64__
|
||||
-# include <linux/uio.h>
|
||||
+# include <sys/uio.h>
|
||||
# include <sys/user.h>
|
||||
# include <sys/ptrace.h>
|
||||
/* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */
|
|
@ -0,0 +1,23 @@
|
|||
Fix control path where we have str as uninitialized string
|
||||
|
||||
| /home/ubuntu/work/oe/openembedded-core/build/tmp-musl/work/i586-oe-linux-musl/elfutils/0.164-r0/elfutils-0.164/libcpu/i386_disasm.c: In function 'i386_disasm':
|
||||
| /home/ubuntu/work/oe/openembedded-core/build/tmp-musl/work/i586-oe-linux-musl/elfutils/0.164-r0/elfutils-0.164/libcpu/i386_disasm.c:310:5: error: 'str' may be used uninitialized in this function [-Werror=maybe-uninitialized]
|
||||
| memcpy (buf + bufcnt, _str, _len); \
|
||||
| ^
|
||||
| /home/ubuntu/work/oe/openembedded-core/build/tmp-musl/work/i586-oe-linux-musl/elfutils/0.164-r0/elfutils-0.164/libcpu/i386_disasm.c:709:17: note: 'str' was declared here
|
||||
| const char *str;
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Upstream-Status: Pending
|
||||
Index: elfutils-0.164/libcpu/i386_disasm.c
|
||||
===================================================================
|
||||
--- elfutils-0.164.orig/libcpu/i386_disasm.c
|
||||
+++ elfutils-0.164/libcpu/i386_disasm.c
|
||||
@@ -821,6 +821,7 @@ i386_disasm (const uint8_t **startp, con
|
||||
}
|
||||
|
||||
default:
|
||||
+ str = "";
|
||||
assert (! "INVALID not handled");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
From 3daec2dd11a04955f95e8f65a48820103d84dbec Mon Sep 17 00:00:00 2001
|
||||
From: Junling Zheng <zhengjunling@huawei.com>
|
||||
Date: Thu, 9 Apr 2015 12:12:49 +0000
|
||||
Subject: [PATCH] uclibc support for elfutils 0.161
|
||||
|
||||
on uclibc systems libintl and libuargp are separate from libc.
|
||||
so they need to be specified on commandline when we use proxy-libintl
|
||||
then libintl is a static archive so it should be listed last since
|
||||
elfutils does not respect disable-nls we need to link in libintl
|
||||
|
||||
We add a new option --enable-uclibc which will be used to control
|
||||
the uclibc specific configurations during build.
|
||||
|
||||
Upstream-Status: Inappropriate [uclibc specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem>
|
||||
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
|
||||
[Junling Zheng:
|
||||
- adjust context
|
||||
]
|
||||
---
|
||||
configure.ac | 8 ++++++++
|
||||
libcpu/Makefile.am | 4 ++++
|
||||
libdw/Makefile.am | 7 ++++++-
|
||||
libelf/Makefile.am | 5 +++++
|
||||
4 files changed, 23 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: elfutils-0.164/configure.ac
|
||||
===================================================================
|
||||
--- elfutils-0.164.orig/configure.ac
|
||||
+++ elfutils-0.164/configure.ac
|
||||
@@ -66,6 +66,14 @@ AS_IF([test "$use_locks" = yes],
|
||||
|
||||
AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
|
||||
|
||||
+AC_ARG_ENABLE([uclibc],
|
||||
+AS_HELP_STRING([--enable-uclibc], [Use uclibc for system libraries]),
|
||||
+use_uclibc=yes, use_uclibc=no)
|
||||
+AM_CONDITIONAL(USE_UCLIBC, test "$use_uclibc" = yes)
|
||||
+AS_IF([test "$use_uclibc" = yes], [AC_DEFINE(USE_UCLIBC)])
|
||||
+
|
||||
+AH_TEMPLATE([USE_UCLIBC], [Defined if uclibc libraries are used.])
|
||||
+
|
||||
AC_PROG_CC
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_YACC
|
||||
@@ -291,18 +299,13 @@ AC_LINK_IFELSE(
|
||||
)
|
||||
|
||||
dnl If our libc doesn't provide argp, then test for libargp
|
||||
-if test "$libc_has_argp" = "false" ; then
|
||||
- AC_MSG_WARN("libc does not have argp")
|
||||
- AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"])
|
||||
-
|
||||
- if test "$have_argp" = "false"; then
|
||||
- AC_MSG_ERROR("no libargp found")
|
||||
- else
|
||||
- argp_LDADD="-largp"
|
||||
- fi
|
||||
-else
|
||||
- argp_LDADD=""
|
||||
-fi
|
||||
+AS_IF([test "x$libc_has_argp" = "xfalse"],
|
||||
+ [AC_MSG_WARN("libc does not have argp")
|
||||
+ AC_CHECK_LIB([argp], [argp_parse], [have_argp="true" argp_LDADD="-largp"], [have_argp="false"])], [argp_LDADD=""])
|
||||
+
|
||||
+AS_IF([test "x$libc_has_argp" = "xfalse" -a "x$have_argp" = "xfalse"],
|
||||
+ AC_CHECK_LIB([uargp], [argp_parse], [have_uargp="true" argp_LDADD="-luargp"], [have_uargp="false"])], [argp_LDADD=""])
|
||||
+
|
||||
AC_SUBST([argp_LDADD])
|
||||
|
||||
dnl The directories with content.
|
||||
Index: elfutils-0.164/libcpu/Makefile.am
|
||||
===================================================================
|
||||
--- elfutils-0.164.orig/libcpu/Makefile.am
|
||||
+++ elfutils-0.164/libcpu/Makefile.am
|
||||
@@ -80,6 +80,10 @@ i386_parse_CFLAGS = -DNMNES="`wc -l < i3
|
||||
i386_lex.o: i386_parse.h
|
||||
i386_gendis_LDADD = $(libeu) -lm
|
||||
|
||||
+if USE_UCLIBC
|
||||
+i386_gendis_LDADD += -lintl
|
||||
+endif
|
||||
+
|
||||
i386_parse.h: i386_parse.c ;
|
||||
|
||||
EXTRA_DIST = defs/i386
|
||||
Index: elfutils-0.164/libdw/Makefile.am
|
||||
===================================================================
|
||||
--- elfutils-0.164.orig/libdw/Makefile.am
|
||||
+++ elfutils-0.164/libdw/Makefile.am
|
||||
@@ -102,6 +102,11 @@ endif
|
||||
libdw_pic_a_SOURCES =
|
||||
am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
|
||||
|
||||
+libdw_so_LDLIBS =
|
||||
+if USE_UCLIBC
|
||||
+libdw_so_LDLIBS += -lintl
|
||||
+endif
|
||||
+
|
||||
libdw_so_SOURCES =
|
||||
libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
|
||||
../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
|
||||
@@ -112,7 +117,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map l
|
||||
-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
|
||||
-Wl,--version-script,$<,--no-undefined \
|
||||
-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
|
||||
- -ldl $(argp_LDADD) $(zip_LIBS)
|
||||
+ -ldl $(argp_LDADD) $(zip_LIBS) $(libdw_so_LDLIBS)
|
||||
@$(textrel_check)
|
||||
$(AM_V_at)ln -fs $@ $@.$(VERSION)
|
||||
|
||||
Index: elfutils-0.164/libelf/Makefile.am
|
||||
===================================================================
|
||||
--- elfutils-0.164.orig/libelf/Makefile.am
|
||||
+++ elfutils-0.164/libelf/Makefile.am
|
||||
@@ -93,7 +93,12 @@ libelf_a_SOURCES = elf_version.c elf_has
|
||||
libelf_pic_a_SOURCES =
|
||||
am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
|
||||
|
||||
+
|
||||
libelf_so_LDLIBS =
|
||||
+if USE_UCLIBC
|
||||
+libelf_so_LDLIBS += -lintl
|
||||
+endif
|
||||
+
|
||||
if USE_LOCKS
|
||||
libelf_so_LDLIBS += -lpthread
|
||||
endif
|
|
@ -1,24 +0,0 @@
|
|||
|
||||
uclibc does not export __mempcpy like glibc so we alias it here.
|
||||
This patch may make sense for upstream but elfutils uses more
|
||||
glibc specific features like obstack_printf which are missing in
|
||||
uclibc they need to be fixed along to make it work all the way
|
||||
|
||||
Upstream-Status: Inappropriate[Elfutils uses more glibc specific features]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
Index: elfutils-0.148/libelf/elf_begin.c
|
||||
===================================================================
|
||||
--- elfutils-0.148.orig/libelf/elf_begin.c
|
||||
+++ elfutils-0.148/libelf/elf_begin.c
|
||||
@@ -68,6 +68,9 @@
|
||||
#include "libelfP.h"
|
||||
#include "common.h"
|
||||
|
||||
+#ifdef __UCLIBC__
|
||||
+#define __mempcpy mempcpy
|
||||
+#endif
|
||||
|
||||
/* Create descriptor for archive in memory. */
|
||||
static inline Elf *
|
|
@ -27,7 +27,6 @@ SRC_URI += "\
|
|||
file://elf_additions.diff \
|
||||
file://elfutils-fsize.patch \
|
||||
file://remove-unused.patch \
|
||||
file://mempcpy.patch \
|
||||
file://fix_for_gcc-4.7.patch \
|
||||
file://dso-link-change.patch \
|
||||
file://nm-Fix-size-passed-to-snprintf-for-invalid-sh_name-case.patch \
|
||||
|
|
|
@ -4,6 +4,7 @@ SECTION = "base"
|
|||
LICENSE = "(GPLv3 & Elfutils-Exception)"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
|
||||
DEPENDS = "libtool bzip2 zlib virtual/libintl"
|
||||
DEPENDS_append_libc-musl = " argp-standalone fts "
|
||||
|
||||
SRC_URI = "https://fedorahosted.org/releases/e/l/elfutils/${PV}/${BP}.tar.bz2"
|
||||
|
||||
|
@ -11,13 +12,14 @@ SRC_URI[md5sum] = "2e4536c1c48034f188a80789a59114d8"
|
|||
SRC_URI[sha256sum] = "9683c025928a12d06b7fe812928aa6235249e22d197d086f7084606a48165900"
|
||||
|
||||
SRC_URI += "\
|
||||
file://mempcpy.patch \
|
||||
file://dso-link-change.patch \
|
||||
file://Fix_elf_cvt_gunhash.patch \
|
||||
file://fixheadercheck.patch \
|
||||
file://0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch \
|
||||
file://0001-remove-the-unneed-checking.patch \
|
||||
file://0001-fix-a-stack-usage-warning.patch \
|
||||
file://aarch64_uio.patch \
|
||||
file://shadow.patch \
|
||||
"
|
||||
|
||||
# pick the patch from debian
|
||||
|
@ -33,10 +35,9 @@ SRC_URI += "\
|
|||
file://0001-Ignore-differences-between-mips-machine-identifiers.patch \
|
||||
file://0002-Add-support-for-mips64-abis-in-mips_retval.c.patch \
|
||||
file://0003-Add-mips-n64-relocation-format-hack.patch \
|
||||
file://uclibc-support.patch \
|
||||
"
|
||||
|
||||
# Only apply when building uclibc based target recipe
|
||||
SRC_URI_append_libc-uclibc = " file://uclibc-support-for-elfutils-0.161.patch"
|
||||
SRC_URI_append_libc-musl = " file://0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch "
|
||||
|
||||
# The buildsystem wants to generate 2 .h files from source using a binary it just built,
|
||||
# which can not pass the cross compiling, so let's work around it by adding 2 .h files
|
||||
|
@ -50,7 +51,7 @@ EXTRA_OECONF_append_libc-uclibc = " --enable-uclibc"
|
|||
|
||||
do_install_append() {
|
||||
if [ "${TARGET_ARCH}" != "x86_64" ] && [ -z `echo "${TARGET_ARCH}"|grep 'i.86'` ];then
|
||||
rm ${D}${bindir}/eu-objdump
|
||||
rm -f ${D}${bindir}/eu-objdump
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -62,6 +63,8 @@ EXTRA_OEMAKE_libc-uclibc = "-C libelf"
|
|||
EXTRA_OEMAKE_class-native = ""
|
||||
EXTRA_OEMAKE_class-nativesdk = ""
|
||||
|
||||
ALLOW_EMPTY_${PN}_libc-musl = "1"
|
||||
|
||||
BBCLASSEXTEND = "native nativesdk"
|
||||
|
||||
# Package utilities separately
|
||||
|
|
Loading…
Reference in New Issue