1# Expect script for symbol export classes, VAX variation.
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# Exclude non-Linux targets; feel free to include your favorite one
28# if you like.
29if { ![istarget vax*-*-linux*] } {
30    return
31}
32
33set testname "VAX symbol export class test"
34
35# Build an auxiliary shared object with conflicting versioned symbol
36# definitions.
37run_ld_link_tests [list \
38    [list \
39	"$testname (auxiliary shared object)" \
40	"-shared -version-script ../ld-elf/export-class-lib.ver" "" \
41	"-k" \
42	{ ../ld-elf/export-class-lib.s } \
43	{} \
44	"vax-export-class-lib.so" \
45    ] \
46]
47
48# Build a static object that pulls symbol definitions.  It has to come
49# first before the auxiliary shared object and other static objects on
50# the linker's command line and hence we need to build it separately.
51run_ld_link_tests [list \
52    [list \
53	"$testname (initial static object)" \
54	"-r" "" \
55	"" \
56	{ ../ld-elf/export-class-ref.s } \
57	{} \
58	"vax-export-class-ref-r.o" \
59    ] \
60]
61
62# Build static objects that satisfy symbol dependencies and preempt
63# shared-object symbol definitions, and link all the objects built into
64# the final shared object.  The command-line order of objects linked is
65# important to make sure the linker correctly preempts versioned symbols
66# from the auxiliary shared object and is as follows: ref, lib, dep, def.
67# Get a dump to make sure symbol dependencies are resolved internally.
68run_ld_link_tests [list \
69    [list \
70	"$testname (final shared object)" \
71	"-shared -Tdata=0x12340000 tmpdir/vax-export-class-ref-r.o tmpdir/vax-export-class-lib.so" "" \
72	"-k" \
73	{ ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \
74	[list \
75	    [list readelf -r vax-export-class.rd] \
76	    [list readelf "-x .data" vax-export-class.xd] \
77	] \
78	"vax-export-class.so" \
79    ] \
80]
81