summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-08-29 14:20:47 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-08-29 14:58:49 -0700
commit9baeed3514fe60189f3bf935c380da92659b7f59 (patch)
treeeb542d01212b4085203456beb62d15e5a2cb0f3d /lib-src
parentf1fdb5bc575728bd6c9f13a18939d9c271a74e83 (diff)
downloademacs-9baeed3514fe60189f3bf935c380da92659b7f59.tar.gz
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.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/make-docfile.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index ecd6447ab78..c48f202a511 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -592,7 +592,7 @@ struct global
};
/* Bit values for FLAGS field from the above. Applied for DEFUNs only. */
-enum { DEFUN_noreturn = 1, DEFUN_const = 2 };
+enum { DEFUN_noreturn = 1, DEFUN_const = 2, DEFUN_noinline = 4 };
/* All the variable names we saw while scanning C sources in `-g'
mode. */
@@ -742,6 +742,8 @@ write_globals (void)
{
if (globals[i].flags & DEFUN_noreturn)
fputs ("_Noreturn ", stdout);
+ if (globals[i].flags & DEFUN_noinline)
+ fputs ("NO_INLINE ", stdout);
printf ("EXFUN (%s, ", globals[i].name);
if (globals[i].v.value == -1)
@@ -1062,7 +1064,8 @@ scan_c_stream (FILE *infile)
attributes: attribute1 attribute2 ...)
(Lisp_Object arg...)
- Now only 'noreturn' and 'const' attributes are used. */
+ Now only ’const’, ’noinline’ and 'noreturn' attributes
+ are used. */
/* Advance to the end of docstring. */
c = getc (infile);
@@ -1108,6 +1111,8 @@ scan_c_stream (FILE *infile)
g->flags |= DEFUN_noreturn;
if (strstr (input_buffer, "const"))
g->flags |= DEFUN_const;
+ if (strstr (input_buffer, "noinline"))
+ g->flags |= DEFUN_noinline;
}
continue;
}