From f7f42503adf1bc907ea92c18777580fb7c271255 Mon Sep 17 00:00:00 2001 From: yroux Date: Sun, 10 Aug 2014 15:25:05 +0000 Subject: [PATCH] gcc/testsuite/ 2014-08-10 Yvan Roux Backport from trunk r212023, r212024. 2014-06-26 Vidya Praveen * gcc.dg/inline-22.c: Add bind_pic_locally. * gcc.dg/inline_4.c: Ditto. * gcc.dg/fail_always_inline.c: Ditto. * g++.dg/ipa/devirt-25.C: Ditto. 2014-06-26 Vidya Praveen * lib/target-support.exp (bind_pic_locally): Save the flags to 'flags_to_postpone' instead of appending to 'flags'. * lib/gcc.exp (gcc_target_compile): Append board_info's multilib_flags with flags_to_postpone and revert after target_compile. * lib/g++.exp (g++_target_compile): Ditto. * lib/gfortran.exp (gfortran_target_compile): Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/linaro@213792 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc-4_9-branch/gcc/testsuite/ChangeLog.linaro | 19 +++++++++++++++++ .../gcc/testsuite/g++.dg/ipa/devirt-25.C | 1 + .../gcc/testsuite/gcc.dg/fail_always_inline.c | 1 + gcc-4_9-branch/gcc/testsuite/gcc.dg/inline-22.c | 1 + gcc-4_9-branch/gcc/testsuite/gcc.dg/inline_4.c | 1 + gcc-4_9-branch/gcc/testsuite/lib/g++.exp | 17 +++++++++++++++ gcc-4_9-branch/gcc/testsuite/lib/gcc.exp | 24 ++++++++++++++++++++-- gcc-4_9-branch/gcc/testsuite/lib/gfortran.exp | 21 ++++++++++++++++++- .../gcc/testsuite/lib/target-supports.exp | 18 ++++++++++++---- 9 files changed, 96 insertions(+), 7 deletions(-) diff --git a/gcc-4_9-branch/gcc/testsuite/ChangeLog.linaro b/gcc-4_9-branch/gcc/testsuite/ChangeLog.linaro index 14807670ce7..b3478e9cb58 100644 --- a/gcc-4_9-branch/gcc/testsuite/ChangeLog.linaro +++ b/gcc-4_9-branch/gcc/testsuite/ChangeLog.linaro @@ -1,3 +1,22 @@ +2014-08-10 Yvan Roux + + Backport from trunk r212023, r212024. + 2014-06-26 Vidya Praveen + + * gcc.dg/inline-22.c: Add bind_pic_locally. + * gcc.dg/inline_4.c: Ditto. + * gcc.dg/fail_always_inline.c: Ditto. + * g++.dg/ipa/devirt-25.C: Ditto. + + 2014-06-26 Vidya Praveen + + * lib/target-support.exp (bind_pic_locally): Save the flags to + 'flags_to_postpone' instead of appending to 'flags'. + * lib/gcc.exp (gcc_target_compile): Append board_info's multilib_flags + with flags_to_postpone and revert after target_compile. + * lib/g++.exp (g++_target_compile): Ditto. + * lib/gfortran.exp (gfortran_target_compile): Ditto. + 2014-07-24 Yvan Roux GCC Linaro 4.9-2014.07-1 released. diff --git a/gcc-4_9-branch/gcc/testsuite/g++.dg/ipa/devirt-25.C b/gcc-4_9-branch/gcc/testsuite/g++.dg/ipa/devirt-25.C index 1da44f5d114..5a8a04faf19 100644 --- a/gcc-4_9-branch/gcc/testsuite/g++.dg/ipa/devirt-25.C +++ b/gcc-4_9-branch/gcc/testsuite/g++.dg/ipa/devirt-25.C @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O3 -fdump-ipa-cp" } */ +/* { dg-add-options bind_pic_locally } */ class ert_RefCounter { protected: diff --git a/gcc-4_9-branch/gcc/testsuite/gcc.dg/fail_always_inline.c b/gcc-4_9-branch/gcc/testsuite/gcc.dg/fail_always_inline.c index 4b196acb07f..86645b850de 100644 --- a/gcc-4_9-branch/gcc/testsuite/gcc.dg/fail_always_inline.c +++ b/gcc-4_9-branch/gcc/testsuite/gcc.dg/fail_always_inline.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-add-options bind_pic_locally } */ extern __attribute__ ((always_inline)) void bar() { } /* { dg-warning "function might not be inlinable" } */ diff --git a/gcc-4_9-branch/gcc/testsuite/gcc.dg/inline-22.c b/gcc-4_9-branch/gcc/testsuite/gcc.dg/inline-22.c index 1785e1ce6d5..6795c5f4ab9 100644 --- a/gcc-4_9-branch/gcc/testsuite/gcc.dg/inline-22.c +++ b/gcc-4_9-branch/gcc/testsuite/gcc.dg/inline-22.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-funit-at-a-time -Wno-attributes" } */ +/* { dg-add-options bind_pic_locally } */ /* Verify we can inline without a complete prototype and with promoted arguments. See also PR32492. */ __attribute__((always_inline)) void f1() {} diff --git a/gcc-4_9-branch/gcc/testsuite/gcc.dg/inline_4.c b/gcc-4_9-branch/gcc/testsuite/gcc.dg/inline_4.c index dd4fadb4887..ebd57e980fd 100644 --- a/gcc-4_9-branch/gcc/testsuite/gcc.dg/inline_4.c +++ b/gcc-4_9-branch/gcc/testsuite/gcc.dg/inline_4.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-optimized -fdisable-tree-einline=foo2 -fdisable-ipa-inline -Wno-attributes" } */ +/* { dg-add-options bind_pic_locally } */ int g; __attribute__((always_inline)) void bar (void) { diff --git a/gcc-4_9-branch/gcc/testsuite/lib/g++.exp b/gcc-4_9-branch/gcc/testsuite/lib/g++.exp index 751e27bc99b..6658c58cc2c 100644 --- a/gcc-4_9-branch/gcc/testsuite/lib/g++.exp +++ b/gcc-4_9-branch/gcc/testsuite/lib/g++.exp @@ -288,6 +288,8 @@ proc g++_target_compile { source dest type options } { global gluefile wrap_flags global ALWAYS_CXXFLAGS global GXX_UNDER_TEST + global flags_to_postpone + global board_info if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { lappend options "libs=${gluefile}" @@ -313,10 +315,25 @@ proc g++_target_compile { source dest type options } { exec rm -f $rponame } + # 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 + # restored to its orignal content. + set tboard [target_info name] + if {[board_info $tboard exists multilib_flags]} { + set orig_multilib_flags "[board_info [target_info name] multilib_flags]" + append board_info($tboard,multilib_flags) " $flags_to_postpone" + } + set options [dg-additional-files-options $options $source] set result [target_compile $source $dest $type $options] + if {[board_info $tboard exists multilib_flags]} { + set board_info($tboard,multilib_flags) $orig_multilib_flags + set flags_to_postpone "" + } + return $result } diff --git a/gcc-4_9-branch/gcc/testsuite/lib/gcc.exp b/gcc-4_9-branch/gcc/testsuite/lib/gcc.exp index 49394b08eb5..f9370646ca4 100644 --- a/gcc-4_9-branch/gcc/testsuite/lib/gcc.exp +++ b/gcc-4_9-branch/gcc/testsuite/lib/gcc.exp @@ -126,7 +126,9 @@ proc gcc_target_compile { source dest type options } { global GCC_UNDER_TEST global TOOL_OPTIONS global TEST_ALWAYS_FLAGS - + global flags_to_postpone + global board_info + if {[target_info needs_status_wrapper] != "" && \ [target_info needs_status_wrapper] != "0" && \ [info exists gluefile] } { @@ -162,8 +164,26 @@ proc gcc_target_compile { source dest type options } { set options [concat "{additional_flags=$TOOL_OPTIONS}" $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 + # restored to its orignal content. + set tboard [target_info name] + if {[board_info $tboard exists multilib_flags]} { + set orig_multilib_flags "[board_info [target_info name] multilib_flags]" + append board_info($tboard,multilib_flags) " $flags_to_postpone" + } + lappend options "timeout=[timeout_value]" lappend options "compiler=$GCC_UNDER_TEST" set options [dg-additional-files-options $options $source] - return [target_compile $source $dest $type $options] + set return_val [target_compile $source $dest $type $options] + + if {[board_info $tboard exists multilib_flags]} { + set board_info($tboard,multilib_flags) $orig_multilib_flags + set flags_to_postpone "" + } + + return $return_val } + diff --git a/gcc-4_9-branch/gcc/testsuite/lib/gfortran.exp b/gcc-4_9-branch/gcc/testsuite/lib/gfortran.exp index c9b5d648b87..9d174bbabb7 100644 --- a/gcc-4_9-branch/gcc/testsuite/lib/gfortran.exp +++ b/gcc-4_9-branch/gcc/testsuite/lib/gfortran.exp @@ -234,16 +234,35 @@ proc gfortran_target_compile { source dest type options } { global gluefile wrap_flags global ALWAYS_GFORTRANFLAGS global GFORTRAN_UNDER_TEST + global flags_to_postpone + global board_info if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { lappend options "libs=${gluefile}" lappend options "ldflags=${wrap_flags}" } + # 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 + # restored to its orignal content. + set tboard [target_info name] + if {[board_info $tboard exists multilib_flags]} { + set orig_multilib_flags "[board_info [target_info name] multilib_flags]" + append board_info($tboard,multilib_flags) " $flags_to_postpone" + } + lappend options "compiler=$GFORTRAN_UNDER_TEST" lappend options "timeout=[timeout_value]" set options [concat "$ALWAYS_GFORTRANFLAGS" $options] set options [dg-additional-files-options $options $source] - return [target_compile $source $dest $type $options] + set return_val [target_compile $source $dest $type $options] + + if {[board_info $tboard exists multilib_flags]} { + set board_info($tboard,multilib_flags) $orig_multilib_flags + set flags_to_postpone "" + } + + return $return_val } diff --git a/gcc-4_9-branch/gcc/testsuite/lib/target-supports.exp b/gcc-4_9-branch/gcc/testsuite/lib/target-supports.exp index 922d42b8175..45b96eaf524 100644 --- a/gcc-4_9-branch/gcc/testsuite/lib/target-supports.exp +++ b/gcc-4_9-branch/gcc/testsuite/lib/target-supports.exp @@ -5208,25 +5208,35 @@ proc add_options_for_ieee { flags } { return $flags } +if {![info exists flags_to_postpone]} { + set flags_to_postpone "" +} + # Add to FLAGS the flags needed to enable functions to bind locally # when using pic/PIC passes in the testsuite. - proc add_options_for_bind_pic_locally { flags } { + global flags_to_postpone + + # Instead of returning 'flags' with the -fPIE or -fpie appended, we save it + # in 'flags_to_postpone' and append it later in gcc_target_compile procedure in + # order to make sure that the multilib_flags doesn't override this. + if {[check_no_compiler_messages using_pic2 assembly { #if __PIC__ != 2 #error FOO #endif }]} { - return "$flags -fPIE" + set flags_to_postpone "-fPIE" + return $flags } if {[check_no_compiler_messages using_pic1 assembly { #if __PIC__ != 1 #error FOO #endif }]} { - return "$flags -fpie" + set flags_to_postpone "-fpie" + return $flags } - return $flags } -- 2.11.4.GIT