diff options
| author | Andrea Corallo | 2020-08-09 15:03:23 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-08-09 15:03:23 +0200 |
| commit | 12a982d9789052d8e85efcacb4b311f4876c882a (patch) | |
| tree | a452a8e888c6ee9c85d6a487359b7a1c0c9fa15b /src/lisp.h | |
| parent | 80d7f710f2fab902e46aa3fddb8e1c1795420af3 (diff) | |
| parent | 8e82baf5a730ff542118ddba5b76afdc1db643f6 (diff) | |
| download | emacs-12a982d9789052d8e85efcacb4b311f4876c882a.tar.gz emacs-12a982d9789052d8e85efcacb4b311f4876c882a.zip | |
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/src/lisp.h b/src/lisp.h index 5ef31eff31e..75ef6d30f97 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -894,8 +894,8 @@ verify (GCALIGNED (struct Lisp_Symbol)); | |||
| 894 | convert it to a Lisp_Word. */ | 894 | convert it to a Lisp_Word. */ |
| 895 | #if LISP_WORDS_ARE_POINTERS | 895 | #if LISP_WORDS_ARE_POINTERS |
| 896 | /* untagged_ptr is a pointer so that the compiler knows that TAG_PTR | 896 | /* untagged_ptr is a pointer so that the compiler knows that TAG_PTR |
| 897 | yields a pointer; this can help with gcc -fcheck-pointer-bounds. | 897 | yields a pointer. It is char * so that adding a tag uses simple |
| 898 | It is char * so that adding a tag uses simple machine addition. */ | 898 | machine addition. */ |
| 899 | typedef char *untagged_ptr; | 899 | typedef char *untagged_ptr; |
| 900 | typedef uintptr_t Lisp_Word_tag; | 900 | typedef uintptr_t Lisp_Word_tag; |
| 901 | #else | 901 | #else |
| @@ -923,13 +923,9 @@ typedef EMACS_UINT Lisp_Word_tag; | |||
| 923 | when using a debugger like GDB, on older platforms where the debug | 923 | when using a debugger like GDB, on older platforms where the debug |
| 924 | format does not represent C macros. However, they are unbounded | 924 | format does not represent C macros. However, they are unbounded |
| 925 | and would just be asking for trouble if checking pointer bounds. */ | 925 | and would just be asking for trouble if checking pointer bounds. */ |
| 926 | #ifdef __CHKP__ | 926 | #define DEFINE_LISP_SYMBOL(name) \ |
| 927 | # define DEFINE_LISP_SYMBOL(name) | 927 | DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name) \ |
| 928 | #else | 928 | DEFINE_GDB_SYMBOL_END (LISPSYM_INITIALLY (name)) |
| 929 | # define DEFINE_LISP_SYMBOL(name) \ | ||
| 930 | DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name) \ | ||
| 931 | DEFINE_GDB_SYMBOL_END (LISPSYM_INITIALLY (name)) | ||
| 932 | #endif | ||
| 933 | 929 | ||
| 934 | /* The index of the C-defined Lisp symbol SYM. | 930 | /* The index of the C-defined Lisp symbol SYM. |
| 935 | This can be used in a static initializer. */ | 931 | This can be used in a static initializer. */ |
| @@ -1003,30 +999,15 @@ XSYMBOL (Lisp_Object a) | |||
| 1003 | eassert (SYMBOLP (a)); | 999 | eassert (SYMBOLP (a)); |
| 1004 | intptr_t i = (intptr_t) XUNTAG (a, Lisp_Symbol, struct Lisp_Symbol); | 1000 | intptr_t i = (intptr_t) XUNTAG (a, Lisp_Symbol, struct Lisp_Symbol); |
| 1005 | void *p = (char *) lispsym + i; | 1001 | void *p = (char *) lispsym + i; |
| 1006 | #ifdef __CHKP__ | ||
| 1007 | /* Bypass pointer checking. Although this could be improved it is | ||
| 1008 | probably not worth the trouble. */ | ||
| 1009 | p = __builtin___bnd_set_ptr_bounds (p, sizeof (struct Lisp_Symbol)); | ||
| 1010 | #endif | ||
| 1011 | return p; | 1002 | return p; |
| 1012 | } | 1003 | } |
| 1013 | 1004 | ||
| 1014 | INLINE Lisp_Object | 1005 | INLINE Lisp_Object |
| 1015 | make_lisp_symbol (struct Lisp_Symbol *sym) | 1006 | make_lisp_symbol (struct Lisp_Symbol *sym) |
| 1016 | { | 1007 | { |
| 1017 | #ifdef __CHKP__ | 1008 | /* GCC 7 x86-64 generates faster code if lispsym is |
| 1018 | /* Although '__builtin___bnd_narrow_ptr_bounds (sym, sym, sizeof *sym)' | ||
| 1019 | should be more efficient, it runs afoul of GCC bug 83251 | ||
| 1020 | <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83251>. | ||
| 1021 | Also, attempting to call __builtin___bnd_chk_ptr_bounds (sym, sizeof *sym) | ||
| 1022 | here seems to trigger a GCC bug, as yet undiagnosed. */ | ||
| 1023 | char *addr = __builtin___bnd_set_ptr_bounds (sym, sizeof *sym); | ||
| 1024 | char *symoffset = addr - (intptr_t) lispsym; | ||
| 1025 | #else | ||
| 1026 | /* If !__CHKP__, GCC 7 x86-64 generates faster code if lispsym is | ||
| 1027 | cast to char * rather than to intptr_t. */ | 1009 | cast to char * rather than to intptr_t. */ |
| 1028 | char *symoffset = (char *) ((char *) sym - (char *) lispsym); | 1010 | char *symoffset = (char *) ((char *) sym - (char *) lispsym); |
| 1029 | #endif | ||
| 1030 | Lisp_Object a = TAG_PTR (Lisp_Symbol, symoffset); | 1011 | Lisp_Object a = TAG_PTR (Lisp_Symbol, symoffset); |
| 1031 | eassert (XSYMBOL (a) == sym); | 1012 | eassert (XSYMBOL (a) == sym); |
| 1032 | return a; | 1013 | return a; |
| @@ -4837,6 +4818,17 @@ lispstpcpy (char *dest, Lisp_Object string) | |||
| 4837 | return dest + len; | 4818 | return dest + len; |
| 4838 | } | 4819 | } |
| 4839 | 4820 | ||
| 4821 | #if (defined HAVE___LSAN_IGNORE_OBJECT \ | ||
| 4822 | && defined HAVE_SANITIZER_LSAN_INTERFACE_H) | ||
| 4823 | # include <sanitizer/lsan_interface.h> | ||
| 4824 | #else | ||
| 4825 | /* Treat *P as a non-leak. */ | ||
| 4826 | INLINE void | ||
| 4827 | __lsan_ignore_object (void const *p) | ||
| 4828 | { | ||
| 4829 | } | ||
| 4830 | #endif | ||
| 4831 | |||
| 4840 | extern void xputenv (const char *); | 4832 | extern void xputenv (const char *); |
| 4841 | 4833 | ||
| 4842 | extern char *egetenv_internal (const char *, ptrdiff_t); | 4834 | extern char *egetenv_internal (const char *, ptrdiff_t); |