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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.20.1/] [ld/] [testsuite/] [ld-elf/] [sec-to-seg.exp] - Blame information for rev 208

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

Line No. Rev Author Line
1 205 julius
# Test the assigment of sections to segments.
2
#
3
# Copyright 2008   Free Software Foundation, Inc.
4
# Contributed by Red Hat.
5
#
6
# This file is part of the GNU Binutils.
7
#
8
# This program is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 3 of the License, or
11
# (at your option) any later version.
12
#
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
# GNU General Public License for more details.
17
#
18
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21
# MA 02110-1301, USA.
22
 
23
set testname "assignment of ELF sections to segments"
24
 
25
if {! [is_elf_format] } {
26
    unsupported $testname
27
    return
28
}
29
 
30
if {   ! [ld_assemble $as $srcdir/$subdir/sec-to-seg1.s tmpdir/sec-to-seg1.o]
31
    || ! [ld_assemble $as $srcdir/$subdir/sec-to-seg2.s tmpdir/sec-to-seg2.o]} then {
32
    unresolved $testname
33
    return
34
}
35
 
36
proc sec_to_seg_test { testname scriptname same_seg } {
37
    global srcdir
38
    global subdir
39
    global ld
40
    global exec_output
41
    global READELF
42
 
43
    if {! [ld_simple_link $ld tmpdir/sec-to-seg "-T $srcdir/$subdir/$scriptname tmpdir/sec-to-seg1.o tmpdir/sec-to-seg2.o"] } then {
44
        fail $testname
45
        return 0
46
    }
47
 
48
    send_log "$READELF --program-headers --section-headers tmpdir/sec-to-seg\n"
49
    set exec_output [run_host_cmd "$READELF" "--program-headers --section-headers tmpdir/sec-to-seg"]
50
 
51
    if { $same_seg == 1 } {
52
      if {! [regexp ".*.sec1 .sec2" $exec_output] } {
53
          fail $testname
54
          return 0
55
      }
56
    } else {
57
      if {  [regexp ".*.sec1 .sec2" $exec_output] } {
58
          fail $testname
59
          return 0
60
      }
61
    }
62
 
63
    pass $testname
64
    return 1
65
}
66
 
67
# Assuming a pagesize of 0x1000 then:
68
#
69
# Test  Sec1 End  Sec 2 Start    Expected Result
70
# ----  --------  -----------    ---------------
71
#  A    00001042   00001043      Both sections on same page: assign to same segment.
72
#  B    00001042   00002044      Sections on adjacent pages: assign to same segment.
73
#  C    00001042   00003044      Sections on disjoint pages: assign to separate segments.
74
 
75
# These targets have a pagesize of 1, so they will always end up
76
# placing the two sections in separate segments in the B test.
77
if {    [istarget avr-*-*]
78
     || [istarget cr16-*-*]
79
     || [istarget crx-*-*]
80
     || [istarget dlx-*-*]
81
     || [istarget h8300-*-*]
82
     || [istarget ip2k-*-*]
83
     || [istarget m32r-*-*]
84
     || [istarget m88k-*-*]
85
     || [istarget msp430-*-*]
86
    } {
87
    set B_test_same_seg 0
88
} else {
89
    set B_test_same_seg 1
90
}
91
 
92
sec_to_seg_test "assignment of ELF sections to segments (same page)"      "sec-to-seg-script-same-page.t" 1
93
sec_to_seg_test "assignment of ELF sections to segments (adjacent pages)" "sec-to-seg-script-adjoining-pages.t" $B_test_same_seg
94
sec_to_seg_test "assignment of ELF sections to segments (disjoint pages)" "sec-to-seg-script-disjoint-pages.t" 0
95
 
96
 
97
# FIXME: Add more tests to check other rules of section to segment assignment.

powered by: WebSVN 2.1.0

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