gcc-defs.exp (additional_sources): New variable.

* lib/gcc-defs.exp (additional_sources): New variable.
	(dg-additional-sources): New function.
	(additional_files): New variable.
	(dg-additional-files): New function.
	(dg-additional-files-options): Likewise.
	* lib/gcc-dg.exp (dg-require-weak): New function.
	(dg-require-alias): Likewise.
	(dg-require-gc-sections): Likewise.
	* lib/target-supports.exp (check_alias_available): Remove testfile
	parameter.
	(check_gc_sections_available): New function.
	* lib/g++-dg.exp (dg-gpp-additional-sources): Remove.
	(dg-gpp-additional-files): Likewise.
	* lib/g++.exp (additional_sources): Remove.
	(additional_files): Likewise.
	(g++_target_compile): Use dg-additional-files-options.

	* gcc.dg/special/special.exp: Add "ecos" tests.  Remove complex
	Tcl logic.
	* gcc.dg/special/ecos.exp: Remove.
	* gcc.dg/special/20000419-2.c: Use dg-require-*.
	* gcc.dg/special/alias-1.c: Likewise.
	* gcc.dg/special/alias-2.c: Likewise.
	* gcc.dg/special/gcsec-1.c: Likewise.
	* gcc.dg/special/weak-1.c: Likewise.
	* gcc.dg/special/weak-2.c: Likewise.
	* gcc.dg/special/wkali-1.c: Likewise.
	* gcc.dg/special/wkali-2.c: Likewise.

	* g++.dg/special/conpr-2.C: Use dg-additional-*, not
	dg-gpp-additional-*.
	* g++.dg/special/conpr-3.C: Likewise.
	* g++.dg/special/conpr-4.C: Likewise.
	* g++.old-deja/g++.abi/vtable3a.C: Likewise.
	* g++.old-deja/g++.abi/vtable3b.C: Likewise.
	* g++.old-deja/g++.abi/vtable3c.C: Likewise.
	* g++.old-deja/g++.abi/vtable3d.C: Likewise.
	* g++.old-deja/g++.abi/vtable3e.C: Likewise.
	* g++.old-deja/g++.abi/vtable3f.C: Likewise.
	* g++.old-deja/g++.abi/vtable3g.C: Likewise.
	* g++.old-deja/g++.abi/vtable3h.C: Likewise.
	* g++.old-deja/g++.abi/vtable3i.C: Likewise.
	* g++.old-deja/g++.abi/vtable3j.C: Likewise.
	* g++.old-deja/g++.oliva/linkage1.C: Likewise.
	* g++.old-deja/g++.other/comdat1.C: Likewise.
	* g++.old-deja/g++.other/comdat2.C: Likewise.
	* g++.old-deja/g++.other/comdat3.C: Likewise.
	* g++.old-deja/g++.other/ctor1.C: Likewise.
	* g++.old-deja/g++.pt/instantiate5.C: Likewise.

From-SVN: r67514
This commit is contained in:
Mark Mitchell 2003-06-05 22:18:55 +00:00 committed by Mark Mitchell
parent 7786a3e47a
commit b4e0fcc38e
36 changed files with 229 additions and 271 deletions

View File

@ -1,3 +1,55 @@
2003-06-05 Mark Mitchell <mark@codesourcery.com>
* lib/gcc-defs.exp (additional_sources): New variable.
(dg-additional-sources): New function.
(additional_files): New variable.
(dg-additional-files): New function.
(dg-additional-files-options): Likewise.
* lib/gcc-dg.exp (dg-require-weak): New function.
(dg-require-alias): Likewise.
(dg-require-gc-sections): Likewise.
* lib/target-supports.exp (check_alias_available): Remove testfile
parameter.
(check_gc_sections_available): New function.
* lib/g++-dg.exp (dg-gpp-additional-sources): Remove.
(dg-gpp-additional-files): Likewise.
* lib/g++.exp (additional_sources): Remove.
(additional_files): Likewise.
(g++_target_compile): Use dg-additional-files-options.
* gcc.dg/special/special.exp: Add "ecos" tests. Remove complex
Tcl logic.
* gcc.dg/special/ecos.exp: Remove.
* gcc.dg/special/20000419-2.c: Use dg-require-*.
* gcc.dg/special/alias-1.c: Likewise.
* gcc.dg/special/alias-2.c: Likewise.
* gcc.dg/special/gcsec-1.c: Likewise.
* gcc.dg/special/weak-1.c: Likewise.
* gcc.dg/special/weak-2.c: Likewise.
* gcc.dg/special/wkali-1.c: Likewise.
* gcc.dg/special/wkali-2.c: Likewise.
* g++.dg/special/conpr-2.C: Use dg-additional-*, not
dg-gpp-additional-*.
* g++.dg/special/conpr-3.C: Likewise.
* g++.dg/special/conpr-4.C: Likewise.
* g++.old-deja/g++.abi/vtable3a.C: Likewise.
* g++.old-deja/g++.abi/vtable3b.C: Likewise.
* g++.old-deja/g++.abi/vtable3c.C: Likewise.
* g++.old-deja/g++.abi/vtable3d.C: Likewise.
* g++.old-deja/g++.abi/vtable3e.C: Likewise.
* g++.old-deja/g++.abi/vtable3f.C: Likewise.
* g++.old-deja/g++.abi/vtable3g.C: Likewise.
* g++.old-deja/g++.abi/vtable3h.C: Likewise.
* g++.old-deja/g++.abi/vtable3i.C: Likewise.
* g++.old-deja/g++.abi/vtable3j.C: Likewise.
* g++.old-deja/g++.oliva/linkage1.C: Likewise.
* g++.old-deja/g++.other/comdat1.C: Likewise.
* g++.old-deja/g++.other/comdat2.C: Likewise.
* g++.old-deja/g++.other/comdat3.C: Likewise.
* g++.old-deja/g++.other/ctor1.C: Likewise.
* g++.old-deja/g++.pt/instantiate5.C: Likewise.
2003-06-05 Richard Henderson <rth@redhat.com>
* gcc.dg/debug/20030605-1.c: New.

View File

@ -1,6 +1,6 @@
/* This doesn't work on solaris2 for reasons described in PR 6482. */
/* { dg-do run { xfail *-*-solaris2* } } */
/* { dg-gpp-additional-sources "conpr-2a.cc" } */
/* { dg-additional-sources "conpr-2a.cc" } */
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/* { dg-do run } */
/* { dg-gpp-additional-sources "conpr-3a.cc conpr-3b.cc" } */
/* { dg-additional-sources "conpr-3a.cc conpr-3b.cc" } */
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/* { dg-do run } */
/* { dg-gpp-additional-sources "conpr-3b.cc conpr-3a.cc" } */
/* { dg-additional-sources "conpr-3b.cc conpr-3a.cc" } */
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
// { dg-do run }
// { dg-gpp-additional-files "vtable3.h" }
// { dg-additional-files "vtable3.h" }
// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>

View File

@ -1,5 +1,5 @@
// { dg-do run }
// { dg-gpp-additional-files "vtable3.h" }
// { dg-additional-files "vtable3.h" }
// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>

View File

@ -1,5 +1,5 @@
// { dg-do run }
// { dg-gpp-additional-files "vtable3.h" }
// { dg-additional-files "vtable3.h" }
// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>

View File

@ -1,5 +1,5 @@
// { dg-do run }
// { dg-gpp-additional-files "vtable3.h" }
// { dg-additional-files "vtable3.h" }
// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>

View File

@ -1,5 +1,5 @@
// { dg-do run }
// { dg-gpp-additional-files "vtable3.h" }
// { dg-additional-files "vtable3.h" }
// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>

View File

@ -1,5 +1,5 @@
// { dg-do run }
// { dg-gpp-additional-files "vtable3.h" }
// { dg-additional-files "vtable3.h" }
// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>

View File

@ -1,5 +1,5 @@
// { dg-do run }
// { dg-gpp-additional-files "vtable3.h" }
// { dg-additional-files "vtable3.h" }
// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>

View File

@ -1,5 +1,5 @@
// { dg-do run }
// { dg-gpp-additional-files "vtable3.h" }
// { dg-additional-files "vtable3.h" }
// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>

View File

@ -1,5 +1,5 @@
// { dg-do run }
// { dg-gpp-additional-files "vtable3.h" }
// { dg-additional-files "vtable3.h" }
// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>

View File

@ -1,5 +1,5 @@
// { dg-do run }
// { dg-gpp-additional-files "vtable3.h" }
// { dg-additional-files "vtable3.h" }
// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>

View File

@ -1,5 +1,5 @@
// { dg-do link }
// { dg-gpp-additional-sources " linkage1-main.cc" }
// { dg-additional-sources " linkage1-main.cc" }
// Copyright 2002 Free Software Foundation

View File

@ -1,5 +1,5 @@
// { dg-do run }
// { dg-gpp-additional-sources " comdat1-aux.cc" }
// { dg-additional-sources " comdat1-aux.cc" }
// { dg-options "-O" }
// Test that statics in inline functions are unified between
// translation units. Currently we handle this by just suppressing

View File

@ -1,5 +1,5 @@
// { dg-do run }
// { dg-gpp-additional-sources " comdat2-aux.cc" }
// { dg-additional-sources " comdat2-aux.cc" }
// { dg-options "-O" }
// Test that statics in inline functions are unified between
// translation units. Currently we handle this by just suppressing

View File

@ -1,5 +1,5 @@
// { dg-do run }
// { dg-gpp-additional-sources " comdat3-aux.cc" }
// { dg-additional-sources " comdat3-aux.cc" }
// Test that duplicate elimination of implicit instantiations of static
// data members works properly.

View File

@ -1,5 +1,5 @@
// { dg-do run }
// { dg-gpp-additional-sources " ctor1-aux.cc" }
// { dg-additional-sources " ctor1-aux.cc" }
// Origin: Mark Mitchell <mark@codesourcery.com>

View File

@ -1,5 +1,5 @@
// { dg-do link }
// { dg-gpp-additional-sources " instantiate5.cc instantiate5-main.cc" }
// { dg-additional-sources " instantiate5.cc instantiate5-main.cc" }
// `global constructors' are given the same name, based on foo(), on
// both translation units, which is wrong, because it must be possible

View File

@ -1,6 +1,7 @@
/* A static function with a global alias should not get 'defined but
not used' warnings. Exposed by Linux kernel. */
/* { dg-do compile } */
/* { dg-require-alias } */
/* { dg-options "-Wall" } */
extern void do_something (void);

View File

@ -1,4 +1,5 @@
/* { dg-do link } */
/* { dg-require-alias "" } */
#include <stdlib.h>

View File

@ -1,5 +1,6 @@
/* PR 3997 */
/* { dg-do run } */
/* { dg-require-alias "" } */
extern void abort (void);
extern void exit (int);

View File

@ -1,179 +0,0 @@
# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Please email any bugs, comments, and/or additions to this file to:
# jlarmour@cygnus.co.uk
# This file was written by Jonathan Larmour (jlarmour@cygnus.co.uk).
# GCC testsuite that uses the `dg.exp' driver.
# Load support procs.
load_lib gcc-dg.exp
###############################
# proc gcc_target_object_format {}
###############################
# has been moved to: gcc/testsuite/lib/file-format.exp
###############################
# proc check_weak_available { }
###############################
# has been moved to: gcc/testsuite/lib/target-supports.exp
##########
# weak-1.c
##########
if { [ check_weak_available ] == 1 } {
dg-init
set lines [gcc_target_compile "$srcdir/$subdir/weak-1a.c" "weak-1a.o" object ""]
if ![string match "" $lines] then {
fail "weak-1a.o"
} else {
dg-runtest "$srcdir/$subdir/weak-1.c" "weak-1a.o" ""
file delete weak-1a.o
}
dg-finish
} elseif { [ check_weak_available ] == 0 } {
unsupported "weak-1.c"
} else {
unresolved "weak-1.c"
}
##########
# weak-2.c
##########
if { [ check_weak_available ] == 1 } {
dg-init
set lines [gcc_target_compile "$srcdir/$subdir/weak-2a.c" "weak-2a.o" object ""]
if ![string match "" $lines] then {
fail "weak-2a.o"
} else {
set lines [gcc_target_compile "$srcdir/$subdir/weak-2b.c" "weak-2b.o" object ""]
if ![string match "" $lines] then {
fail "weak-2b.o"
} else {
dg-runtest "$srcdir/$subdir/weak-2.c" "weak-2a.o weak-2b.o" ""
file delete weak-2a.o weak-2b.o
}
}
dg-finish
} elseif { [ check_weak_available ] == 0 } {
unsupported "weak-2.c"
} else {
unresolved "weak-2.c"
}
###########
# alias-1.c
###########
dg-init
switch [check_alias_available "$srcdir/$subdir/alias-1.c"] {
yes { dg-runtest "$srcdir/$subdir/alias-1.c" "" "" }
no { unsupported "alias-1.c" }
default { fail "alias-1.c" }
}
dg-finish
###########
# alias-2.c
###########
dg-init
switch [check_alias_available "$srcdir/$subdir/alias-2.c"] {
yes { dg-runtest "$srcdir/$subdir/alias-2.c" "" "" }
no { unsupported "alias-2.c" }
default { fail "alias-2.c" }
}
dg-finish
###########
# wkali-1.c
###########
if { [ check_weak_available ] == 1 } {
dg-init
switch [check_alias_available "$srcdir/$subdir/wkali-1.c"] {
yes { dg-runtest "$srcdir/$subdir/wkali-1.c" "" "" }
no { unsupported "wkali-1.c" }
default { fail "wkali-1.c" }
}
dg-finish
} elseif { [ check_weak_available ] == 0 } {
unsupported "wkali-1.c"
} else {
unresolved "wkali-1.c"
}
###########
# wkali-2.c
###########
if { [ check_weak_available ] == 1 } {
dg-init
set lines [gcc_target_compile "$srcdir/$subdir/wkali-2a.c" "wkali-2a.o" object ""]
if ![string match "" $lines] then {
fail "wkali-2a.o"
} else {
set lines [gcc_target_compile "$srcdir/$subdir/wkali-2b.c" "wkali-2b.o" object ""]
if [string match "*only weak aliases*" $lines] then {
xfail "wkali-2b.o"
file delete $srcdir/$subdir/wkali-2.exe
} elseif ![string match "" $lines] then {
fail "wkali-2b.o"
} else {
dg-runtest "$srcdir/$subdir/wkali-2.c" "wkali-2a.o wkali-2b.o" ""
file delete wkali-2a.o wkali-2b.o
}
}
dg-finish
} elseif { [ check_weak_available ] == 0 } {
unsupported "wkali-2.c"
} else {
unresolved "wkali-2.c"
}
###########
# gcsec-1.c
###########
# Check if the ld used by gcc supports --gc-sections.
set gcc_ld [lindex [gcc_target_compile "-print-prog-name=ld" "" "none" ""] 0]
set ld_output [remote_exec host "$gcc_ld" "--help"]
# AIX gld supports garbage collection. But AIX gcc does not support
# -ffunction-sections or -fdata-sections.
if { [ string first "--gc-sections" $ld_output ] >= 0
&& ! [istarget rs6000-*-aix*]
&& ! [istarget powerpc*-*-aix*] } {
dg-init
if [isnative] {
dg-runtest "$srcdir/$subdir/gcsec-1.c" "-ffunction-sections -fdata-sections -Wl,--gc-sections -static" ""
} else {
dg-runtest "$srcdir/$subdir/gcsec-1.c" "-ffunction-sections -fdata-sections -Wl,--gc-sections" ""
}
dg-finish
} else {
unsupported "gcsec-1.c"
}
### EOF ecos.exp

View File

@ -1,4 +1,10 @@
/* { dg-do run } */
/* AIX gld supports garbage collection. But AIX gcc does not support
-ffunction-sections or -fdata-sections. */
/* { dg-do run { xfail rs6000-*-aix* powerpc*-*-aix* } } */
/* { dg-require-gc-sections "" } */
/* { dg-options "-ffunction-sections -fdata-sections -Wl,--gc-sections -static" } */
/* { dg-options "-ffunction-sections -fdata-sections -Wl,--gc-sections -static" { target native } } */
#include <stdlib.h>

View File

@ -1,4 +1,4 @@
# Copyright (C) 2001 Free Software Foundation, Inc.
# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -24,17 +24,9 @@
# Load support procs.
load_lib gcc-dg.exp
##############
# 20000419-2.c
##############
dg-init
switch [check_alias_available "$srcdir/$subdir/20000419-2.c"] {
yes { dg-runtest "$srcdir/$subdir/20000419-2.c" "" "" }
no { unsupported "20000419-2.c" }
default { fail "20000419-2.c" }
}
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*\[1-9\].c]] \
"" ""
dg-finish
### EOF special.exp

View File

@ -1,4 +1,6 @@
/* { dg-do run } */
/* { dg-require-weak "" } */
/* { dg-additional-sources weak-1a.c } */
#include <stdlib.h>

View File

@ -1,4 +1,5 @@
/* { dg-do run } */
/* { dg-additional-sources "weak-2a.c weak-2b.c" } */
#include <stdlib.h>

View File

@ -1,4 +1,6 @@
/* { dg-do link } */
/* { dg-require-weak "" } */
/* { dg-require-alias "" } */
#include <stdlib.h>

View File

@ -1,4 +1,6 @@
/* { dg-do run } */
/* { dg-require-weak "" } */
/* { dg-additional-sources "wkali-2a.c wkali-2b.c" } */
#include <stdlib.h>

View File

@ -26,20 +26,3 @@ proc g++-dg-test { prog do_what extra_tool_flags } {
proc g++-dg-prune { system text } {
return [gcc-dg-prune $system $text]
}
# Record additional sources files that must be compiled along with the
# main source file.
proc dg-gpp-additional-sources { args } {
global additional_sources
set additional_sources [lindex $args 1]
}
# Record additional files -- other than source files -- that must be
# present on the system where the compiler runs.
proc dg-gpp-additional-files { args } {
global additional_files
set additional_files [lindex $args 1]
}

View File

@ -31,8 +31,6 @@ load_lib gcc-defs.exp
set gpp_compile_options ""
set additional_sources ""
set additional_files ""
#
# g++_version -- extract and print the version number of the compiler
@ -306,34 +304,10 @@ proc g++_target_compile { source dest type options } {
exec rm -f $rponame
}
global additional_sources
global additional_files
set to_download ""
if { $additional_sources != "" } then {
if [is_remote host] {
lappend options "additional_flags=$additional_sources"
}
regsub -all "^| " $additional_sources " [file dirname $source]/" additional_sources
if ![is_remote host] {
lappend options "additional_flags=$additional_sources"
}
set to_download [concat $to_download $additional_sources]
}
if { $additional_files != "" } then {
regsub -all " " $additional_files " [file dirname $source]/" additional_files
set to_download [concat $to_download $additional_files]
}
if [is_remote host] {
foreach file $to_download {
remote_download host $file
}
}
set options [dg-additional-files-options $options $source]
set result [target_compile $source $dest $type $options]
set additional_sources ""
set additional_files ""
return $result
}

View File

@ -1,4 +1,4 @@
# Copyright (C) 2001 Free Software Foundation, Inc.
# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -164,3 +164,56 @@ if { [info procs runtest_file_p] == "" } then {
return 1
}
}
# Record additional sources files that must be compiled along with the
# main source file.
set additional_sources ""
proc dg-additional-sources { args } {
global additional_sources
set additional_sources [lindex $args 1]
}
# Record additional files -- other than source files -- that must be
# present on the system where the compiler runs.
set additional_files ""
proc dg-additional-files { args } {
global additional_files
set additional_files [lindex $args 1]
}
# Return an updated version of OPTIONS that mentions any additional
# source files registered with dg-additional-sources. SOURCE is the
# name of the test case.
proc dg-additional-files-options { options source } {
global additional_sources
global additional_files
set to_download [list]
if { $additional_sources != "" } then {
if [is_remote host] {
lappend options "additional_flags=$additional_sources"
}
regsub -all "^| " $additional_sources " [file dirname $source]/" additional_sources
if ![is_remote host] {
lappend options "additional_flags=$additional_sources"
}
set to_download [concat $to_download $additional_sources]
set additional_sources ""
}
if { $additional_files != "" } then {
regsub -all " " $additional_files " [file dirname $source]/" additional_files
set to_download [concat $to_download $additional_files]
set additional_files ""
}
if [is_remote host] {
foreach file $to_download {
remote_download host $file
}
}
return $options
}

View File

@ -250,3 +250,47 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
}
}
}
# If this target does not support weak symbols, skip this test.
proc dg-require-weak { args } {
upvar dg-do-what dg-do-what
upvar name name
set weak_available [ check_weak_available ]
if { $weak_available == -1 } {
unresolved "$name"
}
if { $weak_available != 1 } {
set dg-do-what [list [lindex $dg_do_what 0] "N" "P"]
return
}
}
# If this target does not support the "alias" attribute, skip this
# test.
proc dg-require-alias { args } {
upvar dg-do-what dg-do-what
upvar name name
set alias_available [ check_alias_available ]
if { $alias_available == -1 } {
unresolved "$name"
}
if { $alias_available < 2 } {
set dg-do-what [list [lindex $dg_do_what 0] "N" "P"]
return
}
}
# If this target's linker does not support the --gc-sections flag,
# skip this test.
proc dg-require-gc-sections { args } {
if { ![ check_gc_sections_available ] } {
upvar dg-do-what dg-do-what
set dg-do-what [list [lindex $dg_do_what 0] "N" "P"]
return
}
}

View File

@ -1,4 +1,4 @@
# Copyright (C) 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
# Copyright (C) 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -153,5 +153,6 @@ proc gcc_target_compile { source dest type options } {
lappend options "timeout=[target_info gcc,timeout]"
}
lappend options "compiler=$GCC_UNDER_TEST"
set options [dg-additional-files-options $options $source]
return [target_compile $source $dest $type $options]
}

View File

@ -1,4 +1,4 @@
# Copyright (C) 1999, 2001 Free Software Foundation, Inc.
# Copyright (C) 1999, 2001, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -67,24 +67,28 @@ proc check_weak_available { } {
###############################
# Determine if the target toolchain supports the alias attribute.
# Parameter is the pathname of a file that can be used to test the alias support.
# Returns yes if it does.
# Returns no if it does not.
# Returns dontknow if something went wrong
# For an example of the use of this function, see gcc.dg/special/ecos.exp
proc check_alias_available { testfile } {
# Returns 2 if the target supports aliases. Returns 1 if the target
# only supports weak aliased. Returns 0 if the target does not
# support aliases at all. Returns -1 if support for aliases could not
# be determined.
proc check_alias_available { } {
global alias_available_saved
if [info exists alias_available_saved] {
verbose "check_alias_available returning saved $alias_available_saved" 2
} else {
verbose "check_alias_available compiling testfile $testfile" 2
set lines [gcc_target_compile $testfile "tmp.o" object ""]
verbose "check_alias_available compiling testfile" 2
set f [open "tmp.c" "w"]
puts $f "void f() __attribute__((alias(\"g\")));"
close $f
set lines [gcc_target_compile "tmp.c" "tmp.o" object ""]
file delete "tmp.c"
if [string match "" $lines] then {
# No error messages, everything is OK.
set alias_available_saved yes
set alias_available_saved 2
} else {
if [regexp "alias definitions not supported" $lines] {
verbose "check_alias_available target does not support aliases" 2
@ -93,16 +97,16 @@ proc check_alias_available { testfile } {
if { $objformat == "elf" } {
verbose "check_alias_available but target uses ELF format, so it ought to" 2
set alias_available_saved dontknow
set alias_available_saved -1
} else {
set alias_available_saved no
set alias_available_saved 0
}
} else {
if [regexp "only weak aliases are supported" $lines] {
verbose "check_alias_available target supports only weak aliases" 2
set alias_available_saved no
set alias_available_saved 1
} else {
set alias_available_saved dontknow
set alias_available_saved -1
}
}
}
@ -112,3 +116,21 @@ proc check_alias_available { testfile } {
return $alias_available_saved
}
# Returns true if --gc-sections is supported on the target.
proc check_gc_sections_available { } {
global gc_sections_available_saved
if {![info exists alias_available_saved]} {
# Check if the ld used by gcc supports --gc-sections.
set gcc_ld [lindex [gcc_target_compile "-print-prog-name=ld" "" "none" ""] 0]
set ld_output [remote_exec host "$gcc_ld" "--help"]
if { [ string first "--gc-sections" $ld_output ] >= 0 } {
set gc_sections_available_saved 1
} else {
set gc_sections_available_saved 0
}
}
return $gc_sections_available_saved
}