Improve stack-top heuristic
commit9baeed3514fe60189f3bf935c380da92659b7f59
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 29 Aug 2017 21:20:47 +0000 (29 14:20 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 29 Aug 2017 21:58:49 +0000 (29 14:58 -0700)
treeeb542d01212b4085203456beb62d15e5a2cb0f3d
parentf1fdb5bc575728bd6c9f13a18939d9c271a74e83
Improve stack-top heuristic

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.
configure.ac
lib-src/make-docfile.c
src/alloc.c