[PATCH] D60044: [Sanitizers] Fix sanitizer_linux_libcdep.cc compilation on Solaris

Rainer Orth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 31 02:53:23 PDT 2019


ro created this revision.
ro added a reviewer: kcc.
ro added a project: Sanitizers.
Herald added subscribers: Sanitizers, jdoerfert, fedor.sergeev, kubamracek.
Herald added a project: LLVM.

Both LLVM 8.0.0 and current trunk fail to compile on Solaris 11/x86 with GCC 8.1.0:

  /vol/llvm/src/llvm/dist/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc: In function ‘void __sanitizer::ReExec()’:
  /vol/llvm/src/llvm/dist/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:831:14: error: ‘getexecname’ was not declared in this scope
     pathname = getexecname();
                ^~~~~~~~~~~
  /vol/llvm/src/llvm/dist/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:831:14: note: suggested alternative: ‘gethostname’
     pathname = getexecname();
                ^~~~~~~~~~~
                gethostname

This is easily fixed by including ```<stdlib.h>``` which declares that function.  With that
patch, compilation continues.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D60044

Files:
  lib/sanitizer_common/sanitizer_linux_libcdep.cc


Index: lib/sanitizer_common/sanitizer_linux_libcdep.cc
===================================================================
--- lib/sanitizer_common/sanitizer_linux_libcdep.cc
+++ lib/sanitizer_common/sanitizer_linux_libcdep.cc
@@ -52,6 +52,7 @@
 #endif
 
 #if SANITIZER_SOLARIS
+#include <stdlib.h>
 #include <thread.h>
 #endif
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60044.193004.patch
Type: text/x-patch
Size: 330 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190331/87450e8f/attachment.bin>


More information about the llvm-commits mailing list