Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sanitizer][Docs] Improve docs on building Asan #68636

Merged
merged 1 commit into from
Oct 9, 2023

Conversation

boomanaiden154
Copy link
Contributor

Currently the documentation for building Asan doesn't specify that compiler-rt needs to be built as well. In addition, there's no minimal example for the LLVM CMake configuration. This patch addresses both of these issues.

The lack of specification about building compiler-rt has shown up on Discourse (e.g., https://discourse.llvm.org/t/enabling-address-sanitizer/73940/2).

Currently the documentation for building Asan doesn't specify that
compiler-rt needs to be built as well. In addition, there's no minimal
example for the LLVM CMake configuration. This patch addresses both of
these issues.
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Oct 9, 2023
@llvmbot
Copy link
Member

llvmbot commented Oct 9, 2023

@llvm/pr-subscribers-clang

Changes

Currently the documentation for building Asan doesn't specify that compiler-rt needs to be built as well. In addition, there's no minimal example for the LLVM CMake configuration. This patch addresses both of these issues.

The lack of specification about building compiler-rt has shown up on Discourse (e.g., https://discourse.llvm.org/t/enabling-address-sanitizer/73940/2).


Full diff: https://github.com/llvm/llvm-project/pull/68636.diff

1 Files Affected:

  • (modified) clang/docs/AddressSanitizer.rst (+10-1)
diff --git a/clang/docs/AddressSanitizer.rst b/clang/docs/AddressSanitizer.rst
index 37f34cb0cc9936d..94ff3404cba6024 100644
--- a/clang/docs/AddressSanitizer.rst
+++ b/clang/docs/AddressSanitizer.rst
@@ -26,7 +26,16 @@ Typical slowdown introduced by AddressSanitizer is **2x**.
 How to build
 ============
 
-Build LLVM/Clang with `CMake <https://llvm.org/docs/CMake.html>`_.
+Build LLVM/Clang with `CMake <https://llvm.org/docs/CMake.html>` and enable
+the ``compiler-rt`` runtime. An example CMake configuration that will allow
+for the use/testing of AddressSanitizer:
+
+.. code-block:: console
+
+   cmake -DCMAKE_BUILD_TYPE=Release \
+     -DLLVM_ENABLE_PROJECTS="clang" \
+     -DLLVM_ENABLE_RUNTIMES="compiler-rt" \
+     ../llvm
 
 Usage
 =====

@boomanaiden154 boomanaiden154 merged commit 115b6a3 into llvm:main Oct 9, 2023
@vitalybuka
Copy link
Collaborator

I am to late with comment, can you make it in the same style as https://llvm.org/docs/CMake.html

One line, and with $:

.. code-block:: console

  $  cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang"  -DLLVM_ENABLE_RUNTIMES="compiler-rt" path/to/llvm/source

@boomanaiden154
Copy link
Contributor Author

Sorry. I'll wait longer to merge next time. I'll push a fixup to address the comment. Thanks for the comment/review!

@vitalybuka
Copy link
Collaborator

Sorry. I'll wait longer to merge next time. I'll push a fixup to address the comment. Thanks for the comment/review!

No need to be sorry, it's my fault.
Thanks for improving documentation.

boomanaiden154 added a commit that referenced this pull request Oct 9, 2023
This was based on post-commit reviewer feedback in #68636.
@boomanaiden154
Copy link
Contributor Author

Updated in 6828194.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants