diff options
Diffstat (limited to 'poky/meta/recipes-devtools/elfutils')
7 files changed, 340 insertions, 3 deletions
diff --git a/poky/meta/recipes-devtools/elfutils/elfutils_0.176.bb b/poky/meta/recipes-devtools/elfutils/elfutils_0.176.bb index fd901c9c9e..157551e6af 100644 --- a/poky/meta/recipes-devtools/elfutils/elfutils_0.176.bb +++ b/poky/meta/recipes-devtools/elfutils/elfutils_0.176.bb @@ -1,7 +1,7 @@ SUMMARY = "Utilities and libraries for handling compiled object files" HOMEPAGE = "https://sourceware.org/elfutils" SECTION = "base" -LICENSE = "(GPLv3 & Elfutils-Exception)" +LICENSE = "GPLv2 & LGPLv3+ & GPLv3+" LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" DEPENDS = "libtool bzip2 zlib virtual/libintl" DEPENDS_append_libc-musl = " argp-standalone fts " @@ -27,16 +27,26 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \ file://debian/hurd_path.patch \ file://debian/ignore_strmerge.diff \ file://debian/disable_werror.patch \ + file://debian/testsuite-ignore-elflint.diff \ + file://0001-skip-the-test-when-gcc-not-deployed.patch \ + file://run-ptest \ + file://ptest.patch \ + file://musl.patch \ " -SRC_URI_append_libc-musl = " file://0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch" +SRC_URI_append_libc-musl = " file://0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch \ + file://0001-fix-err-variable-and-function-conflicts.patch \ +" SRC_URI[md5sum] = "077e4f49320cad82bf17a997068b1db9" SRC_URI[sha256sum] = "eb5747c371b0af0f71e86215a5ebb88728533c3a104a43d4231963f308cd1023" -inherit autotools gettext +inherit autotools gettext ptest EXTRA_OECONF = "--program-prefix=eu- --without-lzma" EXTRA_OECONF_append_class-native = " --without-bzlib" +RDEPENDS_${PN}-ptest = "libasm libelf bash make coreutils ${PN}-binutils ${PN}" + +EXTRA_OECONF_append_class-target += "--disable-tests-rpath" do_install_append() { if [ "${TARGET_ARCH}" != "x86_64" ] && [ -z `echo "${TARGET_ARCH}"|grep 'i.86'` ];then @@ -44,6 +54,22 @@ do_install_append() { fi } +do_compile_ptest() { + cd ${B}/tests + oe_runmake buildtest-TESTS oecheck +} + +do_install_ptest() { + if [ ${PTEST_ENABLED} = "1" ]; then + cp -r ${S}/tests/ ${D}${PTEST_PATH} + cp -r ${B}/tests/* ${D}${PTEST_PATH}/tests + cp -r ${B}/config.h ${D}${PTEST_PATH} + cp -r ${B}/backends ${D}${PTEST_PATH} + sed -i '/^Makefile:/c Makefile:' ${D}${PTEST_PATH}/tests/Makefile + find ${D}${PTEST_PATH} -type f -name *.[hoc] | xargs -i rm {} + fi +} + EXTRA_OEMAKE_class-native = "" EXTRA_OEMAKE_class-nativesdk = "" @@ -53,6 +79,18 @@ BBCLASSEXTEND = "native nativesdk" # Package utilities separately PACKAGES =+ "${PN}-binutils libelf libasm libdw" + +# shared libraries are licensed GPLv2 or GPLv3+, binaries GPLv3+ +# according to NEWS file: +# "The license is now GPLv2/LGPLv3+ for the libraries and GPLv3+ for stand-alone +# programs. There is now also a formal CONTRIBUTING document describing how to +# submit patches." +LICENSE_${PN}-binutils = "GPLv3+" +LICENSE_${PN} = "GPLv3+" +LICENSE_libelf = "GPLv2 | LGPLv3+" +LICENSE_libasm = "GPLv2 | LGPLv3+" +LICENSE_libdw = "GPLv2 | LGPLv3+" + FILES_${PN}-binutils = "\ ${bindir}/eu-addr2line \ ${bindir}/eu-ld \ diff --git a/poky/meta/recipes-devtools/elfutils/files/0001-fix-err-variable-and-function-conflicts.patch b/poky/meta/recipes-devtools/elfutils/files/0001-fix-err-variable-and-function-conflicts.patch new file mode 100644 index 0000000000..433db133b2 --- /dev/null +++ b/poky/meta/recipes-devtools/elfutils/files/0001-fix-err-variable-and-function-conflicts.patch @@ -0,0 +1,91 @@ +From 2c50fe7068bd6911958c6d851aef88179e73bb21 Mon Sep 17 00:00:00 2001 +From: Mingli Yu <Mingli.Yu@windriver.com> +Date: Tue, 16 Apr 2019 15:30:38 +0800 +Subject: [PATCH] fix err variable and function conflicts + +There comes below build failure with musl when +ptest enabled. +| In file included from ../../elfutils-0.176/tests/dwfl-proc-attach.c:33: +| ../../elfutils-0.176/lib/system.h:63:35: error: called object 'err' is not a function or function pointer +| #define error(status, errno, ...) err(status, __VA_ARGS__) +| ^~~ +| ../../elfutils-0.176/tests/dwfl-proc-attach.c:92:5: note: in expansion of macro 'error' +| error (-1, 0, "dwfl_linux_proc_attach pid %d: %s", pid, +| ^~~~~ +| ../../elfutils-0.176/tests/dwfl-proc-attach.c:79:7: note: declared here +| int err; +| ^~~ + +It is because there is no error.h in musl and +the patch 0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch +has updated to use err.h to replace error.h +and also added macro definiton as below when +use musl. + #define error(status, errno, ...) err(status, __VA_ARGS__) + +And in err.h, there is below logic: +_Noreturn void err(int, const char *, ...); + +But when ptest enabled, there comes below error +as there is both variable and function defined +to be err in tests/dwfl-proc-attach.c. +So change the err variable's name to workaround +the build failure with musl. + +Upstream-Status: Inappropriate [workaround in musl] + +Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com> +--- + tests/dwfl-proc-attach.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +Index: elfutils-0.176/tests/dwfl-proc-attach.c +=================================================================== +--- elfutils-0.176.orig/tests/dwfl-proc-attach.c ++++ elfutils-0.176/tests/dwfl-proc-attach.c +@@ -76,10 +76,10 @@ main (int argc __attribute__ ((unused)), + char **argv __attribute__ ((unused))) + { + /* Create two extra threads to iterate through. */ +- int err; +- if ((err = pthread_create (&thread1, NULL, sleeper, NULL)) != 0) ++ int err1; ++ if ((err1 = pthread_create (&thread1, NULL, sleeper, NULL)) != 0) + error (-1, err, "Couldn't create thread1"); +- if ((err = pthread_create (&thread2, NULL, sleeper, NULL)) != 0) ++ if ((err1 = pthread_create (&thread2, NULL, sleeper, NULL)) != 0) + error (-1, err, "Couldn't create thread2"); + + Dwfl *dwfl = dwfl_begin (&proc_callbacks); +Index: elfutils-0.176/tests/backtrace.c +=================================================================== +--- elfutils-0.176.orig/tests/backtrace.c ++++ elfutils-0.176/tests/backtrace.c +@@ -219,23 +219,23 @@ dump (Dwfl *dwfl) + { + ptrdiff_t ptrdiff = dwfl_getmodules (dwfl, dump_modules, NULL, 0); + assert (ptrdiff == 0); +- bool err = false; ++ bool err1 = false; + switch (dwfl_getthreads (dwfl, thread_callback, NULL)) + { + case 0: + break; + case DWARF_CB_ABORT: +- err = true; ++ err1 = true; + break; + case -1: + error (0, 0, "dwfl_getthreads: %s", dwfl_errmsg (-1)); +- err = true; ++ err1 = true; + break; + default: + abort (); + } + callback_verify (0, 0, 0, NULL, dwfl); +- if (err) ++ if (err1) + exit (EXIT_FAILURE); + } + diff --git a/poky/meta/recipes-devtools/elfutils/files/0001-skip-the-test-when-gcc-not-deployed.patch b/poky/meta/recipes-devtools/elfutils/files/0001-skip-the-test-when-gcc-not-deployed.patch new file mode 100644 index 0000000000..67ca0e4c77 --- /dev/null +++ b/poky/meta/recipes-devtools/elfutils/files/0001-skip-the-test-when-gcc-not-deployed.patch @@ -0,0 +1,45 @@ +From 61939d2e552e7645ecd671fa01cf1c7a72caa82a Mon Sep 17 00:00:00 2001 +From: Mingli Yu <Mingli.Yu@windriver.com> +Date: Fri, 12 Apr 2019 16:29:58 +0800 +Subject: [PATCH] skip the test when gcc not deployed + +Skip the tests which depend on gcc when +gcc not deployed. + +Upstream-Status: Inappropriate [oe specific] + +Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com> +--- + tests/run-strip-g.sh | 2 ++ + tests/run-strip-nothing.sh | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/tests/run-strip-g.sh b/tests/run-strip-g.sh +index 1303819..a943dec 100755 +--- a/tests/run-strip-g.sh ++++ b/tests/run-strip-g.sh +@@ -24,6 +24,8 @@ + + tempfiles a.out strip.out debug.out readelf.out + ++# skip the test if gcc deployed ++which gcc || exit 77 + echo Create debug a.out. + echo "int main() { return 1; }" | gcc -g -xc - + +diff --git a/tests/run-strip-nothing.sh b/tests/run-strip-nothing.sh +index 914fdfb..d03f734 100755 +--- a/tests/run-strip-nothing.sh ++++ b/tests/run-strip-nothing.sh +@@ -22,6 +22,8 @@ + + tempfiles a.out strip.out debug.out + ++# skip the case if no gcc deployed ++which gcc || exit 77 + # Create no-debug a.out. + echo "int main() { return 1; }" | gcc -s -xc - + +-- +2.7.4 + diff --git a/poky/meta/recipes-devtools/elfutils/files/debian/testsuite-ignore-elflint.diff b/poky/meta/recipes-devtools/elfutils/files/debian/testsuite-ignore-elflint.diff new file mode 100644 index 0000000000..c4ce20c8a3 --- /dev/null +++ b/poky/meta/recipes-devtools/elfutils/files/debian/testsuite-ignore-elflint.diff @@ -0,0 +1,52 @@ +From 03a343c6b1b72598fce654b8a638f106da44abfb Mon Sep 17 00:00:00 2001 +From: OpenEmbedded <oe.patch@oe> +Date: Fri, 12 Apr 2019 08:05:50 +0000 +Subject: [PATCH] On many architectures this test fails because binaries/libs + produced by binutils don't pass elflint. However elfutils shouldn't FTBFS + because of this. + +So we run the tests on all archs to see what breaks, but if it breaks we ignore +the result (exitcode 77 means: this test was skipped). + +Upstream-Status: Inappropriate [oe specific] + +Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com> +--- + tests/run-elflint-self.sh | 2 +- + tests/test-subr.sh | 15 +++++++++++++++ + 2 files changed, 16 insertions(+), 1 deletion(-) + +diff --git a/tests/run-elflint-self.sh b/tests/run-elflint-self.sh +index 58fa7d0..85d21a5 100755 +--- a/tests/run-elflint-self.sh ++++ b/tests/run-elflint-self.sh +@@ -18,5 +18,5 @@ + + . $srcdir/test-subr.sh + +-testrun_on_self ${abs_top_builddir}/src/elflint --quiet --gnu-ld ++testrun_on_self_skip ${abs_top_builddir}/src/elflint --quiet --gnu-ld + testrun_on_self_compressed ${abs_top_builddir}/src/elflint --quiet --gnu-ld +diff --git a/tests/test-subr.sh b/tests/test-subr.sh +index 09f428d..26f61f1 100644 +--- a/tests/test-subr.sh ++++ b/tests/test-subr.sh +@@ -201,3 +201,18 @@ testrun_on_self_quiet() + # Only exit if something failed + if test $exit_status != 0; then exit $exit_status; fi + } ++ ++# Same as testrun_on_self(), but skip on failure. ++testrun_on_self_skip() ++{ ++ exit_status=0 ++ ++ for file in $self_test_files; do ++ testrun $* $file \ ++ || { echo "*** failure in $* $file"; exit_status=77; } ++ done ++ ++ # Only exit if something failed ++ if test $exit_status != 0; then exit $exit_status; fi ++} ++ diff --git a/poky/meta/recipes-devtools/elfutils/files/musl.patch b/poky/meta/recipes-devtools/elfutils/files/musl.patch new file mode 100644 index 0000000000..be35791b1a --- /dev/null +++ b/poky/meta/recipes-devtools/elfutils/files/musl.patch @@ -0,0 +1,29 @@ +Fix error on musl: + +| ../../elfutils-0.176/tests/elfstrmerge.c: In function 'main': +| ../../elfutils-0.176/tests/elfstrmerge.c:370:60: error: 'ALLPERMS' undeclared (first use in this function); did you mean 'EPERM'? +| fdnew = open (fnew, O_WRONLY | O_CREAT, st.st_mode & ALLPERMS); +| ^~~~~~~~ +| EPERM +| ../../elfutils-0.176/tests/elfstrmerge.c:370:60: note: each undeclared identifier is reported only once for each function it appears in + +Upstream-Status: Inappropriate [workaround in musl] + +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> + +Index: elfutils-0.176/tests/elfstrmerge.c +=================================================================== +--- elfutils-0.176.orig/tests/elfstrmerge.c ++++ elfutils-0.176/tests/elfstrmerge.c +@@ -33,6 +33,11 @@ + #include ELFUTILS_HEADER(dwelf) + #include "elf-knowledge.h" + ++/* for musl */ ++#ifndef ALLPERMS ++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */ ++#endif ++ + /* The original ELF file. */ + static int fd = -1; + static Elf *elf = NULL; diff --git a/poky/meta/recipes-devtools/elfutils/files/ptest.patch b/poky/meta/recipes-devtools/elfutils/files/ptest.patch new file mode 100644 index 0000000000..35b23f43b3 --- /dev/null +++ b/poky/meta/recipes-devtools/elfutils/files/ptest.patch @@ -0,0 +1,76 @@ +Changes to allow ptest to run standalone on target: + +a) Run the tests serially +b) Use the standalone test mode which allows the tests to be run in their + 'installled' locations on target (but not any of the standalone build pieces) +c) We want to use the binaries from their installed locations so the run-subr + script needs tweaking to run them like that. The rpath conditional isn't + enough since we want the second entry in the case statement. +d) Add an oecheck make target which we can use to build the test binaries we need + +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> + +Upstream-Status: Inappropriate [oe specific] + +Index: elfutils-0.176/configure.ac +=================================================================== +--- elfutils-0.176.orig/configure.ac ++++ elfutils-0.176/configure.ac +@@ -45,7 +45,7 @@ AC_COPYRIGHT([Copyright (C) 1996-2018 Th + AC_PREREQ(2.63) dnl Minimum Autoconf version required. + + dnl We use GNU make extensions; automake 1.10 defaults to -Wportability. +-AM_INIT_AUTOMAKE([gnits 1.11 -Wno-portability dist-bzip2 no-dist-gzip parallel-tests]) ++AM_INIT_AUTOMAKE([gnits 1.11 -Wno-portability dist-bzip2 no-dist-gzip serial-tests]) + AM_MAINTAINER_MODE + + AM_SILENT_RULES([yes]) +Index: elfutils-0.176/tests/Makefile.am +=================================================================== +--- elfutils-0.176.orig/tests/Makefile.am ++++ elfutils-0.176/tests/Makefile.am +@@ -445,10 +445,10 @@ installed_TESTS_ENVIRONMENT = libdir=$(D + installed_LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \ + installed $(tests_rpath) \ + '$(program_transform_name)' +-if STANDALONE ++if !STANDALONE + TESTS_ENVIRONMENT = $(installed_TESTS_ENVIRONMENT) + LOG_COMPILER = $(installed_LOG_COMPILER) +-else !STANDALONE ++else STANDALONE + TESTS_ENVIRONMENT = LC_ALL=C; LANG=C; VALGRIND_CMD=$(valgrind_cmd); \ + abs_srcdir=$(abs_srcdir); abs_builddir=$(abs_builddir); \ + abs_top_builddir=$(abs_top_builddir); \ +@@ -463,7 +463,7 @@ installcheck-local: + $(MAKE) $(AM_MAKEFLAGS) \ + TESTS_ENVIRONMENT="$(installed_TESTS_ENVIRONMENT)" \ + LOG_COMPILER="$(installed_LOG_COMPILER)" check-TESTS +-endif !STANDALONE ++endif STANDALONE + + if STANDALONE + libdw = -ldw +@@ -612,3 +612,5 @@ check: check-am coverage + coverage: + -$(srcdir)/coverage.sh + endif ++oecheck: ++ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) +Index: elfutils-0.176/tests/test-subr.sh +=================================================================== +--- elfutils-0.176.orig/tests/test-subr.sh ++++ elfutils-0.176/tests/test-subr.sh +@@ -91,12 +91,6 @@ installed_testrun() + program="$1" + shift + case "$program" in +- ${abs_builddir}/*) +- if [ "x$elfutils_tests_rpath" != xno ]; then +- echo >&2 installcheck not possible with --enable-tests-rpath +- exit 77 +- fi +- ;; + ${abs_top_builddir}/src/*) + program=${bindir}/`program_transform ${program##*/}` + ;; diff --git a/poky/meta/recipes-devtools/elfutils/files/run-ptest b/poky/meta/recipes-devtools/elfutils/files/run-ptest new file mode 100644 index 0000000000..81b81f2f5d --- /dev/null +++ b/poky/meta/recipes-devtools/elfutils/files/run-ptest @@ -0,0 +1,6 @@ +#!/bin/sh +# +#This script is used to run elfutils test suites +cd tests + +make -k runtest-TESTS abs_srcdir=$PWD abs_builddir=$PWD srcdir=$PWD top_srcdir=$PWD/../ abs_top_builddir=$PWD/../ elfutils_testrun=installed elfutils_tests_rpath=no program_transform_name=s,^,eu-, |