This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: libsanitizer merge from upstream r191666
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Konstantin Serebryany <konstantin dot s dot serebryany at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Dodji Seketeli <dodji at redhat dot com>, Dmitry Vyukov <dvyukov at google dot com>
- Date: Wed, 30 Oct 2013 08:03:17 +0100
- Subject: Re: libsanitizer merge from upstream r191666
- Authentication-results: sourceware.org; auth=none
- References: <CAGQ9bdzrx07_OfvCcxm_uFUt3MRhg1gwqdHvmK_9kHDmz1vPVw at mail dot gmail dot com> <CAGQ9bdxj-DmEaoo0mOWfSVXsrhVShWj3onHZRxiwt97Vq6J45w at mail dot gmail dot com> <20131029121355 dot GY30970 at tucnak dot zalov dot cz> <CAGQ9bdw+VW=yF+vaqE_0GkyHUChL_vp3cABZf-FuNYoHo3g=eg at mail dot gmail dot com> <CAGQ9bdzHaBmaTnnX3=npLngK+8K1P2EWWMX-GmOLz0S1vWcHVA at mail dot gmail dot com> <CAGQ9bdxBgJJxv2gWzAsxuECoAV_zk4TWUVGeZiAnNF1gcEQJ7g at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Oct 29, 2013 at 05:15:24PM -0700, Konstantin Serebryany wrote:
> Actually, I guessed the flags:
You don't have to guess them, if you look into
testsuite/g++/g++.log (or testsuite/gcc/gcc.log etc.), you can find them
there.
> % ../gcc-inst/bin/g++ -g -fsanitize=address -static-libasan -O2 -flto
> -fno-use-linker-plugin -flto-partition=none
> ../gcc/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c; ./a.out
> 2>&1
>
> /tmp/ccgSw6NI.lto.o: In function `main':
> ../gcc/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c:13:
> undefined reference to `.LASANPC0.2585'
> collect2: error: ld returned 1 exit status
>
> Looks like this patch is not friendly to -flto
I guess if you do:
...
- tree str_cst;
+ tree str_cst, decl, id;
...
+ ASM_GENERATE_INTERNAL_LABEL (buf, "LASANPC", current_function_funcdef_no);
+ id = get_identifier (buf);
+ decl = build_decl (DECL_SOURCE_LOCATION (current_function_decl),
+ VAR_DECL, id, char_type_node);
+ SET_DECL_ASSEMBLER_NAME (decl, id);
+ TREE_ADDRESSABLE (decl) = 1;
...
it might work even for -flto. The problem with -flto is that the default
set_decl_assembler_name langhook for -flto appends dot and some number to
the non-exported names, which is undesirable here, because we already make
sure those first numbers are unique for the whole compilation unit.
Jakub