]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/testsuite/ld-x86-64/export-class.exp
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-x86-64 / export-class.exp
CommitLineData
a521a329
MR
1# Expect script for symbol export classes, x86-64 variation.
2#
d87bef3a 3# Copyright (C) 2012-2023 Free Software Foundation, Inc.
a521a329
MR
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# Exclude non-Linux targets; feel free to include your favorite one
28# if you like.
29if { ![istarget x86_64*-*-linux*] } {
30 return
31}
32
33proc x86_64_export_class_test { abi flag emul } {
f2e37a5c 34 global NO_DT_RELR_LDFLAGS
a521a329
MR
35
36 set testname "x86-64 $abi symbol export class test"
37
38 set dump [string map {32 ../ld-i386/i386 x32 x86-64-x32 64 x86-64-64} $abi]
39
40 set AFLAGS "$flag"
41 set LDFLAGS "-m$emul"
42
43 # Build an auxiliary shared object with conflicting versioned symbol
44 # definitions.
45 run_ld_link_tests [list \
46 [list \
47 "$testname (auxiliary shared object)" \
897aea50 48 "$LDFLAGS -shared -version-script ../ld-elf/export-class-lib.ver" "" \
a521a329
MR
49 "$AFLAGS" \
50 { ../ld-elf/export-class-lib.s } \
51 {} \
52 "x86-64-$abi-export-class-lib.so" \
53 ] \
54 ]
55
56 # Build a static object that pulls symbol definitions. It has to come
57 # first before the auxiliary shared object and other static objects on
58 # the linker's command line and hence we need to build it separately.
59 run_ld_link_tests [list \
60 [list \
61 "$testname (initial static object)" \
897aea50 62 "$LDFLAGS -r" "" \
a521a329
MR
63 "$AFLAGS" \
64 { ../ld-elf/export-class-ref.s } \
65 {} \
66 "x86-64-$abi-export-class-ref-r.o" \
67 ] \
68 ]
69
70 # Build static objects that satisfy symbol dependencies and preempt
71 # shared-object symbol definitions, and link all the objects built into
72 # the final shared object. The command-line order of objects linked is
73 # important to make sure the linker correctly preempts versioned symbols
74 # from the auxiliary shared object and is as follows: ref, lib, dep, def.
75 # Get a dump to make sure symbol dependencies are resolved internally.
76 run_ld_link_tests [list \
77 [list \
78 "$testname (final shared object)" \
f2e37a5c 79 "$LDFLAGS $NO_DT_RELR_LDFLAGS -shared -Tdata=0x12340000 tmpdir/x86-64-$abi-export-class-ref-r.o tmpdir/x86-64-$abi-export-class-lib.so" "" \
a521a329
MR
80 "$AFLAGS" \
81 { ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \
82 [list \
83 [list readelf -r $dump-export-class.rd] \
84 [list readelf "-x .data" ../ld-i386/i386-export-class.xd] \
85 ] \
86 "x86-64-$abi-export-class.so" \
87 ] \
88 ]
89}
90
91set abis { 32 --32 elf_i386 x32 --x32 elf32_x86_64 64 --64 elf_x86_64 }
92foreach { abi flag emul } $abis {
93 x86_64_export_class_test $abi $flag $emul
94}