[PATCH] Put -lasan always very early on the ld command line (PR sanitizer/55374)
Dodji Seketeli
dodji@redhat.com
Wed Jan 30 15:12:00 GMT 2013
Jakub Jelinek <jakub@redhat.com> writes:
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2013-01-22 Jakub Jelinek <jakub@redhat.com>
>
> PR sanitizer/55374
> * gcc.c (LIBASAN_SPEC): Define just to ADD_STATIC_LIBASAN_LIBS if
> LIBASAN_EARLY_SPEC is defined.
> (LIBASAN_EARLY_SPEC): Define to empty string if not already defined.
> (LINK_COMMAND_SPEC): Add LIBASAN_EARLY_SPEC for -fsanitize=address,
> before %o.
> * config/gnu-user.h (LIBASAN_EARLY_SPEC): Define.
>
> * g++.dg/asan/large-func-test-1.C: Allow both _Zna[jm] in addition
> to _Znw[jm] in the backtrace. Allow _Zna[jm] to be the first frame
> printed in backtrace.
> * g++.dg/asan/deep-stack-uaf-1.C: Use malloc instead of operator new
> to avoid errors about mismatched allocation vs. deallocation.
This looks okay for me. Sorry for the delay.
As an aside, I am curious why about ...
> --- gcc/testsuite/g++.dg/asan/deep-stack-uaf-1.C.jj 2012-12-14 16:24:38.000000000 +0100
> +++ gcc/testsuite/g++.dg/asan/deep-stack-uaf-1.C 2013-01-22 16:43:03.337091101 +0100
> @@ -27,7 +27,7 @@ struct DeepFree<0> {
> };
>
> int main() {
> - char *x = new char[10];
> + char *x = (char*)malloc(10);
> // deep_free(x);
> DeepFree<200>::free(x);
> return x[5];
... why/how this is falling when -lasan comes before -lstdc++?
--
Dodji
More information about the Gcc-patches
mailing list