Commit | Line | Data |
---|---|---|
f96b4a7b | 1 | # Expect script for frame section tests |
219d1afa | 2 | # Copyright (C) 2004-2018 Free Software Foundation, Inc. |
117a3ac8 | 3 | # |
f96b4a7b NC |
4 | # This file is part of the GNU Binutils. |
5 | # | |
6 | # This program is free software; you can redistribute it and/or modify | |
117a3ac8 | 7 | # it under the terms of the GNU General Public License as published by |
f96b4a7b | 8 | # the Free Software Foundation; either version 3 of the License, or |
117a3ac8 | 9 | # (at your option) any later version. |
f96b4a7b | 10 | # |
117a3ac8 L |
11 | # This program is distributed in the hope that it will be useful, |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
f96b4a7b | 15 | # |
117a3ac8 L |
16 | # You should have received a copy of the GNU General Public License |
17 | # along with this program; if not, write to the Free Software | |
f96b4a7b NC |
18 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
19 | # MA 02110-1301, USA. | |
117a3ac8 L |
20 | # |
21 | # Written by H.J. Lu (hongjiu.lu@intel.com) | |
22 | # | |
23 | ||
24 | # Make sure that ld correctly handles frame sections in ELF. | |
25 | ||
26 | # This test can only be run on ELF platforms. | |
27 | if ![is_elf_format] { | |
28 | return | |
29 | } | |
30 | ||
3874ed78 | 31 | # No shared lib support on this target. |
f61f94ec | 32 | if ![istarget shared] { |
3874ed78 AM |
33 | return |
34 | } | |
35 | ||
f6a8ae81 KK |
36 | # Too small MAXPAGESIZE on this target. |
37 | if { [istarget "sh*-*-elf*"] } { | |
38 | return | |
39 | } | |
40 | ||
48733062 AM |
41 | # ??? These targets have their own .tbss section, with different meaning |
42 | # to the usual ELF .tbss. | |
5bf135a7 | 43 | if { [istarget "hppa64-*-*"] || [istarget "v850*-*-*"] } { |
48733062 AM |
44 | return |
45 | } | |
46 | ||
de1491f0 BS |
47 | set as_opt "" |
48 | ||
49 | # This target requires extra as options when building code for shared | |
50 | # libraries. | |
51 | if { [istarget "tic6x-*-*"] } { | |
52 | set as_opt "-mpic -mpid=near" | |
53 | } | |
54 | ||
117a3ac8 L |
55 | set test1 "read-only .eh_frame section" |
56 | set test2 "read-only .gcc_except_table section" | |
57 | ||
58 | global as | |
59 | global ld | |
60 | ||
de1491f0 BS |
61 | if { ![ld_assemble_flags $as $as_opt $srcdir/$subdir/tbss.s tmpdir/tbss.o ] |
62 | || ![ld_assemble_flags $as $as_opt $srcdir/$subdir/frame.s tmpdir/frame.o] } { | |
117a3ac8 L |
63 | unresolved "$test1" |
64 | return | |
65 | } | |
66 | ||
f61f94ec L |
67 | if { [ld_link $ld tmpdir/frame.so "-z noseparate-code --shared tmpdir/frame.o tmpdir/tbss.o"] } { |
68 | pass "$test1 -z noseparate-code" | |
117a3ac8 | 69 | } else { |
f61f94ec L |
70 | fail "$test1 -z noseparate-code" |
71 | } | |
72 | ||
73 | if { [ld_link $ld tmpdir/frame.so "-z separate-code --shared tmpdir/frame.o tmpdir/tbss.o"] } { | |
74 | pass "$test1 -z separate-code" | |
75 | } else { | |
76 | fail "$test1 -z separate-code" | |
117a3ac8 L |
77 | } |
78 | ||
de1491f0 | 79 | if ![ld_assemble_flags $as $as_opt $srcdir/$subdir/table.s tmpdir/table.o ] { |
117a3ac8 L |
80 | unresolved "$test2" |
81 | return | |
82 | } | |
83 | ||
f61f94ec L |
84 | if { [ld_link $ld tmpdir/table.so "-z noseparate-code --shared tmpdir/table.o tmpdir/tbss.o"] } { |
85 | pass "$test2 -z noseparate-code" | |
86 | } else { | |
87 | fail "$test2 -z noseparate-code" | |
88 | } | |
89 | ||
90 | if { [ld_link $ld tmpdir/table.so "-z separate-code --shared tmpdir/table.o tmpdir/tbss.o"] } { | |
91 | pass "$test2 -z separate-code" | |
117a3ac8 | 92 | } else { |
f61f94ec | 93 | fail "$test2 -z separate-code" |
117a3ac8 | 94 | } |