branch master updated: notes.texi: Specify -lasan with -fsanitize=address in g++

Ileana Dumitrescu <[email protected]>
Newsgroups gmane.comp.gnu.libtool.cvs
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script.

ildumi pushed a commit to branch master
in repository libtool.

The following commit(s) were added to refs/heads/master by this push:
     new 35611996 notes.texi: Specify -lasan with -fsanitize=address in g++
35611996 is described below

commit 3561199667a999c969d18be0d404d0ad2576c2e4
Author: Ileana Dumitrescu <[email protected]>
AuthorDate: Wed Mar 13 19:08:54 2024 +0200

    notes.texi: Specify -lasan with -fsanitize=address in g++
    
    When using the flag -fsanitize=address with g++, the user should also
    specify -lasan to ensure linking occurs correctly. libtool uses
    -nostdlib, and gcc implicitly includes -lasan when -fsanitize=address
    is used. However, g++ does not implicitly include -lasan. The
    documentation has been updated to reflect this information rather than
    adding the -lasan flag to libtool.
    
    * doc/notes.texi: Document that the user should pass -lasan.
---
 doc/notes.texi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/doc/notes.texi b/doc/notes.texi
index 1fa8a0b9..a6cd1b90 100644
--- a/doc/notes.texi
+++ b/doc/notes.texi
@@ -26,6 +26,12 @@ For C++ code with templates, it may be necessary to specify the way the compiler
 will generate the instantiations.  For Portland pgCC version5, use
 @code{CXX='pgCC --one_instantiation_per_object'} and avoid parallel @command{make}.
 
+@item
+For C++ code, it may be neccesary to specify a library if it is a dependency
+of a link/compile flag. For example in GNU G++, if you want to use
+@code{-fsanitize=address} you need to to specify the @code{-lasan} library,
+like so: @code{g++ -o libx.la -fsanitize=address -lasan -rpath [...]}.
+
 @item
 On Darwin, for C++ code with templates you need two level shared libraries.
 Libtool builds these by default if @env{MACOSX_DEPLOYMENT_TARGET} is set to
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.