1# Expect script for the PROVIDE_HIDDEN linker script command.
2#
3# Copyright (C) 2013-2016 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
23#
24# Written by Maciej W. Rozycki <macro@codesourcery.com>
25#
26
27# Export classes only make sense for ELF shared-library targets.
28if { ![is_elf_format] || ![check_shared_lib_support] } {
29    return
30}
31
32# This target requires extra GAS options when building code for shared
33# libraries.
34set AFLAGS_PIC ""
35if [istarget "tic6x-*-*"] {
36    append AFLAGS_PIC " -mpic -mpid=near"
37}
38
39set testname "PROVIDE_HIDDEN test"
40
41run_ld_link_tests [list \
42    [list \
43	"$testname (auxiliary shared object)" \
44	"-shared -T provide-hidden-s.ld" "" \
45	"$AFLAGS_PIC" \
46	[list provide-hidden-1.s ] \
47	[list "readelf -s provide-hidden-s.nd"] \
48	"provide-hidden-s.so"]]
49
50run_ld_link_tests [list \
51    [list \
52	"$testname 1" \
53	"-T provide-hidden-1.ld" "" \
54	"" \
55	[list provide-hidden-1.s] \
56	[list \
57	    [list readelf -s provide-hidden-def.nd] \
58	    [list readelf -s provide-hidden-dyn.nd]] \
59	"provide-hidden-1"] \
60    [list \
61	"$testname 2" \
62	"-T provide-hidden-1.ld" "" \
63	"" \
64	[list provide-hidden-2.s] \
65	[list \
66	    [list readelf -s provide-hidden-def.nd] \
67	    [list readelf -s provide-hidden-dyn.nd]] \
68	"provide-hidden-2"] \
69    [list \
70	"$testname 3" \
71	"-T provide-hidden-1.ld" "" \
72	"" \
73	[list provide-hidden-3.s] \
74	[list \
75	    [list readelf -s provide-hidden-sec.nd] \
76	    [list readelf -s provide-hidden-dyn.nd]] \
77	"provide-hidden-3"] \
78    [list \
79	"$testname 4" \
80	"-T provide-hidden-1.ld" "tmpdir/provide-hidden-s.so" \
81	"" \
82	[list provide-hidden-3.s] \
83	[list "readelf -s provide-hidden-dynsec.nd"] \
84	"provide-hidden-4"] \
85    [list \
86	"$testname 5" \
87	"-T provide-hidden-1.ld" "" \
88	"" \
89	[list provide-hidden-4.s] \
90	[list \
91	    [list readelf -s provide-hidden-sec.nd] \
92	    [list readelf -s provide-hidden-dyn.nd]] \
93	"provide-hidden-5"] \
94    [list \
95	"$testname 6" \
96	"-T provide-hidden-1.ld" "tmpdir/provide-hidden-s.so" \
97	"" \
98	[list provide-hidden-4.s] \
99	[list \
100	    [list readelf -s provide-hidden-sec.nd] \
101	    [list readelf -s provide-hidden-dyn.nd]] \
102	"provide-hidden-6"] \
103    [list \
104	"$testname 7" \
105	"-T provide-hidden-2.ld" "" \
106	"" \
107	[list provide-hidden-1.s] \
108	[list \
109	    [list readelf -s provide-hidden-def.nd] \
110	    [list readelf -s provide-hidden-dyn.nd]] \
111	"provide-hidden-7"] \
112    [list \
113	"$testname 8" \
114	"-T provide-hidden-2.ld" "" \
115	"" \
116	[list provide-hidden-2.s] \
117	[list \
118	    [list readelf -s provide-hidden-def.nd] \
119	    [list readelf -s provide-hidden-dyn.nd]] \
120	"provide-hidden-8"] \
121    [list \
122	"$testname 9" \
123	"-T provide-hidden-2.ld" "" \
124	"" \
125	[list provide-hidden-3.s] \
126	[list \
127	    [list readelf -s provide-hidden-abs.nd] \
128	    [list readelf -s provide-hidden-dyn.nd]] \
129	"provide-hidden-9"] \
130    [list \
131	"$testname 10" \
132	"-T provide-hidden-2.ld" "tmpdir/provide-hidden-s.so" \
133	"" \
134	[list provide-hidden-3.s] \
135	[list "readelf -s provide-hidden-dynabs.nd"] \
136	"provide-hidden-10"] \
137    [list \
138	"$testname 11" \
139	"-T provide-hidden-2.ld" "" \
140	"" \
141	[list provide-hidden-4.s] \
142	[list \
143	    [list readelf -s provide-hidden-abs.nd] \
144	    [list readelf -s provide-hidden-dyn.nd]] \
145	"provide-hidden-11"] \
146    [list \
147	"$testname 12" \
148	"-T provide-hidden-2.ld" "tmpdir/provide-hidden-s.so" \
149	"" \
150	[list provide-hidden-4.s] \
151	[list \
152	    [list readelf -s provide-hidden-abs.nd] \
153	    [list readelf -s provide-hidden-dyn.nd]] \
154	"provide-hidden-12"]]
155