From 6abe1c3084798d3e5f32926c352643e557073e01 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 2 May 2020 12:46:44 -0700 Subject: [PATCH] gfortran: Get asan library from TEST_ALWAYS_FLAGS Update gfortran_target_compile to get the newly built asan library from TEST_ALWAYS_FLAGS to avoid: /usr/bin/ld: cannot find libasan_preinit.o: No such file or directory /usr/bin/ld: cannot find -lasan collect2: error: ld returned 1 exit status compiler exited with status 1 FAIL: gfortran.dg/asan/pointer_assign_16.f90 -fsanitize=address -O0 (test for excess errors) PR fortran/94788 * lib/gfortran.exp (gfortran_target_compile): Get asan library from TEST_ALWAYS_FLAGS. --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/lib/gfortran.exp | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a9c72f982fe..b0c6f9a8cef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-05-02 H.J. Lu + + PR fortran/94788 + * lib/gfortran.exp (gfortran_target_compile): Get asan library + from TEST_ALWAYS_FLAGS. + 2020-05-02 Thomas Koenig PR fortran/94788 diff --git a/gcc/testsuite/lib/gfortran.exp b/gcc/testsuite/lib/gfortran.exp index 016d77ca4f8..fe99111788f 100644 --- a/gcc/testsuite/lib/gfortran.exp +++ b/gcc/testsuite/lib/gfortran.exp @@ -234,6 +234,7 @@ proc gfortran_target_compile { source dest type options } { global gluefile wrap_flags global ALWAYS_GFORTRANFLAGS global GFORTRAN_UNDER_TEST + global TEST_ALWAYS_FLAGS global flags_to_postpone global board_info @@ -242,6 +243,13 @@ proc gfortran_target_compile { source dest type options } { lappend options "ldflags=${wrap_flags}" } + # TEST_ALWAYS_FLAGS are flags that should be passed to every + # compilation. They are passed first to allow individual + # tests to override them. + if [info exists TEST_ALWAYS_FLAGS] { + set options [concat "{additional_flags=$TEST_ALWAYS_FLAGS}" $options] + } + # bind_pic_locally adds -fpie/-fPIE flags to flags_to_postpone and it is # appended here to multilib_flags as it can be overridden by the latter # if it was added earlier. After the target_compile, multilib_flags is -- 2.30.2