unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* commit 108757 breaks clang build on os x
@ 2012-06-29  7:24 Kai Tetzlaff
  2012-06-29 22:20 ` commit 108757 breaks clang build on so x John Wiegley
  0 siblings, 1 reply; 2+ messages in thread
From: Kai Tetzlaff @ 2012-06-29  7:24 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 684 bytes --]


The following lines in alloc.c

  #ifdef __clang__
    /* Do not allow -faddress-sanitizer to check this function, since it
       crosses the function stack boundary, and thus would yield many
       false positives. */
    __attribute__((no_address_safety_analysis))
  #endif

break the build on os x using

  $ clang --version
  Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
  Target: x86_64-apple-darwin10.8.0
  Thread model: posix

It seems that

  __attribute__((no_address_safety_analysis))

is not supported by all clang versions. The attached patch contains an
improved version of the check which hopefully fixes the problem (it does
so here).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: alloc.c: fix check for clang feature --]
[-- Type: text/x-patch, Size: 465 bytes --]

=== modified file 'src/alloc.c'
--- src/alloc.c	2012-06-28 19:09:41 +0000
+++ src/alloc.c	2012-06-29 06:53:41 +0000
@@ -4608,7 +4608,7 @@
 
 static void
 mark_memory (void *start, void *end)
-#ifdef __clang__
+#if defined (__clang__) && defined (__has_feature) && __has_feature(address_sanitizer)
   /* Do not allow -faddress-sanitizer to check this function, since it
      crosses the function stack boundary, and thus would yield many
      false positives. */


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: commit 108757 breaks clang build on so x
  2012-06-29  7:24 commit 108757 breaks clang build on os x Kai Tetzlaff
@ 2012-06-29 22:20 ` John Wiegley
  0 siblings, 0 replies; 2+ messages in thread
From: John Wiegley @ 2012-06-29 22:20 UTC (permalink / raw)
  To: emacs-devel

>>>>> Kai Tetzlaff <kai.tetzlaff@web.de> writes:

> It seems that

>   __attribute__((no_address_safety_analysis))

> is not supported by all clang versions. The attached patch contains an
> improved version of the check which hopefully fixes the problem (it does so
> here).

Thanks for catching that, Kai.  I forgot that the address sanitizer was only
introduced in 3.1.

FYI- The sanitizer only works up to the temacs build.  The dumped Emacs that
results will not work because static construction/destruction fails in the
ASan libraries.  Until I can build Clang with shared ASan libraries (I've
entered a bug against this in their bugtracker), running a fully sanitized
Emacs is still a pipe dream.

It has already found one legitimate stack overwrite in charset.c.  I'm still
testing the fix.

John



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-29 22:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-29  7:24 commit 108757 breaks clang build on os x Kai Tetzlaff
2012-06-29 22:20 ` commit 108757 breaks clang build on so x John Wiegley

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).