[PATCH] D40903: [Sanitizers] Basic Solaris sanitizer support (PR 33274)

Rainer Orth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 6 08:28:19 PST 2017


ro created this revision.
ro added a project: Sanitizers.
Herald added subscribers: fedor.sergeev, jyknight.

This patch (on top of https://reviews.llvm.org/D35755) provides the clang side necessary
to enable the Solaris port of the sanitizers implemented by https://reviews.llvm.org/D40898,
https://reviews.llvm.org/D40899, and https://reviews.llvm.org/D40900).

A few features of note:

- While compiler-rt cmake/base-config-ix.cmake (COMPILER_RT_OS_DIR) places the runtime libs in a tolower(CMAKE_SYSTEM_NAME) directory, clang defaults to the OS part of the target triplet (solaris2.11 in the case at hand).  The patch makes them agree on compiler-rt's idea.

- While Solaris ld accepts a considerable number of GNU ld options for compatibility, it only does so for the double-dash forms.  clang unfortunately is inconsistent here and sometimes uses the double-dash form, sometimes the single-dash one that confuses the hell out of Solaris ld.  I've changed the affected places to use the double-dash form that should always work.

- As described in https://reviews.llvm.org/D40899, Solaris ld doesn't create the __start___sancov_guards/__stop___sancov_guards labels gld/gold/lld do, so I'm including additional runtime libs into the link that provide them.

- One test uses -fstack-protector, but unlike other systems libssp hasn't been folded into Solaris libc, but needs to be linked with separately.

- For now, only 32-bit x86 asan is enabled on Solaris.  64-bit x86 should follow, but sparc (which requires additional compiler-rt changes not yet submitted) fails miserably due to a llvmsparc backend limitation:

fatal error: error in backend: Function "_ZN7testing8internal16BoolFromGTestEnvEPKcb": over-aligned dynamic alloca not supported.

  However, inside the gcc tree, Solaris/sparc asan works almost as well as x86.


Repository:
  rC Clang

https://reviews.llvm.org/D40903

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains/CommonArgs.cpp
  lib/Driver/ToolChains/Solaris.cpp
  lib/Driver/ToolChains/Solaris.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40903.125734.patch
Type: text/x-patch
Size: 6676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171206/786077b6/attachment.bin>


More information about the cfe-commits mailing list