[compiler-rt] r357751 - [Sanitizers] Fix sanitizer_linux_libcdep.cc compilation on Solaris

Rainer Orth via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 01:40:08 PDT 2019


Author: ro
Date: Fri Apr  5 01:40:08 2019
New Revision: 357751

URL: http://llvm.org/viewvc/llvm-project?rev=357751&view=rev
Log:
[Sanitizers] Fix sanitizer_linux_libcdep.cc compilation on Solaris

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.

Differential Revision: https://reviews.llvm.org/D60044

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc?rev=357751&r1=357750&r2=357751&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc Fri Apr  5 01:40:08 2019
@@ -52,6 +52,7 @@
 #endif
 
 #if SANITIZER_SOLARIS
+#include <stdlib.h>
 #include <thread.h>
 #endif
 




More information about the llvm-commits mailing list