OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [ld/] [testsuite/] [ld-gc/] [gc.exp] - Blame information for rev 163

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 64 khays
# Expect script for ld-gc tests
2
#   Copyright 2008, 2009, 2010
3
#   Free Software Foundation, Inc.
4
#
5
# This file is part of the GNU Binutils.
6
#
7
# This program is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20
# MA 02110-1301, USA.
21
 
22
# These tests require --gc-sections
23
if ![check_gc_sections_available] {
24
    return
25
}
26
 
27
set cflags "-ffunction-sections -fdata-sections"
28
set objfile "tmpdir/gc.o"
29
 
30
if [istarget powerpc64*-*-*] {
31
    # otherwise with -mcmodel=medium gcc we get XPASSes.
32
    set cflags "$cflags -mminimal-toc"
33
}
34
 
35
if { [is_remote host] || [which $CC] != 0 } {
36
    ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/gc.c $objfile
37
}
38
 
39
proc test_gc { testname filename linker ldflags} {
40
    global nm
41
    global srcdir
42
    global subdir
43
    global nm_output
44
    global objfile
45
 
46
    if ![file readable $objfile ] {
47
        untested $testname
48
        return
49
    }
50
 
51
    set outfile "tmpdir/$filename"
52
    set options "-L$srcdir/$subdir"
53
    append options " " $ldflags " " [ld_simple_link_defsyms] " " $objfile
54
 
55
    # SH64 targets needs an extra ld option for this test.
56
    if [istarget sh64*-*-*] {
57
        if [istarget sh64*l*-*-*] {
58
            set options "-mshlelf32 $options"
59
        } else {
60
            set options "-mshelf32 $options"
61
        }
62
    }
63
 
64
    if ![ld_simple_link $linker $outfile $options] {
65
        fail $testname
66
        return
67
    }
68
    if ![ld_nm $nm "" $outfile] {
69
        unresolved $testname
70
        return
71
    }
72
    if {![info exists nm_output(used_func)] \
73
            || ![info exists nm_output(used_var)]} {
74
        send_log "used sections do not exist\n"
75
        verbose "used sections do not exist"
76
        fail $testname
77
        return
78
    }
79
    #ppc64_elf_gc_mark_hook needs to be taught how to look through
80
    #the .toc section to properly mark variable sections for gc.
81
    setup_xfail "powerpc64*-*-*"
82
    if {[info exists nm_output(unused_func)] \
83
            || [info exists nm_output(unused_var)]} {
84
        send_log "unused section still here\n"
85
        verbose "unused section still here"
86
        fail $testname
87
        return
88
    }
89
    pass $testname
90
}
91
 
92
test_gc "Check --gc-section" "gcexe" $ld "--gc-sections -e main"
93
test_gc "Check --gc-section/-q" "gcrexe" $ld "--gc-sections -q -e main"
94
test_gc "Check --gc-section/-r/-e" "gcrel" $ld "-r --gc-sections -e main"
95
test_gc "Check --gc-section/-r/-u" "gcrel" $ld "-r --gc-sections -u used_func"
96
 
97
run_dump_test "noent"
98
run_dump_test "abi-note"
99
run_dump_test "start"
100 163 khays
 
101
if { [is_elf_format] && [check_shared_lib_support] } then {
102
    set gasopt ""
103
    if { [istarget tic6x-*] } then {
104
        set gasopt "-mpic -mpid=near"
105
    }
106
    if {![ld_assemble_flags $as $gasopt $srcdir/$subdir/libpersonality.s tmpdir/libpersonality.o]
107
        || ![ld_simple_link $ld tmpdir/libpersonality.so "-shared tmpdir/libpersonality.o"] } then {
108
        fail libpersonality
109
    } else {
110
        run_dump_test "personality"
111
    }
112
}
113
 
114 64 khays
if { [is_remote host] || [which $CC] != 0 } {
115
    if { [istarget "*-*-linux*"]
116
         || [istarget "*-*-gnu*"] } {
117
        ld_compile "$CC -fPIC $CFLAGS $cflags" $srcdir/$subdir/pr11218-1.c tmpdir/pr11218-1.o
118
        ld_simple_link $ld tmpdir/pr11218-1.so "-shared tmpdir/pr11218-1.o"
119
        ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/pr11218-2.c tmpdir/pr11218-2.o
120
        run_dump_test "pr11218"
121
    }
122
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.