[Bug target/71951] libgcc_s built with -fomit-frame-pointer on aarch64 is broken

wilco at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Sep 21 12:21:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71951

--- Comment #16 from Wilco <wilco at gcc dot gnu.org> ---
Author: wilco
Date: Thu Sep 21 12:21:18 2017
New Revision: 253064

URL: https://gcc.gnu.org/viewcvs?rev=253064&root=gcc&view=rev
Log:
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.

Modified:
    branches/gcc-6-branch/gcc/ChangeLog
    branches/gcc-6-branch/gcc/config/aarch64/aarch64.h


More information about the Gcc-bugs mailing list