[PATCH] D28359: [compiler-rt] Use common static library for sanitizer_common.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 08:51:00 PST 2017


mpividori created this revision.
mpividori added reviewers: kcc, rnk, zturner.
mpividori added a subscriber: llvm-commits.
mpividori set the repository for this revision to rL LLVM.
Herald added subscribers: mgorny, dberris, kubabrecka.

Many sanitizers's rt libraries include code from `sanitizer_common`. For example: leak sanitizer, ub sanitizer, asan sanitizer, etc.
This can generate link errors when combining many sanitizers that are implemented as static libraries, because the code of `sanitizer_common` is included many times resulting in multiple definitions.
Now, this link error is avoided by including many sanitizers (leak, ub, etc) in asan's rt library.

In this diff I define a common static library including main code from `sanitizer_common`:  "clang-rt.san_common.a", and remove that code from all sanitizer's static libraries, like: "clang-rt_asan.a", clang-rt_lsan.a", etc. Also, I modify clang driver to include "clang-rt.san_common.a" when necessary (in a different diff, because that changes go in clang repository).

I think this is a better approach since it will enable to combine many different sanitizers with no link errors, and without including all of them in the same library.


Repository:
  rL LLVM

https://reviews.llvm.org/D28359

Files:
  lib/CMakeLists.txt
  lib/asan/CMakeLists.txt
  lib/cfi/CMakeLists.txt
  lib/dfsan/CMakeLists.txt
  lib/esan/CMakeLists.txt
  lib/lsan/CMakeLists.txt
  lib/msan/CMakeLists.txt
  lib/sanitizer_common/CMakeLists.txt
  lib/stats/CMakeLists.txt
  lib/tsan/CMakeLists.txt
  lib/ubsan/CMakeLists.txt
  lib/xray/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28359.83245.patch
Type: text/x-patch
Size: 7484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170105/03beb33f/attachment.bin>


More information about the llvm-commits mailing list