1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-09 05:29:32 +00:00

elfutils: upgrade to 0.160

- Upgrade elfutils to 0.160

- Move 0.148 patches from elfutils to elfutils-0.148

- Drop 0.158 patches that got from debain, so far debian
  doesn't provide patches for 0.160 (the latest is 0.159)

- Move fixheadercheck.patch from 0.159 to 0.160

- We choose to use 0.159 patches from debian for the current 0.160
  which located in elfutils-0.160
  1) Rebase the following patches from 0.159 to 0.160
     hppa_backend.diff
     arm_backend.diff
     mips_backend.diff
     m68k_backend.diff
     arm_func_value.patch
     arm_unwind_ret_mask.patch

  2) Rebase redhat-portability.diff according to
     commit 52a6d20519
     Author: Roxana Ciobanu <roxana.ciobanu@intel.com>
     Date:   Tue Jul 1 17:17:00 2014 +0300
       elfutils/elfutils-native: Fix patching generated files

  3) Drop the following patches which have already beem merged to 0.160
     arm_unsupported.patch
     arm_syscall.patch
     unaligned.patch
     aarch64-run-native-test-fix.patch

(From OE-Core rev: 74b191022494fc1d357c1f05dbce38c986bed365)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Hongxu Jia
2014-11-14 17:29:03 +08:00
committed by Richard Purdie
parent fa234ef4e0
commit 2e13f27e38
33 changed files with 736 additions and 2557 deletions
@@ -1,35 +0,0 @@
From 7f1eec317db79627b473c5b149a22a1b20d1f68f Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw@redhat.com>
Date: Wed, 9 Apr 2014 11:33:23 +0200
Subject: [PATCH] CVE-2014-0172 Check for overflow before calling malloc to
uncompress data.
https://bugzilla.redhat.com/show_bug.cgi?id=1085663
Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
Index: elfutils-0.158/libdw/dwarf_begin_elf.c
===================================================================
--- elfutils-0.158.orig/libdw/dwarf_begin_elf.c 2014-05-01 17:10:01.928213292 +0000
+++ elfutils-0.158/libdw/dwarf_begin_elf.c 2014-05-01 17:10:01.924213375 +0000
@@ -1,5 +1,5 @@
/* Create descriptor from ELF descriptor for processing file.
- Copyright (C) 2002-2011 Red Hat, Inc.
+ Copyright (C) 2002-2011, 2014 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -289,6 +289,12 @@
memcpy (&size, data->d_buf + 4, sizeof size);
size = be64toh (size);
+ /* Check for unsigned overflow so malloc always allocated
+ enough memory for both the Elf_Data header and the
+ uncompressed section data. */
+ if (unlikely (sizeof (Elf_Data) + size < size))
+ break;
+
Elf_Data *zdata = malloc (sizeof (Elf_Data) + size);
if (unlikely (zdata == NULL))
break;
@@ -1,27 +0,0 @@
From: Matthias Klose <doko@ubuntu.com>
Date: Tue, 7 Jan 2014 10:25:29 +0100
Subject: [PATCH] tests: backtrace-subr.sh (check_native_core) should check
core file name.
Needed when /proc/sys/kernel/core_uses_pid is set to 0. Try to rename
the core file, and if it does still fail, skip the test.
diff --git a/tests/backtrace-subr.sh b/tests/backtrace-subr.sh
index e7ece91..62b873c 100644
--- a/tests/backtrace-subr.sh
+++ b/tests/backtrace-subr.sh
@@ -111,6 +111,11 @@ check_native_core()
# Skip the test if we cannot adjust core ulimit.
core="core.`ulimit -c unlimited || exit 77; set +ex; testrun ${abs_builddir}/$child --gencore; true`"
+ # see if /proc/sys/kernel/core_uses_pid is set to 0
+ if [ -f core ]; then
+ mv core "$core"
+ fi
+ if [ ! -f "$core" ]; then exit 77; fi
if [ "x$SAVED_VALGRIND_CMD" != "x" ]; then
VALGRIND_CMD="$SAVED_VALGRIND_CMD"
--
1.9.2
@@ -1,77 +0,0 @@
Upstream-Status: Backport
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
libelf/elf.h | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/libelf/elf.h b/libelf/elf.h
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -142,6 +142,7 @@ typedef struct
#define ELFOSABI_NETBSD 2 /* NetBSD. */
#define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */
#define ELFOSABI_LINUX ELFOSABI_GNU /* Compatibility alias. */
+#define ELFOSABI_HURD 4 /* GNU/Hurd */
#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */
#define ELFOSABI_AIX 7 /* IBM AIX. */
#define ELFOSABI_IRIX 8 /* SGI Irix. */
@@ -149,8 +150,13 @@ typedef struct
#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */
#define ELFOSABI_MODESTO 11 /* Novell Modesto. */
#define ELFOSABI_OPENBSD 12 /* OpenBSD. */
+#define ELFOSABI_OPENVMS 13 /* OpenVMS */
+#define ELFOSABI_NSK 14 /* Hewlett-Packard Non-Stop Kernel */
+#define ELFOSABI_AROS 15 /* Amiga Research OS */
+/* 64-255 Architecture-specific value range */
#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */
#define ELFOSABI_ARM 97 /* ARM */
+/* This is deprecated? It's not in the latest version anymore. */
#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
#define EI_ABIVERSION 8 /* ABI version */
@@ -205,7 +211,7 @@ typedef struct
#define EM_H8_300H 47 /* Hitachi H8/300H */
#define EM_H8S 48 /* Hitachi H8S */
#define EM_H8_500 49 /* Hitachi H8/500 */
-#define EM_IA_64 50 /* Intel Merced */
+#define EM_IA_64 50 /* Intel IA64 */
#define EM_MIPS_X 51 /* Stanford MIPS-X */
#define EM_COLDFIRE 52 /* Motorola Coldfire */
#define EM_68HC12 53 /* Motorola M68HC12 */
@@ -219,7 +225,8 @@ typedef struct
#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/
#define EM_X86_64 62 /* AMD x86-64 architecture */
#define EM_PDSP 63 /* Sony DSP Processor */
-
+#define EM_PDP10 64 /* Digital Equipment Corp. PDP-10 */
+#define EM_PDP11 65 /* Digital Equipment Corp. PDP-11 */
#define EM_FX66 66 /* Siemens FX66 microcontroller */
#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */
#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */
@@ -249,6 +256,22 @@ typedef struct
#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
+#define EM_VIDEOCORE 95 /* Alphamosaic VideoCore processor */
+#define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose Processor */
+#define EM_NS32K 97 /* National Semiconductor 32000 series */
+#define EM_TPC 98 /* Tenor Network TPC processor */
+#define EM_SNP1K 99 /* Trebia SNP 1000 processor */
+#define EM_ST200 100 /* STMicroelectronics (www.st.com) ST200 microcontroller */
+#define EM_IP2K 101 /* Ubicom IP2XXX microcontroller family */
+#define EM_MAX 102 /* MAX Processor */
+#define EM_CR 103 /* National Semiconductor CompactRISC */
+#define EM_F2MC16 104 /* Fujitsu F2MC16 */
+#define EM_MSP430 105 /* TI msp430 micro controller */
+#define EM_BLACKFIN 106 /* Analog Devices Blackfin (DSP) processor */
+#define EM_SE_C33 107 /* S1C33 Family of Seiko Epson processors */
+#define EM_SEP 108 /* Sharp embedded microprocessor */
+#define EM_ARCA 109 /* Arca RISC Microprocessor */
+
#define EM_AARCH64 183 /* ARM AARCH64 */
#define EM_TILEPRO 188 /* Tilera TILEPro */
#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */
--
1.8.1.2
@@ -1,34 +0,0 @@
m4/biarch.m4: tweak AC_RUN_IFELSE for cross-compiling
Macro: AC_RUN_IFELSE (input,
[action-if-true],
[action-if-false],
[action-if-cross-compiling])
Add the missing [action-if-cross-compiling] part to support
cross-compiling.
Upstream-Status: inappropriate [oe specific]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
m4/biarch.m4 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/m4/biarch.m4 b/m4/biarch.m4
--- a/m4/biarch.m4
+++ b/m4/biarch.m4
@@ -40,7 +40,9 @@ AC_CACHE_CHECK([whether $biarch_CC makes executables we can run],
save_CC="$CC"
CC="$biarch_CC"
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [])],
- utrace_cv_cc_biarch=yes, utrace_cv_cc_biarch=no)
+ utrace_cv_cc_biarch=yes,
+ utrace_cv_cc_biarch=no,
+ utrace_cv_cc_biarch=yes)
CC="$save_CC"])], [utrace_cv_cc_biarch=no])
AS_IF([test $utrace_cv_cc_biarch != yes], [dnl
AC_MSG_WARN([not running biarch tests, $biarch_CC does not work])])])
--
1.8.1.2
File diff suppressed because it is too large Load Diff
@@ -1,256 +0,0 @@
From 02cefdaa6429e620d6457fdb3ad9934f194c5a93 Mon Sep 17 00:00:00 2001
From: Kurt Roeckx <kurt@roeckx.be>
Date: Tue, 22 Apr 2014 21:46:22 +0200
Subject: [PATCH] Unwinding is only supported on Linux
Index: elfutils-0.158/backends/i386_initreg.c
===================================================================
--- elfutils-0.158.orig/backends/i386_initreg.c 2014-05-01 17:11:18.870616302 +0000
+++ elfutils-0.158/backends/i386_initreg.c 2014-05-01 17:11:18.866616384 +0000
@@ -44,7 +44,7 @@
ebl_tid_registers_t *setfunc __attribute__ ((unused)),
void *arg __attribute__ ((unused)))
{
-#if !defined __i386__ && !defined __x86_64__
+#if (!defined __i386__ && !defined __x86_64__) || !defined(__linux__)
return false;
#else /* __i386__ || __x86_64__ */
struct user_regs_struct user_regs;
Index: elfutils-0.158/backends/x86_64_initreg.c
===================================================================
--- elfutils-0.158.orig/backends/x86_64_initreg.c 2014-05-01 17:11:18.870616302 +0000
+++ elfutils-0.158/backends/x86_64_initreg.c 2014-05-01 17:11:18.866616384 +0000
@@ -44,7 +44,7 @@
ebl_tid_registers_t *setfunc __attribute__ ((unused)),
void *arg __attribute__ ((unused)))
{
-#ifndef __x86_64__
+#if !defined(__x86_64__) || !defined(__linux__)
return false;
#else /* __x86_64__ */
struct user_regs_struct user_regs;
Index: elfutils-0.158/libdwfl/linux-pid-attach.c
===================================================================
--- elfutils-0.158.orig/libdwfl/linux-pid-attach.c 2014-05-01 17:11:18.870616302 +0000
+++ elfutils-0.158/libdwfl/linux-pid-attach.c 2014-05-01 17:12:47.980766442 +0000
@@ -37,6 +37,8 @@
# define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
+#ifdef __linux__
+
struct pid_arg
{
DIR *dir;
@@ -358,3 +360,87 @@
return 0;
}
INTDEF (dwfl_linux_proc_attach)
+
+#else /* __linux__ */
+
+static pid_t
+pid_next_thread (Dwfl *dwfl __attribute__ ((unused)),
+ void *dwfl_arg __attribute__ ((unused)),
+ void **thread_argp __attribute__ ((unused)))
+{
+ errno = ENOSYS;
+ __libdwfl_seterrno (DWFL_E_ERRNO);
+ return -1;
+}
+
+static bool
+pid_getthread (Dwfl *dwfl __attribute__ ((unused)),
+ pid_t tid __attribute__ ((unused)),
+ void *dwfl_arg __attribute__ ((unused)),
+ void **thread_argp __attribute__ ((unused)))
+{
+ errno = ENOSYS;
+ __libdwfl_seterrno (DWFL_E_ERRNO);
+ return false;
+}
+
+static bool
+pid_memory_read (Dwfl *dwfl __attribute__ ((unused)),
+ Dwarf_Addr addr __attribute__ ((unused)),
+ Dwarf_Word *result __attribute__ ((unused)),
+ void *arg __attribute__ ((unused)))
+{
+ errno = ENOSYS;
+ __libdwfl_seterrno (DWFL_E_ERRNO);
+ return false;
+}
+
+static bool
+pid_set_initial_registers (Dwfl_Thread *thread __attribute__ ((unused)),
+ void *thread_arg __attribute__ ((unused)))
+{
+ errno = ENOSYS;
+ __libdwfl_seterrno (DWFL_E_ERRNO);
+ return false;
+}
+
+static void
+pid_detach (Dwfl *dwfl __attribute__ ((unused)),
+ void *dwfl_arg __attribute__ ((unused)))
+{
+}
+
+static void
+pid_thread_detach (Dwfl_Thread *thread __attribute__ ((unused)),
+ void *thread_arg __attribute__ ((unused)))
+{
+}
+
+static const Dwfl_Thread_Callbacks pid_thread_callbacks =
+{
+ pid_next_thread,
+ pid_getthread,
+ pid_memory_read,
+ pid_set_initial_registers,
+ pid_detach,
+ pid_thread_detach,
+};
+
+int
+dwfl_linux_proc_attach (Dwfl *dwfl __attribute__ ((unused)),
+ pid_t pid __attribute__ ((unused)),
+ bool assume_ptrace_stopped __attribute__ ((unused)))
+{
+ return ENOSYS;
+}
+INTDEF (dwfl_linux_proc_attach)
+
+struct __libdwfl_pid_arg *
+internal_function
+__libdwfl_get_pid_arg (Dwfl *dwfl __attribute__ ((unused)))
+{
+ return NULL;
+}
+
+#endif /* ! __linux __ */
+
Index: elfutils-0.158/tests/backtrace-child.c
===================================================================
--- elfutils-0.158.orig/tests/backtrace-child.c 2014-05-01 17:11:18.870616302 +0000
+++ elfutils-0.158/tests/backtrace-child.c 2014-05-01 17:11:18.866616384 +0000
@@ -79,6 +79,18 @@
#include <stdio.h>
#include <unistd.h>
+#ifndef __linux__
+
+int
+main (int argc __attribute__ ((unused)), char **argv)
+{
+ fprintf (stderr, "%s: Unwinding not supported for this architecture\n",
+ argv[0]);
+ return 77;
+}
+
+#else /* __linux__ */
+
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
#define NOINLINE_NOCLONE __attribute__ ((noinline, noclone))
#else
@@ -221,3 +233,6 @@
/* Not reached. */
abort ();
}
+
+#endif /* ! __linux__ */
+
Index: elfutils-0.158/tests/backtrace-data.c
===================================================================
--- elfutils-0.158.orig/tests/backtrace-data.c 2014-05-01 17:11:18.870616302 +0000
+++ elfutils-0.158/tests/backtrace-data.c 2014-05-01 17:11:18.866616384 +0000
@@ -40,7 +40,7 @@
#include <string.h>
#include ELFUTILS_HEADER(dwfl)
-#ifndef __x86_64__
+#if !defined(__x86_64__) || !defined(__linux__)
int
main (int argc __attribute__ ((unused)), char **argv)
@@ -50,7 +50,7 @@
return 77;
}
-#else /* __x86_64__ */
+#else /* __x86_64__ && __linux__ */
/* The only arch specific code is set_initial_registers. */
Index: elfutils-0.158/tests/backtrace-dwarf.c
===================================================================
--- elfutils-0.158.orig/tests/backtrace-dwarf.c 2014-05-01 17:11:18.870616302 +0000
+++ elfutils-0.158/tests/backtrace-dwarf.c 2014-05-01 17:11:18.866616384 +0000
@@ -25,6 +25,18 @@
#include <sys/ptrace.h>
#include ELFUTILS_HEADER(dwfl)
+#ifndef __linux__
+
+int
+main (int argc __attribute__ ((unused)), char **argv)
+{
+ fprintf (stderr, "%s: Unwinding not supported for this architecture\n",
+ argv[0]);
+ return 77;
+}
+
+#else /* __linux__ */
+
static void cleanup_13_abort (void);
#define main cleanup_13_main
#include "cleanup-13.c"
@@ -148,3 +160,6 @@
/* There is an exit (0) call if we find the "main" frame, */
error (1, 0, "dwfl_getthreads: %s", dwfl_errmsg (-1));
}
+
+#endif /* ! __linux__ */
+
Index: elfutils-0.158/tests/backtrace-subr.sh
===================================================================
--- elfutils-0.158.orig/tests/backtrace-subr.sh 2014-05-01 17:11:18.870616302 +0000
+++ elfutils-0.158/tests/backtrace-subr.sh 2014-05-01 17:11:18.866616384 +0000
@@ -84,6 +84,7 @@
echo ./backtrace ./backtrace.$arch.{exec,core}
testrun ${abs_builddir}/backtrace -e ./backtrace.$arch.exec --core=./backtrace.$arch.core 1>backtrace.$arch.bt 2>backtrace.$arch.err || true
cat backtrace.$arch.{bt,err}
+ check_unsupported backtrace.$arch.err backtrace.$arch.core
check_all backtrace.$arch.{bt,err} backtrace.$arch.core
}
Index: elfutils-0.158/tests/backtrace.c
===================================================================
--- elfutils-0.158.orig/tests/backtrace.c 2014-05-01 17:11:18.870616302 +0000
+++ elfutils-0.158/tests/backtrace.c 2014-05-01 17:11:18.866616384 +0000
@@ -39,6 +39,18 @@
#include <sys/syscall.h>
#include ELFUTILS_HEADER(dwfl)
+#ifndef __linux__
+
+int
+main (int argc __attribute__ ((unused)), char **argv)
+{
+ fprintf (stderr, "%s: Unwinding not supported for this architecture\n",
+ argv[0]);
+ return 77;
+}
+
+#else /* __linux__ */
+
static int
dump_modules (Dwfl_Module *mod, void **userdata __attribute__ ((unused)),
const char *name, Dwarf_Addr start,
@@ -452,3 +464,6 @@
dwfl_end (dwfl);
return 0;
}
+
+#endif /* ! __linux__ */
+
@@ -1,7 +1,25 @@
Index: elfutils-0.158/backends/arm_init.c
===================================================================
--- elfutils-0.158.orig/backends/arm_init.c 2014-04-21 11:13:24.378519252 +0000
+++ elfutils-0.158/backends/arm_init.c 2014-04-21 11:13:24.374519343 +0000
From 0db1687eee0b4d16ccbc40db5a06b574fca6614c Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Fri, 14 Nov 2014 15:25:42 +0800
Subject: [PATCH] Rebase arm_backend.diff from 0.159 to 0.160
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
backends/arm_init.c | 18 ++++-
backends/arm_regs.c | 132 ++++++++++++++++++++++++++++++++++++
backends/arm_retval.c | 44 +++++++++++-
backends/libebl_arm.h | 9 +++
libelf/elf.h | 11 +++
tests/run-addrcfi.sh | 93 ++++++++++++++++++++++++-
tests/run-allregs.sh | 95 +++++++++++++++++++++++++-
tests/run-readelf-mixed-corenote.sh | 11 ++-
8 files changed, 401 insertions(+), 12 deletions(-)
create mode 100644 backends/libebl_arm.h
diff --git a/backends/arm_init.c b/backends/arm_init.c
index 3283c97..8b57d3f 100644
--- a/backends/arm_init.c
+++ b/backends/arm_init.c
@@ -35,21 +35,32 @@
#define RELOC_PREFIX R_ARM_
#include "libebl_CPU.h"
@@ -36,7 +54,7 @@ Index: elfutils-0.158/backends/arm_init.c
/* We handle it. */
eh->name = "ARM";
arm_init_reloc (eh);
@@ -61,7 +72,10 @@
@@ -61,7 +72,10 @@ arm_init (elf, machine, eh, ehlen)
HOOK (eh, core_note);
HOOK (eh, auxv_info);
HOOK (eh, check_object_attribute);
@@ -46,12 +64,12 @@ Index: elfutils-0.158/backends/arm_init.c
+ else
+ eh->return_value_location = arm_return_value_location_hard;
HOOK (eh, abi_cfi);
HOOK (eh, check_reloc_target_type);
return MODVERSION;
Index: elfutils-0.158/backends/arm_regs.c
===================================================================
--- elfutils-0.158.orig/backends/arm_regs.c 2014-04-21 11:13:24.378519252 +0000
+++ elfutils-0.158/backends/arm_regs.c 2014-04-21 11:13:24.374519343 +0000
diff --git a/backends/arm_regs.c b/backends/arm_regs.c
index 21c5ad3..4ee1039 100644
--- a/backends/arm_regs.c
+++ b/backends/arm_regs.c
@@ -31,6 +31,7 @@
#endif
@@ -60,7 +78,7 @@ Index: elfutils-0.158/backends/arm_regs.c
#include <dwarf.h>
#define BACKEND arm_
@@ -76,6 +77,9 @@
@@ -76,6 +77,9 @@ arm_register_info (Ebl *ebl __attribute__ ((unused)),
break;
case 16 + 0 ... 16 + 7:
@@ -70,7 +88,7 @@ Index: elfutils-0.158/backends/arm_regs.c
regno += 96 - 16;
/* Fall through. */
case 96 + 0 ... 96 + 7:
@@ -87,11 +91,139 @@
@@ -87,11 +91,139 @@ arm_register_info (Ebl *ebl __attribute__ ((unused)),
namelen = 2;
break;
@@ -210,11 +228,11 @@ Index: elfutils-0.158/backends/arm_regs.c
*setname = "VFP";
*type = DW_ATE_float;
*bits = 64;
Index: elfutils-0.158/backends/arm_retval.c
===================================================================
--- elfutils-0.158.orig/backends/arm_retval.c 2014-04-21 11:13:24.378519252 +0000
+++ elfutils-0.158/backends/arm_retval.c 2014-04-21 11:13:24.374519343 +0000
@@ -48,6 +48,13 @@
diff --git a/backends/arm_retval.c b/backends/arm_retval.c
index 7aced74..052132e 100644
--- a/backends/arm_retval.c
+++ b/backends/arm_retval.c
@@ -48,6 +48,13 @@ static const Dwarf_Op loc_intreg[] =
#define nloc_intreg 1
#define nloc_intregs(n) (2 * (n))
@@ -228,7 +246,7 @@ Index: elfutils-0.158/backends/arm_retval.c
/* The return value is a structure and is actually stored in stack space
passed in a hidden argument by the caller. But, the compiler
helpfully returns the address of that space in r0. */
@@ -58,8 +65,9 @@
@@ -58,8 +65,9 @@ static const Dwarf_Op loc_aggregate[] =
#define nloc_aggregate 1
@@ -240,11 +258,11 @@ Index: elfutils-0.158/backends/arm_retval.c
{
/* Start with the function's type, and get the DW_AT_type attribute,
which is the type of the return value. */
@@ -112,14 +120,31 @@
else
return -1;
}
+ if (tag == DW_TAG_base_type)
@@ -98,14 +106,31 @@ arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
else
return -1;
}
+ if (tag == DW_TAG_base_type)
+ {
+ Dwarf_Word encoding;
+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
@@ -259,20 +277,20 @@ Index: elfutils-0.158/backends/arm_retval.c
+ goto aggregate;
+ }
+ }
if (size <= 16)
{
intreg:
*locp = loc_intreg;
return size <= 4 ? nloc_intreg : nloc_intregs ((size + 3) / 4);
}
+ /* fall through. */
if (size <= 16)
{
intreg:
*locp = loc_intreg;
return size <= 4 ? nloc_intreg : nloc_intregs ((size + 3) / 4);
}
+ /* fall through. */
aggregate:
+ /* XXX TODO sometimes aggregates are returned in r0 (-mabi=aapcs) */
*locp = loc_aggregate;
return nloc_aggregate;
@@ -138,3 +163,18 @@
aggregate:
+ /* XXX TODO sometimes aggregates are returned in r0 (-mabi=aapcs) */
*locp = loc_aggregate;
return nloc_aggregate;
}
@@ -125,3 +150,18 @@ arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
DWARF and might be valid. */
return -2;
}
@@ -291,11 +309,26 @@ Index: elfutils-0.158/backends/arm_retval.c
+ return arm_return_value_location_ (functypedie, locp, 0);
+}
+
Index: elfutils-0.158/libelf/elf.h
===================================================================
--- elfutils-0.158.orig/libelf/elf.h 2014-04-21 11:13:24.378519252 +0000
+++ elfutils-0.158/libelf/elf.h 2014-04-21 11:13:24.374519343 +0000
@@ -2318,6 +2318,9 @@
diff --git a/backends/libebl_arm.h b/backends/libebl_arm.h
new file mode 100644
index 0000000..c00770c
--- /dev/null
+++ b/backends/libebl_arm.h
@@ -0,0 +1,9 @@
+#ifndef _LIBEBL_ARM_H
+#define _LIBEBL_ARM_H 1
+
+#include <libdw.h>
+
+extern int arm_return_value_location_soft(Dwarf_Die *, const Dwarf_Op **locp);
+extern int arm_return_value_location_hard(Dwarf_Die *, const Dwarf_Op **locp);
+
+#endif
diff --git a/libelf/elf.h b/libelf/elf.h
index a3cce3e..0891674 100644
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -2346,6 +2346,9 @@ typedef Elf32_Addr Elf32_Conflict;
#define EF_ARM_EABI_VER4 0x04000000
#define EF_ARM_EABI_VER5 0x05000000
@@ -305,7 +338,7 @@ Index: elfutils-0.158/libelf/elf.h
/* Additional symbol types for Thumb. */
#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */
#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */
@@ -2335,12 +2338,19 @@
@@ -2363,12 +2366,19 @@ typedef Elf32_Addr Elf32_Conflict;
/* Processor specific values for the Phdr p_type field. */
#define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */
@@ -325,7 +358,7 @@ Index: elfutils-0.158/libelf/elf.h
/* AArch64 relocs. */
@@ -2619,6 +2629,7 @@
@@ -2647,6 +2657,7 @@ typedef Elf32_Addr Elf32_Conflict;
TLS block (LDR, STR). */
#define R_ARM_TLS_IE12GP 111 /* 12 bit GOT entry relative
to GOT origin (LDR). */
@@ -333,25 +366,122 @@ Index: elfutils-0.158/libelf/elf.h
#define R_ARM_ME_TOO 128 /* Obsolete. */
#define R_ARM_THM_TLS_DESCSEQ 129
#define R_ARM_THM_TLS_DESCSEQ16 129
Index: elfutils-0.158/backends/libebl_arm.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ elfutils-0.158/backends/libebl_arm.h 2014-04-21 11:13:24.374519343 +0000
@@ -0,0 +1,9 @@
+#ifndef _LIBEBL_ARM_H
+#define _LIBEBL_ARM_H 1
+
+#include <libdw.h>
+
+extern int arm_return_value_location_soft(Dwarf_Die *, const Dwarf_Op **locp);
+extern int arm_return_value_location_hard(Dwarf_Die *, const Dwarf_Op **locp);
+
+#endif
Index: elfutils-0.158/tests/run-allregs.sh
===================================================================
--- elfutils-0.158.orig/tests/run-allregs.sh 2014-04-21 11:13:24.378519252 +0000
+++ elfutils-0.158/tests/run-allregs.sh 2014-04-21 11:13:24.378519252 +0000
@@ -2671,7 +2671,28 @@
diff --git a/tests/run-addrcfi.sh b/tests/run-addrcfi.sh
index 5d33246..78464a8 100755
--- a/tests/run-addrcfi.sh
+++ b/tests/run-addrcfi.sh
@@ -2530,6 +2530,38 @@ dwarf_cfi_addrframe (.eh_frame): no matching address range
FPA reg21 (f5): undefined
FPA reg22 (f6): undefined
FPA reg23 (f7): undefined
+ VFP reg64 (s0): undefined
+ VFP reg65 (s1): undefined
+ VFP reg66 (s2): undefined
+ VFP reg67 (s3): undefined
+ VFP reg68 (s4): undefined
+ VFP reg69 (s5): undefined
+ VFP reg70 (s6): undefined
+ VFP reg71 (s7): undefined
+ VFP reg72 (s8): undefined
+ VFP reg73 (s9): undefined
+ VFP reg74 (s10): undefined
+ VFP reg75 (s11): undefined
+ VFP reg76 (s12): undefined
+ VFP reg77 (s13): undefined
+ VFP reg78 (s14): undefined
+ VFP reg79 (s15): undefined
+ VFP reg80 (s16): undefined
+ VFP reg81 (s17): undefined
+ VFP reg82 (s18): undefined
+ VFP reg83 (s19): undefined
+ VFP reg84 (s20): undefined
+ VFP reg85 (s21): undefined
+ VFP reg86 (s22): undefined
+ VFP reg87 (s23): undefined
+ VFP reg88 (s24): undefined
+ VFP reg89 (s25): undefined
+ VFP reg90 (s26): undefined
+ VFP reg91 (s27): undefined
+ VFP reg92 (s28): undefined
+ VFP reg93 (s29): undefined
+ VFP reg94 (s30): undefined
+ VFP reg95 (s31): undefined
FPA reg96 (f0): undefined
FPA reg97 (f1): undefined
FPA reg98 (f2): undefined
@@ -2538,7 +2570,66 @@ dwarf_cfi_addrframe (.eh_frame): no matching address range
FPA reg101 (f5): undefined
FPA reg102 (f6): undefined
FPA reg103 (f7): undefined
- integer reg128 (spsr): undefined
+ MMX reg104 (wcgr0): undefined
+ MMX reg105 (wcgr1): undefined
+ MMX reg106 (wcgr2): undefined
+ MMX reg107 (wcgr3): undefined
+ MMX reg108 (wcgr4): undefined
+ MMX reg109 (wcgr5): undefined
+ MMX reg110 (wcgr6): undefined
+ MMX reg111 (wcgr7): undefined
+ MMX reg112 (wr0): undefined
+ MMX reg113 (wr1): undefined
+ MMX reg114 (wr2): undefined
+ MMX reg115 (wr3): undefined
+ MMX reg116 (wr4): undefined
+ MMX reg117 (wr5): undefined
+ MMX reg118 (wr6): undefined
+ MMX reg119 (wr7): undefined
+ MMX reg120 (wr8): undefined
+ MMX reg121 (wr9): undefined
+ MMX reg122 (wr10): undefined
+ MMX reg123 (wr11): undefined
+ MMX reg124 (wr12): undefined
+ MMX reg125 (wr13): undefined
+ MMX reg126 (wr14): undefined
+ MMX reg127 (wr15): undefined
+ state reg128 (spsr): undefined
+ state reg129 (spsr_fiq): undefined
+ state reg130 (spsr_irq): undefined
+ state reg131 (spsr_abt): undefined
+ state reg132 (spsr_und): undefined
+ state reg133 (spsr_svc): undefined
+ integer reg144 (r8_usr): undefined
+ integer reg145 (r9_usr): undefined
+ integer reg146 (r10_usr): undefined
+ integer reg147 (r11_usr): undefined
+ integer reg148 (r12_usr): undefined
+ integer reg149 (r13_usr): undefined
+ integer reg150 (r14_usr): undefined
+ integer reg151 (r8_fiq): undefined
+ integer reg152 (r9_fiq): undefined
+ integer reg153 (r10_fiq): undefined
+ integer reg154 (r11_fiq): undefined
+ integer reg155 (r12_fiq): undefined
+ integer reg156 (r13_fiq): undefined
+ integer reg157 (r14_fiq): undefined
+ integer reg158 (r13_irq): undefined
+ integer reg159 (r14_irq): undefined
+ integer reg160 (r13_abt): undefined
+ integer reg161 (r14_abt): undefined
+ integer reg162 (r13_und): undefined
+ integer reg163 (r14_und): undefined
+ integer reg164 (r13_svc): undefined
+ integer reg165 (r14_svc): undefined
+ MMX reg192 (wc0): undefined
+ MMX reg193 (wc1): undefined
+ MMX reg194 (wc2): undefined
+ MMX reg195 (wc3): undefined
+ MMX reg196 (wc4): undefined
+ MMX reg197 (wc5): undefined
+ MMX reg198 (wc6): undefined
+ MMX reg199 (wc7): undefined
VFP reg256 (d0): undefined
VFP reg257 (d1): undefined
VFP reg258 (d2): undefined
diff --git a/tests/run-allregs.sh b/tests/run-allregs.sh
index 6f3862e..13557d5 100755
--- a/tests/run-allregs.sh
+++ b/tests/run-allregs.sh
@@ -2671,7 +2671,28 @@ integer registers:
13: sp (sp), address 32 bits
14: lr (lr), address 32 bits
15: pc (pc), address 32 bits
@@ -381,7 +511,7 @@ Index: elfutils-0.158/tests/run-allregs.sh
FPA registers:
16: f0 (f0), float 96 bits
17: f1 (f1), float 96 bits
@@ -2689,7 +2710,72 @@
@@ -2689,7 +2710,72 @@ FPA registers:
101: f5 (f5), float 96 bits
102: f6 (f6), float 96 bits
103: f7 (f7), float 96 bits
@@ -454,7 +584,7 @@ Index: elfutils-0.158/tests/run-allregs.sh
256: d0 (d0), float 64 bits
257: d1 (d1), float 64 bits
258: d2 (d2), float 64 bits
@@ -2722,6 +2808,13 @@
@@ -2722,6 +2808,13 @@ VFP registers:
285: d29 (d29), float 64 bits
286: d30 (d30), float 64 bits
287: d31 (d31), float 64 bits
@@ -468,11 +598,11 @@ Index: elfutils-0.158/tests/run-allregs.sh
EOF
# See run-readelf-mixed-corenote.sh for instructions to regenerate
Index: elfutils-0.158/tests/run-readelf-mixed-corenote.sh
===================================================================
--- elfutils-0.158.orig/tests/run-readelf-mixed-corenote.sh 2014-04-21 11:13:24.378519252 +0000
+++ elfutils-0.158/tests/run-readelf-mixed-corenote.sh 2014-04-21 11:13:24.378519252 +0000
@@ -30,12 +30,11 @@
diff --git a/tests/run-readelf-mixed-corenote.sh b/tests/run-readelf-mixed-corenote.sh
index 01e4594..9a8a380 100755
--- a/tests/run-readelf-mixed-corenote.sh
+++ b/tests/run-readelf-mixed-corenote.sh
@@ -30,12 +30,11 @@ Note segment of 892 bytes at offset 0x274:
pid: 11087, ppid: 11063, pgrp: 11087, sid: 11063
utime: 0.000000, stime: 0.010000, cutime: 0.000000, cstime: 0.000000
orig_r0: -1, fpvalid: 1
@@ -490,114 +620,6 @@ Index: elfutils-0.158/tests/run-readelf-mixed-corenote.sh
CORE 124 PRPSINFO
state: 0, sname: R, zomb: 0, nice: 0, flag: 0x00400500
uid: 0, gid: 0, pid: 11087, ppid: 11063, pgrp: 11087, sid: 11063
Index: elfutils-0.158/tests/run-addrcfi.sh
===================================================================
--- elfutils-0.158.orig/tests/run-addrcfi.sh 2014-04-21 11:13:24.378519252 +0000
+++ elfutils-0.158/tests/run-addrcfi.sh 2014-04-21 11:13:24.378519252 +0000
@@ -2530,6 +2530,38 @@
FPA reg21 (f5): undefined
FPA reg22 (f6): undefined
FPA reg23 (f7): undefined
+ VFP reg64 (s0): undefined
+ VFP reg65 (s1): undefined
+ VFP reg66 (s2): undefined
+ VFP reg67 (s3): undefined
+ VFP reg68 (s4): undefined
+ VFP reg69 (s5): undefined
+ VFP reg70 (s6): undefined
+ VFP reg71 (s7): undefined
+ VFP reg72 (s8): undefined
+ VFP reg73 (s9): undefined
+ VFP reg74 (s10): undefined
+ VFP reg75 (s11): undefined
+ VFP reg76 (s12): undefined
+ VFP reg77 (s13): undefined
+ VFP reg78 (s14): undefined
+ VFP reg79 (s15): undefined
+ VFP reg80 (s16): undefined
+ VFP reg81 (s17): undefined
+ VFP reg82 (s18): undefined
+ VFP reg83 (s19): undefined
+ VFP reg84 (s20): undefined
+ VFP reg85 (s21): undefined
+ VFP reg86 (s22): undefined
+ VFP reg87 (s23): undefined
+ VFP reg88 (s24): undefined
+ VFP reg89 (s25): undefined
+ VFP reg90 (s26): undefined
+ VFP reg91 (s27): undefined
+ VFP reg92 (s28): undefined
+ VFP reg93 (s29): undefined
+ VFP reg94 (s30): undefined
+ VFP reg95 (s31): undefined
FPA reg96 (f0): undefined
FPA reg97 (f1): undefined
FPA reg98 (f2): undefined
@@ -2538,7 +2570,66 @@
FPA reg101 (f5): undefined
FPA reg102 (f6): undefined
FPA reg103 (f7): undefined
- integer reg128 (spsr): undefined
+ MMX reg104 (wcgr0): undefined
+ MMX reg105 (wcgr1): undefined
+ MMX reg106 (wcgr2): undefined
+ MMX reg107 (wcgr3): undefined
+ MMX reg108 (wcgr4): undefined
+ MMX reg109 (wcgr5): undefined
+ MMX reg110 (wcgr6): undefined
+ MMX reg111 (wcgr7): undefined
+ MMX reg112 (wr0): undefined
+ MMX reg113 (wr1): undefined
+ MMX reg114 (wr2): undefined
+ MMX reg115 (wr3): undefined
+ MMX reg116 (wr4): undefined
+ MMX reg117 (wr5): undefined
+ MMX reg118 (wr6): undefined
+ MMX reg119 (wr7): undefined
+ MMX reg120 (wr8): undefined
+ MMX reg121 (wr9): undefined
+ MMX reg122 (wr10): undefined
+ MMX reg123 (wr11): undefined
+ MMX reg124 (wr12): undefined
+ MMX reg125 (wr13): undefined
+ MMX reg126 (wr14): undefined
+ MMX reg127 (wr15): undefined
+ state reg128 (spsr): undefined
+ state reg129 (spsr_fiq): undefined
+ state reg130 (spsr_irq): undefined
+ state reg131 (spsr_abt): undefined
+ state reg132 (spsr_und): undefined
+ state reg133 (spsr_svc): undefined
+ integer reg144 (r8_usr): undefined
+ integer reg145 (r9_usr): undefined
+ integer reg146 (r10_usr): undefined
+ integer reg147 (r11_usr): undefined
+ integer reg148 (r12_usr): undefined
+ integer reg149 (r13_usr): undefined
+ integer reg150 (r14_usr): undefined
+ integer reg151 (r8_fiq): undefined
+ integer reg152 (r9_fiq): undefined
+ integer reg153 (r10_fiq): undefined
+ integer reg154 (r11_fiq): undefined
+ integer reg155 (r12_fiq): undefined
+ integer reg156 (r13_fiq): undefined
+ integer reg157 (r14_fiq): undefined
+ integer reg158 (r13_irq): undefined
+ integer reg159 (r14_irq): undefined
+ integer reg160 (r13_abt): undefined
+ integer reg161 (r14_abt): undefined
+ integer reg162 (r13_und): undefined
+ integer reg163 (r14_und): undefined
+ integer reg164 (r13_svc): undefined
+ integer reg165 (r14_svc): undefined
+ MMX reg192 (wc0): undefined
+ MMX reg193 (wc1): undefined
+ MMX reg194 (wc2): undefined
+ MMX reg195 (wc3): undefined
+ MMX reg196 (wc4): undefined
+ MMX reg197 (wc5): undefined
+ MMX reg198 (wc6): undefined
+ MMX reg199 (wc7): undefined
VFP reg256 (d0): undefined
VFP reg257 (d1): undefined
VFP reg258 (d2): undefined
--
1.9.1
@@ -0,0 +1,166 @@
From: Mark Wielaard <mjw@redhat.com>
Date: Sun, 15 Jun 2014 11:30:35 +0200
Subject: libebl: Add sym_func_value hook.
The ARM EABI says that the zero bit of function symbol st_value indicates
whether the symbol points to a THUMB or ARM function. Add a new ebl hook
to adjust the st_value in such a case so that we get the actual value that
the symbol points to. It isn't easily possible to reuse the existing
resolve_sym_value for this purpose, so we end up with another hook that
can be used from dwfl_module_getsym and elflint.
Rebase arm_func_value.patch from 0.159 to 0.160
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
backends/arm_init.c | 1 +
backends/arm_symbol.c | 8 ++++++++
libdwfl/dwfl_module_getsym.c | 2 +-
libebl/Makefile.am | 3 ++-
libebl/ebl-hooks.h | 3 +++
libebl/eblsymfuncval.c | 43 +++++++++++++++++++++++++++++++++++++++++++
libebl/libebl.h | 11 +++++++++++
7 files changed, 69 insertions(+), 2 deletions(-)
create mode 100644 libebl/eblsymfuncval.c
diff --git a/backends/arm_init.c b/backends/arm_init.c
index 8b57d3f..2266829 100644
--- a/backends/arm_init.c
+++ b/backends/arm_init.c
@@ -78,6 +78,7 @@ arm_init (elf, machine, eh, ehlen)
eh->return_value_location = arm_return_value_location_hard;
HOOK (eh, abi_cfi);
HOOK (eh, check_reloc_target_type);
+ HOOK (eh, sym_func_value);
/* We only unwind the core integer registers. */
eh->frame_nregs = 16;
diff --git a/backends/arm_symbol.c b/backends/arm_symbol.c
index cd467ff..49fca55 100644
--- a/backends/arm_symbol.c
+++ b/backends/arm_symbol.c
@@ -129,3 +129,11 @@ arm_check_reloc_target_type (Ebl *ebl __attribute__ ((unused)), Elf64_Word sh_ty
{
return sh_type == SHT_ARM_EXIDX;
}
+
+/* ARM EABI says that the low bit indicates whether the function
+ symbol value is a THUMB function or not. Mask it off. */
+GElf_Addr
+arm_sym_func_value (Ebl *ebl __attribute__ ((unused)), GElf_Addr val)
+{
+ return val & ~(GElf_Addr)1;
+}
diff --git a/libdwfl/dwfl_module_getsym.c b/libdwfl/dwfl_module_getsym.c
index 42d2b67..fb192d7 100644
--- a/libdwfl/dwfl_module_getsym.c
+++ b/libdwfl/dwfl_module_getsym.c
@@ -119,7 +119,7 @@ __libdwfl_getsym (Dwfl_Module *mod, int ndx, GElf_Sym *sym, GElf_Addr *addr,
descriptors). */
char *ident;
- GElf_Addr st_value = sym->st_value & ebl_func_addr_mask (mod->ebl);
+ GElf_Addr st_value = ebl_sym_func_value (mod->ebl, sym->st_value);
*resolved = false;
if (! adjust_st_value && mod->e_type != ET_REL && alloc
&& (GELF_ST_TYPE (sym->st_info) == STT_FUNC
diff --git a/libebl/Makefile.am b/libebl/Makefile.am
index ec4477b..889c21b 100644
--- a/libebl/Makefile.am
+++ b/libebl/Makefile.am
@@ -55,7 +55,8 @@ gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \
eblsysvhashentrysize.c eblauxvinfo.c eblcheckobjattr.c \
ebl_check_special_section.c ebl_syscall_abi.c eblabicfi.c \
eblstother.c eblinitreg.c ebldwarftoregno.c eblnormalizepc.c \
- eblunwind.c eblresolvesym.c eblcheckreloctargettype.c
+ eblunwind.c eblresolvesym.c eblcheckreloctargettype.c \
+ eblsymfuncval.c
libebl_a_SOURCES = $(gen_SOURCES)
diff --git a/libebl/ebl-hooks.h b/libebl/ebl-hooks.h
index e1186f8..160a821 100644
--- a/libebl/ebl-hooks.h
+++ b/libebl/ebl-hooks.h
@@ -191,5 +191,8 @@ bool EBLHOOK(unwind) (Ebl *ebl, Dwarf_Addr pc, ebl_tid_registers_t *setfunc,
(e.g. function descriptor resolving) */
bool EBLHOOK(resolve_sym_value) (Ebl *ebl, GElf_Addr *addr);
+/* Returns the real value of a symbol function address or offset. */
+GElf_Addr EBLHOOK(sym_func_value) (Ebl *ebl, GElf_Addr val);
+
/* Destructor for ELF backend handle. */
void EBLHOOK(destr) (struct ebl *);
diff --git a/libebl/eblsymfuncval.c b/libebl/eblsymfuncval.c
new file mode 100644
index 0000000..c0b322f
--- /dev/null
+++ b/libebl/eblsymfuncval.c
@@ -0,0 +1,43 @@
+/* Turn a symbol function value into a real function address or offset.
+ Copyright (C) 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+#include <assert.h>
+
+GElf_Addr
+ebl_sym_func_value (Ebl *ebl, GElf_Addr val)
+{
+ if (ebl == NULL || ebl->sym_func_value == NULL)
+ return val;
+
+ return ebl->sym_func_value (ebl, val);
+}
diff --git a/libebl/libebl.h b/libebl/libebl.h
index bb993bf..40cf635 100644
--- a/libebl/libebl.h
+++ b/libebl/libebl.h
@@ -459,6 +459,17 @@ extern bool ebl_unwind (Ebl *ebl, Dwarf_Addr pc, ebl_tid_registers_t *setfunc,
extern bool ebl_resolve_sym_value (Ebl *ebl, GElf_Addr *addr)
__nonnull_attribute__ (2);
+/* Returns the real value of a symbol function address or offset
+ (e.g. when the st_value contains some flag bits that need to be
+ masked off). This is different from ebl_resolve_sym_value which
+ only works for actual symbol addresses (in non-ET_REL files) that
+ might resolve to an address in a different section.
+ ebl_sym_func_value is called to turn the given value into the a
+ real address or offset (the original value might not be a real
+ address). This works for both ET_REL when the value is a section
+ offset or ET_EXEC or ET_DYN symbol values, which are addresses. */
+extern GElf_Addr ebl_sym_func_value (Ebl *ebl, GElf_Addr val);
+
#ifdef __cplusplus
}
#endif
--
1.9.1
@@ -0,0 +1,83 @@
From: Mark Wielaard <mjw@redhat.com>
Date: Sun, 15 Jun 2014 12:30:02 +0200
Subject: libebl: Add ebl_unwind_ret_mask.
Another ARM oddity. A return value address in an unwind will contain an
extra bit to indicate whether to return to a regular ARM or THUMB function.
Add a new ebl function to return a mask to use to get the actual return
address during an unwind ebl_unwind_ret_mask.
Rebase arm_unwind_ret_mask.patch from 0.159 to 0.160
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
backends/arm_init.c | 3 +++
libebl/eblinitreg.c | 8 ++++++++
libebl/libebl.h | 4 ++++
libebl/libeblP.h | 6 ++++++
4 files changed, 21 insertions(+)
diff --git a/backends/arm_init.c b/backends/arm_init.c
index 2266829..f8df042 100644
--- a/backends/arm_init.c
+++ b/backends/arm_init.c
@@ -87,5 +87,8 @@ arm_init (elf, machine, eh, ehlen)
/* Bit zero encodes whether an function address is THUMB or ARM. */
eh->func_addr_mask = ~(GElf_Addr)1;
+ /* Bit zero encodes whether to return to a THUMB or ARM function. */
+ eh->unwind_ret_mask = ~(GElf_Addr)1;
+
return MODVERSION;
}
diff --git a/libebl/eblinitreg.c b/libebl/eblinitreg.c
index 5729b3c..ca681c0 100644
--- a/libebl/eblinitreg.c
+++ b/libebl/eblinitreg.c
@@ -56,3 +56,11 @@ ebl_func_addr_mask (Ebl *ebl)
return ((ebl == NULL || ebl->func_addr_mask == 0)
? ~(GElf_Addr)0 : ebl->func_addr_mask);
}
+
+GElf_Addr
+ebl_unwind_ret_mask (Ebl *ebl)
+{
+ return ((ebl == NULL || ebl->unwind_ret_mask == 0)
+ ? ~(GElf_Addr)0 : ebl->unwind_ret_mask);
+}
+
diff --git a/libebl/libebl.h b/libebl/libebl.h
index 40cf635..be70027 100644
--- a/libebl/libebl.h
+++ b/libebl/libebl.h
@@ -420,6 +420,10 @@ extern size_t ebl_frame_nregs (Ebl *ebl)
tables) is needed. */
extern GElf_Addr ebl_func_addr_mask (Ebl *ebl);
+/* Mask to use for unwind return address in case the architecture adds
+ some extra non-address bits to it. */
+extern GElf_Addr ebl_unwind_ret_mask (Ebl *ebl);
+
/* Convert *REGNO as is in DWARF to a lower range suitable for
Dwarf_Frame->REGS indexing. */
extern bool ebl_dwarf_to_regno (Ebl *ebl, unsigned *regno)
diff --git a/libebl/libeblP.h b/libebl/libeblP.h
index dbd67f3..e18ace6 100644
--- a/libebl/libeblP.h
+++ b/libebl/libeblP.h
@@ -70,6 +70,12 @@ struct ebl
otherwise it should be the actual mask to use. */
GElf_Addr func_addr_mask;
+ /* Mask to use to get the return address from an unwind in case the
+ architecture adds some extra non-address bits to it. When not
+ initialized (0) then ebl_unwind_ret_mask will return ~0, otherwise
+ it should be the actual mask to use. */
+ GElf_Addr unwind_ret_mask;
+
/* Function descriptor load address and table as used by
ebl_resolve_sym_value if available for this arch. */
GElf_Addr fd_addr;
--
1.9.1
@@ -478,7 +478,7 @@ Index: elfutils-0.158/backends/parisc_retval.c
+ /* Follow typedefs and qualifiers to get to the actual type. */
+ while (tag == DW_TAG_typedef
+ || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type
+ || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type)
+ || tag == DW_TAG_restrict_type)
+ {
+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
+ typedie = dwarf_formref_die (attr, &die_mem);
@@ -409,7 +409,7 @@ Index: elfutils-0.158/backends/m68k_retval.c
+ /* Follow typedefs and qualifiers to get to the actual type. */
+ while (tag == DW_TAG_typedef
+ || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type
+ || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type)
+ || tag == DW_TAG_restrict_type)
+ {
+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
+ typedie = dwarf_formref_die (attr, &die_mem);
@@ -496,7 +496,7 @@ Index: elfutils-0.158/backends/mips_retval.c
+ /* Follow typedefs and qualifiers to get to the actual type. */
+ while (tag == DW_TAG_typedef
+ || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type
+ || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type)
+ || tag == DW_TAG_restrict_type)
+ {
+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
+ typedie = dwarf_formref_die (attr, &die_mem);
@@ -0,0 +1,35 @@
Index: elfutils-0.159/libdwfl/linux-pid-attach.c
===================================================================
--- elfutils-0.159.orig/libdwfl/linux-pid-attach.c
+++ elfutils-0.159/libdwfl/linux-pid-attach.c
@@ -393,6 +393,16 @@ pid_getthread (Dwfl *dwfl __attribute__
return false;
}
+bool
+internal_function
+__libdwfl_ptrace_attach (pid_t tid __attribute__ ((unused)),
+ bool *tid_was_stoppedp __attribute__ ((unused)))
+{
+ errno = ENOSYS;
+ __libdwfl_seterrno (DWFL_E_ERRNO);
+ return false;
+}
+
static bool
pid_memory_read (Dwfl *dwfl __attribute__ ((unused)),
Dwarf_Addr addr __attribute__ ((unused)),
@@ -419,6 +429,13 @@ pid_detach (Dwfl *dwfl __attribute__ ((u
{
}
+void
+internal_function
+__libdwfl_ptrace_detach (pid_t tid __attribute__ ((unused)),
+ bool tid_was_stopped __attribute__ ((unused)))
+{
+}
+
static void
pid_thread_detach (Dwfl_Thread *thread __attribute__ ((unused)),
void *thread_arg __attribute__ ((unused)))
@@ -1,6 +1,8 @@
--- elfutils/backends/ChangeLog
+++ elfutils/backends/ChangeLog
@@ -292,6 +292,10 @@
Index: elfutils-0.159/backends/ChangeLog
===================================================================
--- elfutils-0.159.orig/backends/ChangeLog
+++ elfutils-0.159/backends/ChangeLog
@@ -364,6 +364,10 @@
* ppc_attrs.c (ppc_check_object_attribute): Handle tag
GNU_Power_ABI_Struct_Return.
@@ -11,7 +13,7 @@
2008-10-04 Ulrich Drepper <drepper@redhat.com>
* i386_reloc.def: Fix entries for TLS_GOTDESC, TLS_DESC_CALL, and
@@ -619,6 +623,11 @@
@@ -691,6 +695,11 @@
* sparc_init.c: Likewise.
* x86_64_init.c: Likewise.
@@ -23,7 +25,7 @@
2005-11-19 Roland McGrath <roland@redhat.com>
* ppc64_reloc.def: REL30 -> ADDR30.
@@ -641,6 +650,9 @@
@@ -713,6 +722,9 @@
* Makefile.am (uninstall): Don't try to remove $(pkgincludedir).
(CLEANFILES): Add libebl_$(m).so.
@@ -33,20 +35,24 @@
* ppc_reloc.def: Update bits per Alan Modra <amodra@bigpond.net.au>.
* ppc64_reloc.def: Likewise.
--- elfutils/backends/Makefile.am
+++ elfutils/backends/Makefile.am
@@ -124,7 +124,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a
Index: elfutils-0.159/backends/Makefile.am
===================================================================
--- elfutils-0.159.orig/backends/Makefile.am
+++ elfutils-0.159/backends/Makefile.am
@@ -119,7 +119,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a
$(LINK) -shared -o $(@:.map=.so) \
-Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
-Wl,--version-script,$(@:.so=.map) \
- -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap)
+ -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw) $(libmudflap)
- -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw)
+ -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw)
$(textrel_check)
libebl_i386.so: $(cpu_i386)
--- elfutils/ChangeLog
+++ elfutils/ChangeLog
@@ -118,6 +118,8 @@
Index: elfutils-0.159/ChangeLog
===================================================================
--- elfutils-0.159.orig/ChangeLog
+++ elfutils-0.159/ChangeLog
@@ -148,6 +148,8 @@
2012-01-24 Mark Wielaard <mjw@redhat.com>
@@ -55,7 +61,7 @@
* COPYING: Fix address. Updated version from gnulib.
2012-01-23 Mark Wielaard <mjw@redhat.com>
@@ -136,6 +138,9 @@
@@ -166,6 +168,9 @@
2011-10-08 Mike Frysinger <vapier@gentoo.org>
@@ -65,7 +71,7 @@
* configure.ac: Fix use of AC_ARG_ENABLE to handle $enableval correctly.
2011-10-02 Ulrich Drepper <drepper@gmail.com>
@@ -157,6 +162,10 @@
@@ -187,6 +192,10 @@
* configure.ac (LOCALEDIR, DATADIRNAME): Removed.
@@ -76,7 +82,7 @@
2009-09-21 Ulrich Drepper <drepper@redhat.com>
* configure.ac: Update for more modern autoconf.
@@ -165,6 +174,10 @@
@@ -195,6 +204,10 @@
* configure.ac (zip_LIBS): Check for liblzma too.
@@ -87,7 +93,7 @@
2009-04-19 Roland McGrath <roland@redhat.com>
* configure.ac (eu_version): Round down here, not in version.h macros.
@@ -176,6 +189,8 @@
@@ -206,6 +219,8 @@
2009-01-23 Roland McGrath <roland@redhat.com>
@@ -96,7 +102,7 @@
* configure.ac (zlib check): Check for gzdirect, need zlib >= 1.2.2.3.
* configure.ac (__thread check): Use AC_LINK_IFELSE, in case of
@@ -256,6 +271,10 @@
@@ -286,6 +301,10 @@
* configure.ac: Add dummy automake conditional to get dependencies
for non-generic linker right. See src/Makefile.am.
@@ -107,7 +113,7 @@
2005-11-18 Roland McGrath <roland@redhat.com>
* Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable.
@@ -303,6 +322,17 @@
@@ -333,6 +352,17 @@
* Makefile.am (all_SUBDIRS): Add libdwfl.
* configure.ac: Write libdwfl/Makefile.
@@ -125,9 +131,11 @@
2005-05-19 Roland McGrath <roland@redhat.com>
* configure.ac [AH_BOTTOM] (INTDECL, _INTDECL): New macros.
--- elfutils/config/ChangeLog
+++ elfutils/config/ChangeLog
@@ -44,6 +44,10 @@
Index: elfutils-0.159/config/ChangeLog
===================================================================
--- elfutils-0.159.orig/config/ChangeLog
+++ elfutils-0.159/config/ChangeLog
@@ -58,6 +58,10 @@
* known-dwarf.awk: Use gawk.
@@ -138,17 +146,19 @@
2010-07-02 Ulrich Drepper <drepper@redhat.com>
* elfutils.spec.in: Add more BuildRequires.
--- elfutils/config/eu.am
+++ elfutils/config/eu.am
Index: elfutils-0.159/config/eu.am
===================================================================
--- elfutils-0.159.orig/config/eu.am
+++ elfutils-0.159/config/eu.am
@@ -1,6 +1,6 @@
## Common automake fragments for elfutils subdirectory makefiles.
##
-## Copyright (C) 2010 Red Hat, Inc.
+## Copyright (C) 2010-2011 Red Hat, Inc.
-## Copyright (C) 2010, 2014 Red Hat, Inc.
+## Copyright (C) 2010-2011, 2014 Red Hat, Inc.
##
## This file is part of elfutils.
##
@@ -29,14 +29,20 @@
@@ -29,13 +29,21 @@
## not, see <http://www.gnu.org/licenses/>.
##
@@ -157,43 +167,26 @@
+
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
AM_CFLAGS = -std=gnu99 -Wall -Wshadow \
- $(if $($(*F)_no_Werror),,-Werror) \
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow \
$(if $($(*F)_no_Werror),,-Werror) \
- $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
+ $(if $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) \
$(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \
+ $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \
$($(*F)_CFLAGS)
+if BUILD_WERROR
+AM_CFLAGS += $(if $($(*F)_no_Werror),,-Werror)
+endif
+
if MUDFLAP
AM_CFLAGS += -fmudflap
libmudflap = -lmudflap
--- elfutils/config.h.in
+++ elfutils/config.h.in
@@ -6,6 +6,9 @@
/* Defined if libdw should support GNU ref_alt FORM, dwz multi files. */
#undef ENABLE_DWZ
COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
+/* Have __builtin_popcount. */
+#undef HAVE_BUILTIN_POPCOUNT
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -102,4 +105,7 @@
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
+/* Stubbed out if missing compiler support. */
+#undef __thread
+
#include <eu-config.h>
--- elfutils/configure.ac
+++ elfutils/configure.ac
@@ -99,6 +99,54 @@ CFLAGS="$old_CFLAGS"])
%.os: %.c %.o
Index: elfutils-0.159/configure.ac
===================================================================
--- elfutils-0.159.orig/configure.ac
+++ elfutils-0.159/configure.ac
@@ -89,6 +89,54 @@ CFLAGS="$old_CFLAGS"])
AS_IF([test "x$ac_cv_c99" != xyes],
AC_MSG_ERROR([gcc with C99 support required]))
@@ -248,7 +241,7 @@
AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
# Use the same flags that we use for our DSOs, so the test is representative.
# Some old compiler/linker/libc combinations fail some ways and not others.
@@ -114,7 +162,10 @@ static __thread int a; int foo (int b) {
@@ -104,7 +152,10 @@ static __thread int a; int foo (int b) {
CFLAGS="$save_CFLAGS"
LDFLAGS="$save_LDFLAGS"])
AS_IF([test "x$ac_cv_tls" != xyes],
@@ -260,9 +253,9 @@
dnl This test must come as early as possible after the compiler configuration
dnl tests, because the choice of the file model can (in principle) affect
@@ -213,6 +264,11 @@ AM_CONDITIONAL(USE_VALGRIND, test "$use_
@@ -183,6 +234,11 @@ AM_CONDITIONAL(USE_VALGRIND, test "$use_
AM_CONDITIONAL(BUILD_STATIC, [dnl
test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes])
test "$use_gprof" = yes -o "$use_gcov" = yes])
+AC_ARG_ENABLE([werror],
+AS_HELP_STRING([--disable-werror],[do not build with -Werror]),
@@ -272,7 +265,7 @@
AC_ARG_ENABLE([tests-rpath],
AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
[tests_use_rpath=$enableval], [tests_use_rpath=no])
@@ -324,7 +380,7 @@ case "$eu_version" in
@@ -297,7 +353,7 @@ case "$eu_version" in
esac
# Round up to the next release API (x.y) version.
@@ -281,9 +274,11 @@
AC_CHECK_SIZEOF(long)
--- elfutils/lib/ChangeLog
+++ elfutils/lib/ChangeLog
@@ -61,6 +61,9 @@
Index: elfutils-0.159/lib/ChangeLog
===================================================================
--- elfutils-0.159.orig/lib/ChangeLog
+++ elfutils-0.159/lib/ChangeLog
@@ -65,6 +65,9 @@
2009-01-23 Roland McGrath <roland@redhat.com>
@@ -293,7 +288,7 @@
* eu-config.h: Add multiple inclusion protection.
2009-01-17 Ulrich Drepper <drepper@redhat.com>
@@ -117,6 +120,11 @@
@@ -121,6 +124,11 @@
* Makefile.am (libeu_a_SOURCES): Add it.
* system.h: Declare crc32_file.
@@ -305,8 +300,10 @@
2005-04-30 Ulrich Drepper <drepper@redhat.com>
* Makefile.am: Use -ffunction-sections for xmalloc.c.
--- elfutils/lib/eu-config.h
+++ elfutils/lib/eu-config.h
Index: elfutils-0.159/lib/eu-config.h
===================================================================
--- elfutils-0.159.orig/lib/eu-config.h
+++ elfutils-0.159/lib/eu-config.h
@@ -162,6 +162,17 @@ asm (".section predict_data, \"aw\"; .pr
/* This macro is used by the tests conditionalize for standalone building. */
#define ELFUTILS_HEADER(name) <lib##name.h>
@@ -325,9 +322,11 @@
#ifdef SHARED
# define OLD_VERSION(name, version) \
--- elfutils/libasm/ChangeLog
+++ elfutils/libasm/ChangeLog
@@ -75,6 +75,11 @@
Index: elfutils-0.159/libasm/ChangeLog
===================================================================
--- elfutils-0.159.orig/libasm/ChangeLog
+++ elfutils-0.159/libasm/ChangeLog
@@ -79,6 +79,11 @@
* asm_error.c: Add new error ASM_E_IOERROR.
* libasmP.h: Add ASM_E_IOERROR definition.
@@ -339,9 +338,11 @@
2005-02-15 Ulrich Drepper <drepper@redhat.com>
* Makefile.am (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2.
--- elfutils/libcpu/ChangeLog
+++ elfutils/libcpu/ChangeLog
@@ -47,6 +47,9 @@
Index: elfutils-0.159/libcpu/ChangeLog
===================================================================
--- elfutils-0.159.orig/libcpu/ChangeLog
+++ elfutils-0.159/libcpu/ChangeLog
@@ -51,6 +51,9 @@
2009-01-23 Roland McGrath <roland@redhat.com>
@@ -351,7 +352,7 @@
* Makefile.am (i386_parse_CFLAGS): Use quotes around command
substitution that can produce leading whitespace.
@@ -376,6 +379,11 @@
@@ -380,6 +383,11 @@
* defs/i386.doc: New file.
* defs/x86_64: New file.
@@ -363,8 +364,10 @@
2005-02-15 Ulrich Drepper <drepper@redhat.com>
* Makefile (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2.
--- elfutils/libcpu/i386_disasm.c
+++ elfutils/libcpu/i386_disasm.c
Index: elfutils-0.159/libcpu/i386_disasm.c
===================================================================
--- elfutils-0.159.orig/libcpu/i386_disasm.c
+++ elfutils-0.159/libcpu/i386_disasm.c
@@ -822,6 +822,7 @@ i386_disasm (const uint8_t **startp, con
default:
@@ -373,9 +376,11 @@
}
}
else
--- elfutils/libdw/ChangeLog
+++ elfutils/libdw/ChangeLog
@@ -346,6 +346,10 @@
Index: elfutils-0.159/libdw/ChangeLog
===================================================================
--- elfutils-0.159.orig/libdw/ChangeLog
+++ elfutils-0.159/libdw/ChangeLog
@@ -420,6 +420,10 @@
* Makefile.am (known-dwarf.h): Run gawk on config/known-dwarf.awk.
@@ -386,7 +391,7 @@
2011-07-14 Mark Wielaard <mjw@redhat.com>
* libdw.h (dwarf_offdie): Fix documentation to mention .debug_info.
@@ -705,6 +709,10 @@
@@ -779,6 +783,10 @@
* dwarf_hasattr_integrate.c: Integrate DW_AT_specification too.
@@ -397,7 +402,7 @@
2009-08-10 Roland McGrath <roland@redhat.com>
* dwarf_getscopevar.c: Use dwarf_diename.
@@ -1473,6 +1481,11 @@
@@ -1547,6 +1555,11 @@
2005-05-31 Roland McGrath <roland@redhat.com>
@@ -409,9 +414,11 @@
* dwarf_formref_die.c (dwarf_formref_die): Add CU header offset to
formref offset.
--- elfutils/libdw/dwarf_begin_elf.c
+++ elfutils/libdw/dwarf_begin_elf.c
@@ -48,6 +48,14 @@
Index: elfutils-0.159/libdw/dwarf_begin_elf.c
===================================================================
--- elfutils-0.159.orig/libdw/dwarf_begin_elf.c
+++ elfutils-0.159/libdw/dwarf_begin_elf.c
@@ -47,6 +47,14 @@
#if USE_ZLIB
# include <endian.h>
# define crc32 loser_crc32
@@ -426,9 +433,11 @@
# include <zlib.h>
# undef crc32
#endif
--- elfutils/libdw/libdw.h
+++ elfutils/libdw/libdw.h
@@ -879,7 +879,7 @@ extern Dwarf_OOM dwarf_new_oom_handler (
Index: elfutils-0.159/libdw/libdw.h
===================================================================
--- elfutils-0.159.orig/libdw/libdw.h
+++ elfutils-0.159/libdw/libdw.h
@@ -891,7 +891,7 @@ extern Dwarf_OOM dwarf_new_oom_handler (
/* Inline optimizations. */
@@ -437,9 +446,11 @@
/* Return attribute code of given attribute. */
__libdw_extern_inline unsigned int
dwarf_whatattr (Dwarf_Attribute *attr)
--- elfutils/libdwfl/ChangeLog
+++ elfutils/libdwfl/ChangeLog
@@ -283,6 +283,21 @@
Index: elfutils-0.159/libdwfl/ChangeLog
===================================================================
--- elfutils-0.159.orig/libdwfl/ChangeLog
+++ elfutils-0.159/libdwfl/ChangeLog
@@ -421,6 +421,21 @@
(dwfl_module_addrsym) (i_to_symfile): New function.
(dwfl_module_addrsym) (search_table): Use it.
@@ -461,7 +472,7 @@
2013-11-07 Jan Kratochvil <jan.kratochvil@redhat.com>
Mark Wielaard <mjw@redhat.com>
@@ -2048,6 +2063,11 @@
@@ -2186,6 +2201,11 @@
2005-07-21 Roland McGrath <roland@redhat.com>
@@ -473,8 +484,10 @@
* Makefile.am (noinst_HEADERS): Add loc2c.c.
* test2.c (main): Check sscanf result to quiet warning.
--- elfutils/libdwfl/linux-core-attach.c
+++ elfutils/libdwfl/linux-core-attach.c
Index: elfutils-0.159/libdwfl/linux-core-attach.c
===================================================================
--- elfutils-0.159.orig/libdwfl/linux-core-attach.c
+++ elfutils-0.159/libdwfl/linux-core-attach.c
@@ -29,6 +29,35 @@
#include "libdwflP.h"
#include <fcntl.h>
@@ -511,40 +524,43 @@
#ifndef MIN
# define MIN(a, b) ((a) < (b) ? (a) : (b))
--- elfutils/libdwfl/linux-pid-attach.c
+++ elfutils/libdwfl/linux-pid-attach.c
@@ -268,13 +268,24 @@ pid_thread_detach (Dwfl_Thread *thread,
pid_arg->tid_attached = 0;
if (! pid_arg->assume_ptrace_stopped)
{
+ // Older kernels (tested kernel-2.6.18-348.12.1.el5.x86_64) need special
+ // handling of the detachment to keep the process State: T (stopped).
+ if (pid_arg->tid_was_stopped)
+ syscall (__NR_tkill, tid, SIGSTOP);
/* This handling is needed only on older Linux kernels such as
- 2.6.32-358.23.2.el6.ppc64. Later kernels such as
- 3.11.7-200.fc19.x86_64 remember the T (stopped) state
- themselves and no longer need to pass SIGSTOP during
- PTRACE_DETACH. */
+ 2.6.32-358.23.2.el6.ppc64. Later kernels such as 3.11.7-200.fc19.x86_64
+ remember the T (stopped) state themselves and no longer need to pass
+ SIGSTOP during PTRACE_DETACH. */
ptrace (PTRACE_DETACH, tid, NULL,
(void *) (intptr_t) (pid_arg->tid_was_stopped ? SIGSTOP : 0));
+ if (pid_arg->tid_was_stopped)
+ {
+ // Wait till the SIGSTOP settles down.
+ int i;
+ for (i = 0; i < 100000; i++)
+ if (linux_proc_pid_is_stopped (tid))
+ break;
+ }
}
Index: elfutils-0.159/libdwfl/linux-pid-attach.c
===================================================================
--- elfutils-0.159.orig/libdwfl/linux-pid-attach.c
+++ elfutils-0.159/libdwfl/linux-pid-attach.c
@@ -255,6 +255,11 @@ void
internal_function
__libdwfl_ptrace_detach (pid_t tid, bool tid_was_stopped)
{
+ // Older kernels (tested kernel-2.6.18-348.12.1.el5.x86_64) need special
+ // handling of the detachment to keep the process State: T (stopped).
+ if (tid_was_stopped)
+ syscall (__NR_tkill, tid, SIGSTOP);
+
/* This handling is needed only on older Linux kernels such as
2.6.32-358.23.2.el6.ppc64. Later kernels such as
3.11.7-200.fc19.x86_64 remember the T (stopped) state
@@ -262,6 +267,15 @@ __libdwfl_ptrace_detach (pid_t tid, bool
PTRACE_DETACH. */
ptrace (PTRACE_DETACH, tid, NULL,
(void *) (intptr_t) (tid_was_stopped ? SIGSTOP : 0));
+
+ if (tid_was_stopped)
+ {
+ // Wait till the SIGSTOP settles down.
+ int i;
+ for (i = 0; i < 100000; i++)
+ if (linux_proc_pid_is_stopped (tid))
+ break;
+ }
}
--- elfutils/libebl/ChangeLog
+++ elfutils/libebl/ChangeLog
@@ -738,6 +738,11 @@
static void
Index: elfutils-0.159/libebl/ChangeLog
===================================================================
--- elfutils-0.159.orig/libebl/ChangeLog
+++ elfutils-0.159/libebl/ChangeLog
@@ -748,6 +748,11 @@
* Makefile.am (libebl_*_so_SOURCES): Set to $(*_SRCS) so dependency
tracking works right.
@@ -556,9 +572,11 @@
2005-05-21 Ulrich Drepper <drepper@redhat.com>
* libebl_x86_64.map: Add x86_64_core_note.
--- elfutils/libelf/ChangeLog
+++ elfutils/libelf/ChangeLog
@@ -85,6 +85,11 @@
Index: elfutils-0.159/libelf/ChangeLog
===================================================================
--- elfutils-0.159.orig/libelf/ChangeLog
+++ elfutils-0.159/libelf/ChangeLog
@@ -135,6 +135,11 @@
* elf-knowledge.h (SECTION_STRIP_P): Remove < SHT_NUM check.
@@ -570,7 +588,7 @@
2011-02-26 Mark Wielaard <mjw@redhat.com>
* elf_end.c (elf_end): Call rwlock_unlock before rwlock_fini.
@@ -762,6 +767,11 @@
@@ -812,6 +817,11 @@
* elf.h: Update from glibc.
@@ -582,8 +600,10 @@
2005-05-08 Roland McGrath <roland@redhat.com>
* elf_begin.c (read_file) [_MUDFLAP]: Don't use mmap for now.
--- elfutils/libelf/common.h
+++ elfutils/libelf/common.h
Index: elfutils-0.159/libelf/common.h
===================================================================
--- elfutils-0.159.orig/libelf/common.h
+++ elfutils-0.159/libelf/common.h
@@ -139,7 +139,7 @@ libelf_release_all (Elf *elf)
(Var) = (sizeof (Var) == 1 \
? (unsigned char) (Var) \
@@ -602,8 +622,10 @@
: (sizeof (Var) == 4 \
? bswap_32 (Var) \
: bswap_64 (Var))))
--- elfutils/libelf/gnuhash_xlate.h
+++ elfutils/libelf/gnuhash_xlate.h
Index: elfutils-0.159/libelf/gnuhash_xlate.h
===================================================================
--- elfutils-0.159.orig/libelf/gnuhash_xlate.h
+++ elfutils-0.159/libelf/gnuhash_xlate.h
@@ -1,5 +1,5 @@
/* Conversion functions for versioning information.
- Copyright (C) 2006, 2007 Red Hat, Inc.
@@ -622,8 +644,10 @@
len -= 4;
}
}
--- elfutils/src/addr2line.c
+++ elfutils/src/addr2line.c
Index: elfutils-0.159/src/addr2line.c
===================================================================
--- elfutils-0.159.orig/src/addr2line.c
+++ elfutils-0.159/src/addr2line.c
@@ -540,10 +540,10 @@ handle_address (const char *string, Dwfl
bool parsed = false;
int i, j;
@@ -637,9 +661,11 @@
{
default:
break;
--- elfutils/src/ChangeLog
+++ elfutils/src/ChangeLog
@@ -964,8 +964,16 @@
Index: elfutils-0.159/src/ChangeLog
===================================================================
--- elfutils-0.159.orig/src/ChangeLog
+++ elfutils-0.159/src/ChangeLog
@@ -1112,8 +1112,16 @@
* readelf.c (attr_callback): Use print_block only when we don't use
print_ops.
@@ -656,7 +682,7 @@
* ar.c (do_oper_extract): Use pathconf instead of statfs.
2009-08-01 Ulrich Drepper <drepper@redhat.com>
@@ -1129,6 +1137,8 @@
@@ -1277,6 +1285,8 @@
* readelf.c (print_debug_frame_section): Use t instead of j formats
for ptrdiff_t OFFSET.
@@ -665,7 +691,7 @@
2009-01-21 Ulrich Drepper <drepper@redhat.com>
* elflint.c (check_program_header): Fix typo in .eh_frame_hdr section
@@ -1312,6 +1322,11 @@
@@ -1460,6 +1470,11 @@
that matches its PT_LOAD's p_flags &~ PF_W. On sparc, PF_X really
is valid in RELRO.
@@ -677,7 +703,7 @@
2008-02-29 Roland McGrath <roland@redhat.com>
* readelf.c (print_attributes): Add a cast.
@@ -1563,6 +1578,8 @@
@@ -1711,6 +1726,8 @@
* readelf.c (hex_dump): Fix rounding error in whitespace calculation.
@@ -686,7 +712,7 @@
2007-10-15 Roland McGrath <roland@redhat.com>
* make-debug-archive.in: New file.
@@ -2002,6 +2019,10 @@
@@ -2150,6 +2167,10 @@
* elflint.c (valid_e_machine): Add EM_ALPHA.
Reported by Christian Aichinger <Greek0@gmx.net>.
@@ -697,7 +723,7 @@
2006-08-08 Ulrich Drepper <drepper@redhat.com>
* elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB.
@@ -2078,6 +2099,10 @@
@@ -2226,6 +2247,10 @@
* Makefile.am: Add hacks to create dependency files for non-generic
linker.
@@ -708,7 +734,7 @@
2006-06-12 Ulrich Drepper <drepper@redhat.com>
* ldgeneric.c (ld_generic_generate_sections): Don't create .interp
@@ -2426,6 +2451,11 @@
@@ -2574,6 +2599,11 @@
* readelf.c (print_debug_loc_section): Fix indentation for larger
address size.
@@ -720,8 +746,10 @@
2005-05-30 Roland McGrath <roland@redhat.com>
* readelf.c (print_debug_line_section): Print section offset of each
--- elfutils/src/findtextrel.c
+++ elfutils/src/findtextrel.c
Index: elfutils-0.159/src/findtextrel.c
===================================================================
--- elfutils-0.159.orig/src/findtextrel.c
+++ elfutils-0.159/src/findtextrel.c
@@ -496,7 +496,11 @@ ptrcompare (const void *p1, const void *
@@ -735,8 +763,10 @@
GElf_Addr addr, Elf *elf, Elf_Scn *symscn, Dwarf *dw,
const char *fname, bool more_than_one, void **knownsrcs)
{
--- elfutils/src/ld.h
+++ elfutils/src/ld.h
Index: elfutils-0.159/src/ld.h
===================================================================
--- elfutils-0.159.orig/src/ld.h
+++ elfutils-0.159/src/ld.h
@@ -1114,6 +1114,7 @@ extern bool dynamically_linked_p (void);
/* Checked whether the symbol is undefined and referenced from a DSO. */
@@ -752,21 +782,27 @@
+#endif /* Optimizing and not GCC 4.2. */
#endif /* ld.h */
--- elfutils/src/Makefile.am
+++ elfutils/src/Makefile.am
@@ -95,6 +95,9 @@ addr2line_no_Wformat = yes
Index: elfutils-0.159/src/Makefile.am
===================================================================
--- elfutils-0.159.orig/src/Makefile.am
+++ elfutils-0.159/src/Makefile.am
@@ -89,6 +89,11 @@ endif
# XXX While the file is not finished, don't warn about this
ldgeneric_no_Wunused = yes
+# Buggy old compilers.
+# Buggy old compilers or libc headers.
+readelf_no_Werror = yes
+strings_no_Werror = yes
+addr2line_no_Wformat = yes
+
readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl \
readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl
nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl \
$(demanglelib)
--- elfutils/src/readelf.c
+++ elfutils/src/readelf.c
@@ -4171,10 +4171,12 @@ listptr_base (struct listptr *p)
Index: elfutils-0.159/src/readelf.c
===================================================================
--- elfutils-0.159.orig/src/readelf.c
+++ elfutils-0.159/src/readelf.c
@@ -4239,10 +4239,12 @@ listptr_base (struct listptr *p)
return base;
}
@@ -781,7 +817,7 @@
struct listptr *p1 = (void *) a;
struct listptr *p2 = (void *) b;
@@ -4263,8 +4265,11 @@ static void
@@ -4331,8 +4333,11 @@ static void
sort_listptr (struct listptr_table *table, const char *name)
{
if (table->n > 0)
@@ -795,7 +831,7 @@
}
static bool
@@ -9151,7 +9156,7 @@ dump_archive_index (Elf *elf, const char
@@ -9252,7 +9257,7 @@ dump_archive_index (Elf *elf, const char
if (unlikely (elf_rand (elf, as_off) == 0)
|| unlikely ((subelf = elf_begin (-1, ELF_C_READ_MMAP, elf))
== NULL))
@@ -804,8 +840,10 @@
while (1)
#endif
error (EXIT_FAILURE, 0,
--- elfutils/src/strings.c
+++ elfutils/src/strings.c
Index: elfutils-0.159/src/strings.c
===================================================================
--- elfutils-0.159.orig/src/strings.c
+++ elfutils-0.159/src/strings.c
@@ -43,6 +43,10 @@
#include <system.h>
@@ -817,7 +855,7 @@
/* Prototypes of local functions. */
static int read_fd (int fd, const char *fname, off64_t fdlen);
@@ -483,8 +487,13 @@ map_file (int fd, off64_t start_off, off
@@ -489,8 +493,13 @@ map_file (int fd, off64_t start_off, off
fd, start_off);
if (mem != MAP_FAILED)
{
@@ -831,7 +869,7 @@
break;
}
if (errno != EINVAL && errno != ENOMEM)
@@ -576,9 +585,11 @@ read_block (int fd, const char *fname, o
@@ -581,9 +590,11 @@ read_block (int fd, const char *fname, o
elfmap_off = from & ~(ps - 1);
elfmap_base = elfmap = map_file (fd, elfmap_off, fdlen, &elfmap_size);
@@ -843,8 +881,10 @@
}
if (unlikely (elfmap == MAP_FAILED))
--- elfutils/src/strip.c
+++ elfutils/src/strip.c
Index: elfutils-0.159/src/strip.c
===================================================================
--- elfutils-0.159.orig/src/strip.c
+++ elfutils-0.159/src/strip.c
@@ -45,6 +45,12 @@
#include <libebl.h>
#include <system.h>
@@ -877,7 +917,7 @@
}
/* Open the file. */
@@ -2060,7 +2076,7 @@ while computing checksum for debug infor
@@ -2086,7 +2102,7 @@ while computing checksum for debug infor
/* If requested, preserve the timestamp. */
if (tvp != NULL)
{
@@ -886,7 +926,7 @@
{
error (0, errno, gettext ("\
cannot set access and modification date of '%s'"),
@@ -2117,7 +2133,7 @@ handle_ar (int fd, Elf *elf, const char
@@ -2143,7 +2159,7 @@ handle_ar (int fd, Elf *elf, const char
if (tvp != NULL)
{
@@ -895,8 +935,10 @@
{
error (0, errno, gettext ("\
cannot set access and modification date of '%s'"), fname);
--- elfutils/tests/backtrace.c
+++ elfutils/tests/backtrace.c
Index: elfutils-0.159/tests/backtrace.c
===================================================================
--- elfutils-0.159.orig/tests/backtrace.c
+++ elfutils-0.159/tests/backtrace.c
@@ -36,6 +36,7 @@
#include <fcntl.h>
#include <string.h>
@@ -904,10 +946,12 @@
+#include <sys/syscall.h>
#include ELFUTILS_HEADER(dwfl)
static int
--- elfutils/tests/ChangeLog
+++ elfutils/tests/ChangeLog
@@ -123,6 +123,13 @@
#ifndef __linux__
Index: elfutils-0.159/tests/ChangeLog
===================================================================
--- elfutils-0.159.orig/tests/ChangeLog
+++ elfutils-0.159/tests/ChangeLog
@@ -283,6 +283,13 @@
2013-12-02 Jan Kratochvil <jan.kratochvil@redhat.com>
@@ -921,7 +965,7 @@
* Makefile.am (check_PROGRAMS): Add backtrace, backtrace-child,
backtrace-data and backtrace-dwarf.
(BUILT_SOURCES, clean-local, backtrace-child-biarch): New.
@@ -987,6 +994,8 @@
@@ -1147,6 +1154,8 @@
2008-01-21 Roland McGrath <roland@redhat.com>
@@ -930,7 +974,7 @@
* testfile45.S.bz2: Add tests for cltq, cqto.
* testfile45.expect.bz2: Adjust.
@@ -1695,6 +1704,11 @@
@@ -1855,6 +1864,11 @@
* Makefile.am (TESTS): Add run-elflint-test.sh.
(EXTRA_DIST): Add run-elflint-test.sh and testfile18.bz2.
@@ -942,8 +986,10 @@
2005-05-24 Ulrich Drepper <drepper@redhat.com>
* get-files.c (main): Use correct format specifier.
--- elfutils/tests/line2addr.c
+++ elfutils/tests/line2addr.c
Index: elfutils-0.159/tests/line2addr.c
===================================================================
--- elfutils-0.159.orig/tests/line2addr.c
+++ elfutils-0.159/tests/line2addr.c
@@ -124,7 +124,7 @@ main (int argc, char *argv[])
{
struct args a = { .arg = argv[cnt] };
@@ -953,3 +999,15 @@
{
default:
case 0:
Index: elfutils-0.159/tests/Makefile.am
===================================================================
--- elfutils-0.159.orig/tests/Makefile.am
+++ elfutils-0.159/tests/Makefile.am
@@ -356,6 +356,7 @@ get_lines_LDADD = $(libdw) $(libelf)
get_files_LDADD = $(libdw) $(libelf)
get_aranges_LDADD = $(libdw) $(libelf)
allfcts_LDADD = $(libdw) $(libelf)
+line2addr_no_Wformat = yes
line2addr_LDADD = $(libdw)
addrscopes_LDADD = $(libdw)
funcscopes_LDADD = $(libdw)
@@ -7,14 +7,20 @@ DEPENDS = "libtool bzip2 zlib virtual/libintl"
SRC_URI = "https://fedorahosted.org/releases/e/l/elfutils/${PV}/elfutils-${PV}.tar.bz2"
SRC_URI[md5sum] = "050a4909e452d01ab4747fd69d4036e0"
SRC_URI[sha256sum] = "be27af5c21352f53e010342bf1c68e0b9e18232dbf3adec7e2f9b41f6bbe397d"
SRC_URI[md5sum] = "7527f22dff8b1ac8c122cfc4d3d3bb1e"
SRC_URI[sha256sum] = "741b556863c069ceab2d81eb54aeda8c34f46728859704eaf9baef8503e9a9d1"
# Pick patches from debian
# http://ftp.de.debian.org/debian/pool/main/e/elfutils/elfutils_0.158-2.debian.tar.xz
SRC_URI += "\
file://mempcpy.patch \
file://dso-link-change.patch \
file://Fix_elf_cvt_gunhash.patch \
file://fixheadercheck.patch \
"
# pick the patch from debian
# http://ftp.de.debian.org/debian/pool/main/e/elfutils/elfutils_0.159-4.debian.tar.xz
SRC_URI += "\
file://redhat-portability.diff \
file://redhat-robustify.diff \
file://hppa_backend.diff \
file://arm_backend.diff \
file://mips_backend.diff \
@@ -22,15 +28,9 @@ SRC_URI += "\
file://testsuite-ignore-elflint.diff \
file://scanf-format.patch \
file://mips_readelf_w.patch \
file://core_filename.patch \
file://CVE-2014-0172.patch \
file://unwind_non_linux.patch \
file://elf_additions.diff \
file://mempcpy.patch \
file://dso-link-change.patch \
file://m4-biarch.m4-tweak-AC_RUN_IFELSE-for-cross-compiling.patch \
file://fixheadercheck.patch \
file://Fix_elf_cvt_gunhash.patch \
file://arm_func_value.patch \
file://arm_unwind_ret_mask.patch \
file://non_linux.patch \
"
# Only apply when building uclibc based target recipe