1 # Expect script for the PROVIDE_HIDDEN linker script command.
3 # Copyright (C) 2013-2018 Free Software Foundation, Inc.
5 # This file is part of the GNU Binutils.
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.
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.
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,
24 # Written by Maciej W. Rozycki <macro@codesourcery.com>
27 # Export classes only make sense for ELF shared-library targets.
28 if { ![is_elf_format] || ![check_shared_lib_support] } {
32 # This target requires extra GAS options when building code for shared
35 if [istarget "tic6x-*-*"] {
36 append AFLAGS_PIC " -mpic -mpid=near"
38 # These targets do not default to linking with shared libraries.
39 if { [istarget "mips*vr4100*-*-elf*"] \
40 || [istarget "mips*vr4300*-*-elf*"] \
41 || [istarget "mips*vr5000*-*-elf*"] } {
42 append LFLAGS " -call_shared"
45 set testname "PROVIDE_HIDDEN test"
47 run_ld_link_tests [list \
49 "$testname (auxiliary shared object)" \
50 "-shared -T provide-hidden-s.ld" "" \
52 [list provide-hidden-1.s ] \
53 [list "readelf -s provide-hidden-s.nd"] \
54 "provide-hidden-s.so"]]
56 run_ld_link_tests [list \
59 "-T provide-hidden-1.ld" "" \
61 [list provide-hidden-1.s] \
63 [list readelf -s provide-hidden-def.nd] \
64 [list readelf -s provide-hidden-dyn.nd]] \
68 "-T provide-hidden-1.ld" "" \
70 [list provide-hidden-2.s] \
72 [list readelf -s provide-hidden-def.nd] \
73 [list readelf -s provide-hidden-dyn.nd]] \
77 "-T provide-hidden-1.ld" "" \
79 [list provide-hidden-3.s] \
81 [list readelf -s provide-hidden-sec.nd] \
82 [list readelf -s provide-hidden-dyn.nd]] \
86 "$LFLAGS -T provide-hidden-1.ld" "tmpdir/provide-hidden-s.so" \
88 [list provide-hidden-3.s] \
89 [list "readelf -s provide-hidden-dynsec.nd"] \
93 "-T provide-hidden-1.ld" "" \
95 [list provide-hidden-4.s] \
97 [list readelf -s provide-hidden-sec.nd] \
98 [list readelf -s provide-hidden-dyn.nd]] \
102 "$LFLAGS -T provide-hidden-1.ld" "tmpdir/provide-hidden-s.so" \
104 [list provide-hidden-4.s] \
106 [list readelf -s provide-hidden-sec.nd] \
107 [list readelf -s provide-hidden-dyn.nd]] \
108 "provide-hidden-6"] \
111 "-T provide-hidden-2.ld" "" \
113 [list provide-hidden-1.s] \
115 [list readelf -s provide-hidden-def.nd] \
116 [list readelf -s provide-hidden-dyn.nd]] \
117 "provide-hidden-7"] \
120 "-T provide-hidden-2.ld" "" \
122 [list provide-hidden-2.s] \
124 [list readelf -s provide-hidden-def.nd] \
125 [list readelf -s provide-hidden-dyn.nd]] \
126 "provide-hidden-8"] \
129 "-T provide-hidden-2.ld" "" \
131 [list provide-hidden-3.s] \
133 [list readelf -s provide-hidden-abs.nd] \
134 [list readelf -s provide-hidden-dyn.nd]] \
135 "provide-hidden-9"] \
138 "$LFLAGS -T provide-hidden-2.ld" "tmpdir/provide-hidden-s.so" \
140 [list provide-hidden-3.s] \
141 [list "readelf -s provide-hidden-dynabs.nd"] \
142 "provide-hidden-10"] \
145 "-T provide-hidden-2.ld" "" \
147 [list provide-hidden-4.s] \
149 [list readelf -s provide-hidden-abs.nd] \
150 [list readelf -s provide-hidden-dyn.nd]] \
151 "provide-hidden-11"] \
154 "$LFLAGS -T provide-hidden-2.ld" "tmpdir/provide-hidden-s.so" \
156 [list provide-hidden-4.s] \
158 [list readelf -s provide-hidden-abs.nd] \
159 [list readelf -s provide-hidden-dyn.nd]] \
160 "provide-hidden-12"]]