1 # Expect script
for common symbol override.
3 # Copyright
(C
) 2011-2024 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 # This test is
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 # This target requires a non
-default emulation
for successful shared
39 # library
/executable builds.
41 if [istarget
"tic6x-*-*"] {
42 append LFLAGS
" -melf32_tic6x_le"
44 # These targets
do not default to linking with shared libraries.
45 if { [istarget
"mips*vr4100*-*-elf*"] \
46 ||
[istarget
"mips*vr4300*-*-elf*"] \
47 ||
[istarget
"mips*vr5000*-*-elf*"] } {
48 append LFLAGS
" -call_shared"
51 #
Define a global symbol.
52 set testname
"Common symbol override test"
53 run_ld_link_tests
[list \
55 "$testname (auxiliary shared object build)" \
56 "$LFLAGS -shared" "" \
60 { readelf
-s comm
-data1.sd
} \
66 #
Set the pointer size according to the ELF flavor.
68 if [is_elf64
"tmpdir/libcomm-data.so"] {
69 append AFLAGS
" --defsym ELF64=1"
71 # HPUX targets use a different .comm syntax.
72 if [istarget
"*-*-hpux*"] {
73 append AFLAGS
" --defsym HPUX=1"
76 # bfin
-elf does not currently support copy relocs.
77 setup_xfail
"bfin-*-*"
78 clear_xfail
"bfin-*-linux-uclibc*"
80 # Verify that a common symbol has been converted to an undefined
81 # reference to the global symbol of the same
name defined above
82 # and that the debug reference has been dropped.
83 run_ld_link_tests
[list \
86 "$LFLAGS -T comm-data2.ld -Ltmpdir -lcomm-data" "" \
90 [list readelf
-s comm
-data2.sd
] \
91 [list readelf
-r comm
-data2.rd
] \
92 [list readelf
"-x .debug_foo" comm-data2.xd]] \
99 { comm
-data3a.s comm
-data3b.s
} \
101 { readelf
-s comm
-data3.sd
} \
109 { comm
-data3b.s comm
-data3a.s
} \
111 { readelf
-s comm
-data3.sd
} \
117 "$LFLAGS -shared" "" \
118 "$AFLAGS_PIC $AFLAGS" \
125 "$LFLAGS --as-needed -Ltmpdir -lpr26580-1" "" \
128 { {readelf
-s pr26580
-1.sd
} } \
133 "$LFLAGS --no-as-needed -Ltmpdir -lpr26580-1" "" \
136 { {readelf
-s pr26580
-2.sd
} } \