• Paul Eggert's avatar
    Improve stack-top heuristic · 9baeed35
    Paul Eggert authored
    This is needed for gcc -Os -flto on x86-64; otherwise, GC misses part
    of the stack when scanning for heap roots, causing Emacs to crash
    later (Bug#28213).  The problem is that Emacs's hack for getting an
    address near the stack top does not work when link-time optimization
    moves stack variables around.
    * configure.ac (HAVE___BUILTIN_FRAME_ADDRESS): New macro.
    * lib-src/make-docfile.c (DEFUN_noinline): New constant.
    (write_globals, scan_c_stream): Support noinline.
    * src/alloc.c (NEAR_STACK_TOP): New macro.
    (SET_STACK_TOP_ADDRESS): Use it.
    (flush_stack_call_func, Fgarbage_collect): Now noinline.
    9baeed35
alloc.c 204 KB