platform/upstream/libunwind.git
7 years agoAdd baselibs package sandbox/giuliana/x86_baselibs
Jiyoung Yun [Wed, 15 Mar 2017 10:01:06 +0000 (19:01 +0900)]
Add baselibs package

Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
7 years agoSwitching off -fno-common since it breaks build 87/88887/1 accepted/tizen_common sandbox/klewandowski/tizen-branch-backup-v1.1-before-upgrade accepted/tizen/3.0/common/20161114.111048 accepted/tizen/common/20161012.154558 submit/tizen/20161012.055718 submit/tizen_3.0_common/20161104.104000
Dongkyun, Son [Wed, 7 Sep 2016 05:32:24 +0000 (14:32 +0900)]
Switching off -fno-common since it breaks build

Change-Id: I6872fdcd14ddd49737d2a1a1929b32d260e7ccbe
Signed-off-by: Dongkyun, Son <dongkyun.s@samsung.com>
Signed-off-by: Chan Lee <chan45.lee@samsung.com>
9 years agopackaging: enable build for aarch64 accepted/tizen_3.0.2014.q3_common accepted/tizen_3.0.m14.3_ivi accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable tizen_3.0.2014.q3_common tizen_3.0.2014.q4_common tizen_3.0.2015.q1_common tizen_3.0.2015.q2_common tizen_3.0.m14.3_ivi tizen_3.0.m1_mobile tizen_3.0.m1_tv tizen_3.0_ivi accepted/tizen/3.0/common/20161219.113808 accepted/tizen/3.0/ivi/20161011.050542 accepted/tizen/3.0/mobile/20161015.033837 accepted/tizen/3.0/tv/20161016.005056 accepted/tizen/3.0/wearable/20161015.083557 accepted/tizen/base/20161216.190432 accepted/tizen/common/20140918.164420 accepted/tizen/ivi/20140926.185803 accepted/tizen/ivi/20160218.025207 submit/tizen/20140918.101601 submit/tizen_3.0_common/20161219.011142 submit/tizen_3.0_ivi/20161010.000004 submit/tizen_3.0_mobile/20161015.000004 submit/tizen_3.0_tv/20161015.000003 submit/tizen_3.0_wearable/20161015.000004 submit/tizen_base/20161216.050741 submit/tizen_common/20151015.190624 submit/tizen_common/20151019.135620 submit/tizen_common/20161214.152409 submit/tizen_ivi/20160217.000000 submit/tizen_ivi/20160217.000006 submit/tizen_mobile/20141120.000000 tizen_3.0.2014.q3_common_release tizen_3.0.m14.3_ivi_release tizen_3.0.m1_mobile_release tizen_3.0.m1_tv_release tizen_3.0.m2.a1_mobile_release tizen_3.0.m2.a1_tv_release tizen_3.0_ivi_release
Chanho Park [Fri, 22 Aug 2014 01:39:32 +0000 (10:39 +0900)]
packaging: enable build for aarch64

Change-Id: If257a96544e3748d89f67d7b30ea8a18e532d0a7
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
9 years agoFix compiler warnings when UNW_DEBUG is enabled
Arun Sharma [Tue, 19 Aug 2014 14:53:57 +0000 (07:53 -0700)]
Fix compiler warnings when UNW_DEBUG is enabled

Newer versions of gcc complain when ALWAYS_INLINE is used without
inline.

9 years agoFix empty structs in libunwind-x86_64.h
Лежанкин Иван [Tue, 19 Aug 2014 10:20:58 +0000 (14:20 +0400)]
Fix empty structs in libunwind-x86_64.h

Hi,

there is a compilation issue with Clang and latest libunwind - It's
about "typedef struct unw_tdep_save_loc" and one more struct:

include/libunwind-x86_64.h:111:9: error: empty struct has size 0 in C,
size 1 in C++ [-Werror,-Wextern-c-compat]

The solution is very simple:

9 years agoRemove unnecessary calls to labs()
Paul Pluzhnikov [Tue, 29 Jul 2014 20:27:43 +0000 (13:27 -0700)]
Remove unnecessary calls to labs()

Greetings,

Roman reports that Clang warns on unnecessary calls to labs():

  taking the absolute value of unsigned type 'unw_word_t' (aka
'unsigned long') has no effect [-Werror,-Wabsolute-value]

Since rs->reg[...].val is unw_word_t and unsigned on all platforms,
this patch removes the unnecessary calls to labs().

Tested on Linux x86_64, no regressions.

Thanks,
--
Paul Pluzhnikov

9 years agoCorrect name returned by get_proc_name() for some frames.
Konstantin Belousov [Sat, 28 Jun 2014 20:28:10 +0000 (23:28 +0300)]
Correct name returned by get_proc_name() for some frames.

Fix returning the name of the function containing the frame PC,
for the non-interrupted frames.  The symbol lookup code should
take use_prev_instr value into account, otherwise it could return
the name of the function adjacent to the caller.

9 years agoAdjust use_prev_instr for syscall and frame-chain frames.
Konstantin Belousov [Sat, 28 Jun 2014 20:28:09 +0000 (23:28 +0300)]
Adjust use_prev_instr for syscall and frame-chain frames.

Mark frames which are unwound with the frame-chain walker or
syscall frame code, as non-interrupted.  The return PC in the frame
points to the instruction after the call.

9 years agoUse helper to walk past the syscall frames on FreeBSD/x86, similar to FreeBSD/x86_64.
Konstantin Belousov [Sat, 28 Jun 2014 20:28:08 +0000 (23:28 +0300)]
Use helper to walk past the syscall frames on FreeBSD/x86, similar to FreeBSD/x86_64.

The syscall trampolines in FreeBSD libc do not have unwind annotations.

9 years agoLink libunwind to libgcc_s rather than libgcc
Thierry Reding [Fri, 27 Jun 2014 06:40:33 +0000 (08:40 +0200)]
Link libunwind to libgcc_s rather than libgcc

For some architectures, -lgcc and -lgcc_s are not equivalent. On ARM for
example, libgcc_s.so.1 contains some symbols needed by libunwind which
are not present in libgcc.

This causes the following link error when building the X.Org X server
with libunwind support:

  CCLD     Xorg
/usr/lib/libunwind.so: undefined reference to `__aeabi_unwind_cpp_pr0'
/usr/lib/libunwind.so: undefined reference to `__aeabi_unwind_cpp_pr1'

Linking against libgcc_s explicitly solves this problem.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agoDo not compute load offset for MiniDebugInfo
Martin Milata [Wed, 5 Jun 2013 14:10:47 +0000 (16:10 +0200)]
Do not compute load offset for MiniDebugInfo

We already have the value computed based on the executable. Furthermore,
debuginfo need not have valid program header table, thus the result
might be bogus.

Signed-off-by: Martin Milata <mmilata@redhat.com>
9 years agox86_64: Handle edge conditions with zero length frames
Kevin Modzelewski [Mon, 19 May 2014 02:32:28 +0000 (19:32 -0700)]
x86_64: Handle edge conditions with zero length frames

When JITs generate code without unwind information, it may be possible
to continue unwinding via RBP chaining. However, we currently disallow
RBP==RSP condition even though we can make forward progress.

Relax the check a bit in the code where we switch from one type of
unwinding to another to handle this situation. JIT authors
are encouraged to use the dynamic unwind info registration API when
the underlying platform supports it.

Signed-off-by: Kevin Modzelewski <kmod@dropbox.com>
9 years agoAARCH64: Change Debug calls to use %lx instead of %x.
Christopher Ferris [Thu, 27 Feb 2014 19:18:29 +0000 (11:18 -0800)]
AARCH64: Change Debug calls to use %lx instead of %x.

The attached patch simply modifies the Debug statements for aarch64 to use
%lx instead of %x. Tested by compiling for aarch64 using a cross-compiler.

Signed-off-by: Christopher Ferris <cferris@google.com>
9 years agolink sublibs against liblzma as needed
Mike Frysinger [Sun, 16 Feb 2014 02:09:42 +0000 (21:09 -0500)]
link sublibs against liblzma as needed

The coredump/elf32/elf64/elfxx libs use lzma funcs but don't link against
it.  This produces sub-shared libs that don't link against lzma and can
make the linker angry due to underlinking like so:

libtool: link: x86_64-pc-linux-gnu-gcc -O2 -march=amdfam10 -pipe -g \
-frecord-gcc-switches -Wimplicit-function-declaration -fexceptions \
-Wall -Wsign-compare -Wl,-O1 -Wl,--hash-style=gnu \
-o .libs/test-coredump-unwind test-coredump-unwind.o  \
../src/.libs/libunwind-coredump.so ../src/.libs/libunwind-x86_64.so
../src/.libs/libunwind-coredump.so: error: undefined reference to 'lzma_stream_footer_decode'
../src/.libs/libunwind-coredump.so: error: undefined reference to 'lzma_index_buffer_decode'
../src/.libs/libunwind-coredump.so: error: undefined reference to 'lzma_index_size'
../src/.libs/libunwind-coredump.so: error: undefined reference to 'lzma_index_end'
../src/.libs/libunwind-coredump.so: error: undefined reference to 'lzma_index_uncompressed_size'
../src/.libs/libunwind-coredump.so: error: undefined reference to 'lzma_stream_buffer_decode'
collect2: error: ld returned 1 exit status

So add LIBLZMA to the right LIBADD for each of these libraries.

URL: https://bugs.gentoo.org/444050
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
9 years agoImplement DWARF DW_CFA_val_expression for x86_64
Tim Deegan [Mon, 3 Feb 2014 11:01:10 +0000 (12:01 +0100)]
Implement DWARF DW_CFA_val_expression for x86_64

Ubuntu's libc-bin (2.15-0ubuntu20.2) on x86_64 uses DW_CFA_val_expression
in describing the pthread spinlock operations __lll_unlock_wake() and
__lll_lock_wait().  libunwind 1.1 doesn't understand that opcode and
so backtraces from those operations are truncated.

This changeset adds basic support for it, by adding a new type to
dwarf_loc_t that describes the register's actual contents rather than
its location.  I've only implemented the new type for x86_64, and
stubbed it out for all other architectures -- it looks like a lot
of that code is duplicated so oughtn't to be that hard, but I don't
have test cases for them.

Tested that DW_CFA_val_expression works on x86_64 (by using
https://code.google.com/p/gperftools/ on a lock-heavy program).
Build-tested on x86, x86_64 and arm.  The unit tests don't pass for me
on any of those archs, but this cset doesn't break anything that was
passing before.

Signed-off-by: Tim Deegan <tjd@phlegethon.org>
9 years agoMissing header in dist tarball.
Tim Deegan [Mon, 20 Jan 2014 11:42:23 +0000 (12:42 +0100)]
Missing header in dist tarball.

Signed-off-by: Tim Deegan <tjd@phlegethon.org>
9 years agoSupport powerpc64le-linux platform
Ulrich Weigand [Tue, 17 Dec 2013 14:01:34 +0000 (15:01 +0100)]
Support powerpc64le-linux platform

This patch adds support for the powerpc64le-linux platform.  It consists
of two main features:

- Support little-endian byte order
  This is done via a "big_endian" member of struct unw_addr_space,
  which is evaluated by common code via the dwarf_is_big_endian
  macro, and also in endian-aware code in unw_is_signal_frame.

- Support the ELFv2 ABI
  This is done via an "abi" member of struct unw_addr_space.  This
  is currently only needed in tdep_get_func_addr, since the ELFv2
  ABI does not use function descriptors.

Both new members are initialized in unw_create_addr_space and
ppc64_local_addr_space_init, following the mips precedent.

Since ppc32 and ppc64 now no longer share the unw_create_addr_space
implementation, the file is duplicated from the ppc directory into
ppc32/ppc64.

Tested on powerpc64-linux and powerpc64le-linux.  Support on LE
seems to be as good as existing BE support; I have not attempted to
fix the existing shortcomings of PPC support that already cause a
number to tests to fail due to unimplemented features.

Signed-off-by: Ulrich Weigand <uweigand@de.ibm.com>
9 years agoFix test case link failure on PowerPC systems with Altivec
Ulrich Weigand [Tue, 17 Dec 2013 14:00:54 +0000 (15:00 +0100)]
Fix test case link failure on PowerPC systems with Altivec

On systems where the system compiler supports Altivec by default,
the libunwind Makefile will attempt to build an extra test case
ppc64-test-altivec.  Unfortunately, the link step will fail since
the Makefile does not actually link against the libunwind library.

Fixed by adding the appropriate LDADD macro.

Signed-off-by: Ulrich Weigand <uweigand@de.ibm.com>
9 years agoPass relocated address to tdep_get_func_addr
Ulrich Weigand [Tue, 17 Dec 2013 14:00:13 +0000 (15:00 +0100)]
Pass relocated address to tdep_get_func_addr

The ppc64 implementation of tdep_get_func_addr would crash when
attempting to retrieve the address of a function in a shared
library.  The problem was that it needs to dereference the
function descriptor, but common code was passing the *unrelocated*
adddress of the descriptor to the tdep_get_func_addr routine.

Instead, common code would attempt to relocate the *result* of
tdep_get_func_addr, which is also wrong: the ppc64 implementation
reads the function address from the in-memory copy of the
descriptor, which is already relocation and contains the final
address.

This patch fixes the problem by relocating the descriptor address
before passing it to tdep_get_func_addr, instead of relocating
the result of tdep_get_func_addr.  Since ppc64 is the only
non-trivial implementation of tdep_get_func_addr, this cannot
affect any other platform.

Signed-off-by: Ulrich Weigand <uweigand@de.ibm.com>
9 years agoFix undefined behavior in dwarf_eval_expr
Ulrich Weigand [Tue, 17 Dec 2013 13:59:28 +0000 (14:59 +0100)]
Fix undefined behavior in dwarf_eval_expr

The dwarf_eval_expr routine uses macros push, pop, and pick to
manipulate the DWARF expression stack.  When these macros are
nested, e.g. in the implementation of DW_OP_dup:
          push (pick (0));
the combination can lead to unfortunate results.

In particular, when substituting into:
do {
  if (tos >= MAX_EXPR_STACK_SIZE)
    {
      Debug (1, "Stack overflow\n");
      return -UNW_EINVAL;
    }
  stack[tos++] = (x);
} while (0)
a value of "x" that makes use of "tos" (as instances of the
pick or pop macros do), the resulting expression will both
use and modify tos without an intervening sequence point,
which is undefined behavior according to the C standard.

And in fact with current GCC on PowerPC, this leads to a
miscompilation of the DW_OP_dup implementation.

This patch fixes the problem by assigning "x" to a
temporary variable before modifying tos.

Signed-off-by: Ulrich Weigand <uweigand@de.ibm.com>
9 years agoUse adaptive mutexes when available.
Arun Sharma [Mon, 18 Nov 2013 04:33:33 +0000 (20:33 -0800)]
Use adaptive mutexes when available.

9 years agoRemove one of duplicated declarations of `get_proc_name'
Masatake YAMATO [Sat, 21 Sep 2013 17:50:38 +0000 (02:50 +0900)]
Remove one of duplicated declarations of `get_proc_name'

Declarations of `get_proc_name' of is duplicated.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 years agoMissing -llzma in libunwind.pc
Masatake YAMATO [Thu, 5 Sep 2013 10:44:41 +0000 (19:44 +0900)]
Missing -llzma in libunwind.pc

liblzuma used in decoding MiniDebuginfo is not listed in
libunwind.pc.

Changes in version 2 of patch:

* Don't check HAVE_LZMA. It is redundant.
* Make liblzma as private libraries in use.

Both are suggested by Mike Frysinger <vapier@gentoo.org>.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 years agoAdd Cflags keyword to pkg-config metadata files
Luca Clementi [Fri, 23 Aug 2013 06:49:16 +0000 (23:49 -0700)]
Add Cflags keyword to pkg-config metadata files

pkg-config metadata template files are missing Cflags keyword
which is required to properly compile against libunwind using
PKG_* autoconf macros

Acked-by: Mike Frysinger <vapier@gentoo.org>
9 years agoFix unwind info freeing code in DWARF parser
Matt Fischer [Tue, 14 May 2013 22:39:24 +0000 (17:39 -0500)]
Fix unwind info freeing code in DWARF parser

The DWARF code allocates its unwind_info objects out of a
memory pool.  The code which frees the object therefore calls
the mempool freeing code.  However, there are cases where the
free code will be run with an unwind_info that was allocated
through a different mechanism (e.g. an ARM exidx table entry).
In these cases, the object should not be freed through the
mempool code.

To correct this, a check was added to ensure that the unwind_info
is of the appropriate type before passing the object along to the
mempool to be freed.

9 years agoFix a build error
Arun Sharma [Sun, 19 May 2013 07:04:15 +0000 (00:04 -0700)]
Fix a build error

<elf.h> needs to be included before the check for ELF_CLASS.

9 years agoFixup long lines.
Arun Sharma [Sun, 19 May 2013 06:20:03 +0000 (23:20 -0700)]
Fixup long lines.

9 years agoAdd basic support for the QNX operating system
Matt Fischer [Mon, 15 Apr 2013 14:53:29 +0000 (09:53 -0500)]
Add basic support for the QNX operating system

This change adds some special cases to allow libunwind to compile
for QNX.

* QNX's copy of <elf.h> and <link.h> reside in sys/ instead.  To deal
  with this, an AC_CHECK_HEADERS() was added to check for the files
  in both locations.
* Similarly, QNX does not have <endian.h>.  In cases where the file is
  not found, logic was added to refer to QNX-specific macros to determine
  endianness.
* The QCC compiler, which is a wrapper around GCC, cannot handle some
  standard GCC options.  Therefore, logic was added to check for QCC,
  and when it is found, to suppress the use of -lgcc, and to express the
  option -nostartfiles as -Wc,-nostartfiles instead, which is correctly
  passed on to the underlying GCC.
* Finally, the support file os-qnx.c was added, patterned after the existing
  os-*.c files.  Only local image lookup is currently supported (see the
  comments for more information), but this is sufficient for QNX, since
  ptrace is not supported there anyway, and that is the only case where the
  function is required to do remote image lookup.

Change-Id: Ie7934f94a7317bdde59335f2acd4c3a97c0384c1

9 years agoAArch64 port.
Yvan Roux [Sat, 11 May 2013 15:18:23 +0000 (09:18 -0600)]
AArch64 port.

9 years agoFix symlink install hook
Matt Fischer [Fri, 19 Apr 2013 20:18:27 +0000 (15:18 -0500)]
Fix symlink install hook

During the install, symlinks are added from libunwind-<arch> to
libunwind-generic.  However, on platforms that don't support
symlinking (such as Windows), the $(LN_S) macro is defined
as 'cp -p' instead.  This works fine, except that since the
target of the symlink is a relative path, the copy will only
succeed if the current directory is the directory that contains
the file.

The solution to this problem suggested in the Autotools manual
(see http://www.gnu.org/software/automake/manual/automake.html#Extending)
is to simply cd into the correct directory first.  This patch
makes that change for the symlinks that are being made during install.

[ edit: use relative path for the link name as well ]

9 years agoBuild crasher test only when coredump support is enabled
Matt Fischer [Fri, 19 Apr 2013 15:01:57 +0000 (10:01 -0500)]
Build crasher test only when coredump support is enabled

The crasher test is used as part of the coredump test suite,
but is being built regardless of whether that support has been
configured or not.  This patch changes the build so that it is
only built when coredump support is enabled.

9 years agoAdded --enable-setjmp
Matt Fischer [Thu, 18 Apr 2013 23:32:53 +0000 (18:32 -0500)]
Added --enable-setjmp

Currently, libunwind-setjmp is built whenever local unwinding is
built.  This patch adds an explicit flag to control it instead.
The default if not specified is to follow the old behavior.

9 years agoAdded --enable-ptrace
Matt Fischer [Mon, 15 Apr 2013 14:44:48 +0000 (09:44 -0500)]
Added --enable-ptrace

This change adds a manual override to control building of the ptrace
library, similar to the existing --enable-coredump option.  The
default is set based on the existence of sys/ptrace.h, allowing it
to be automatically disabled for platforms that do not have ptrace.

9 years agoFix the UNW_TDEP_CURSOR_LEN for ppc32 to fix assert failure
Dave Lerner [Sat, 13 Apr 2013 18:46:40 +0000 (11:46 -0700)]
Fix the UNW_TDEP_CURSOR_LEN for ppc32 to fix assert failure

When libunwind is built for a ppc32 target, for example the yocto distro
for qemuppc, and configured with options --enable-debug-frame and
--enable-debug, then the shortfall in the size of the 'opaque' member
of the unw_cursor_t type throws an assert in mi_init().

The calculations for the ppc32 target size of UNW_TDEP_CURSOR_LEN in
the comment block based on the register count plus overhead sum to 280
words. However, that value is not reflected in the ppc32 header, which
defines the size as 200.  Fixing the ppc32 header value to 280 makes the
unw_cursor_t type larger than struct cursor type and the assert tests
true at run-time in mi_init().

Signed-off-by Dave Lerner <dave.lerner@windriver.com>

9 years agodwarf: Fix memory leak
Arun Sharma [Wed, 3 Apr 2013 04:17:18 +0000 (21:17 -0700)]
dwarf: Fix memory leak

Need to clean up by calling put_unwind_info() on code paths where fetch_proc_info() fails.

Signed-off-by: Arun Sharma <asharma@fb.com>
9 years agounw_is_signal_frame should return false/0 for bad addresses
dave lerner [Thu, 7 Mar 2013 18:25:19 +0000 (12:25 -0600)]
unw_is_signal_frame should return false/0 for bad addresses

access_mem() could fail and return a non-zero value, which callers
interpret as boolean true.

Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
9 years agodwarf: Fix the order of the operands to the relational operators
Chris January [Thu, 31 Jan 2013 11:46:57 +0000 (11:46 +0000)]
dwarf: Fix the order of the operands to the relational operators

dwarf_eval_expr are reversed compared with the DWARF spec.

9 years agoSupport building with older compilers.
Ladislav Michl [Tue, 13 Nov 2012 10:19:47 +0000 (11:19 +0100)]
Support building with older compilers.

Add a check for __builtin_unreachable.

9 years agoAdd known test failures to XFAIL_TESTS
Arun Sharma [Sun, 28 Oct 2012 02:37:45 +0000 (19:37 -0700)]
Add known test failures to XFAIL_TESTS

10 years agoresetting manifest requested domain to floor 86/5186/1 accepted/tizen/ivi/genivi accepted/tizen/ivi/stable accepted/tizen_generic tizen_3.0.m14.2_ivi tizen_ivi_genivi accepted/tizen/20130710.215701 accepted/tizen/20130912.101851 accepted/tizen/20130912.102017 accepted/tizen/20130912.151550 accepted/tizen/20130912.191453 accepted/tizen/20130912.195514 accepted/tizen/ivi/genivi/20140131.023518 ivi_oct_m2 submit/tizen/20130710.132811 submit/tizen/20130912.080042 submit/tizen/20130912.090350 submit/tizen_ivi_genivi/20140131.023352 tizen_3.0.m14.2_ivi_release
Alexandru Cornea [Mon, 1 Jul 2013 16:40:15 +0000 (19:40 +0300)]
resetting manifest requested domain to floor

11 years agoSet license using %license accepted/tizen/20130520.100008 submit/tizen/20130511.054711 submit/tizen/20130517.023137
Anas Nashif [Sat, 11 May 2013 05:47:07 +0000 (01:47 -0400)]
Set license using %license

11 years agoadd changes accepted/tizen/20130503.222023 accepted/trunk/20130430.190604 submit/tizen/20130503.224244 submit/tizen/20130509.181345 submit/trunk/20130430.161324
Anas Nashif [Tue, 30 Apr 2013 16:13:09 +0000 (09:13 -0700)]
add changes

11 years agoInitial import submit/trunk/20130430.161210 submit/trunk/20130430.161239
Anas Nashif [Tue, 30 Apr 2013 16:12:08 +0000 (09:12 -0700)]
Initial import

11 years agoImported Upstream version 1.1 submit/trunk/20130430.161055 submit/trunk/20130430.161110 upstream/1.1
Anas Nashif [Tue, 30 Apr 2013 12:18:06 +0000 (05:18 -0700)]
Imported Upstream version 1.1