PR71951: Fix unwinding with -fomit-frame-pointer
commite8a6e502553406212d441fa5ad69f942746c1776
authorwilco <wilco@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Sep 2017 12:08:12 +0000 (21 12:08 +0000)
committerwilco <wilco@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Sep 2017 12:08:12 +0000 (21 12:08 +0000)
treedd49b44efa5124c2054da2431dcc0ab086c6079d
parentb9076d9827b3889b7067e77ed72072192a1b4f9b
PR71951: Fix unwinding with -fomit-frame-pointer

As described in PR71951, if libgcc is built with -fomit-frame-pointer,
unwinding crashes, for example while doing a backtrace.  The underlying
reason is the Dwarf unwinder does not setup the frame pointer register
in the initialization code.  When later unwinding a function that uses
the frame pointer, it tries to read FP using _Unwind_GetGR, and this
crashes if has never restored FP.  To unwind correctly the first frame
must save and restore FP (it is unwound in a special way so that it
uses SP instead of FP).  This is done by adding -fno-omit-frame-pointer.

    gcc/
PR target/71951
* config/aarch64/aarch64.h (LIBGCC2_UNWIND_ATTRIBUTE): Define.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253061 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/aarch64/aarch64.h