Commit | Line | Data |
---|---|---|
a521a329 MR |
1 | # Expect script for symbol export classes, PowerPC variation. |
2 | # | |
3 | # Copyright 2012 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. | |
29 | if { ![istarget powerpc*-*-linux*] } { | |
30 | return | |
31 | } | |
32 | ||
33 | proc supports_ppc64 { } { | |
34 | global ld | |
35 | ||
36 | catch "exec $ld --help | grep emulations" tmp | |
37 | if [string match "*elf64ppc*" $tmp] then { | |
38 | return 1 | |
39 | } else { | |
40 | return 0 | |
41 | } | |
42 | } | |
43 | ||
44 | proc powerpc_export_class_test { abi emul } { | |
45 | ||
46 | set testname "PowerPC $abi symbol export class test" | |
47 | ||
48 | set AFLAGS "-a$abi -be" | |
49 | set LDFLAGS "-m$emul" | |
50 | ||
51 | # Build an auxiliary shared object with conflicting versioned symbol | |
52 | # definitions. | |
53 | run_ld_link_tests [list \ | |
54 | [list \ | |
55 | "$testname (auxiliary shared object)" \ | |
897aea50 | 56 | "$LDFLAGS -shared -version-script ../ld-elf/export-class-lib.ver" "" \ |
a521a329 MR |
57 | "$AFLAGS" \ |
58 | { ../ld-elf/export-class-lib.s } \ | |
59 | {} \ | |
60 | "powerpc-$abi-export-class-lib.so" \ | |
61 | ] \ | |
62 | ] | |
63 | ||
64 | # Build a static object that pulls symbol definitions. It has to come | |
65 | # first before the auxiliary shared object and other static objects on | |
66 | # the linker's command line and hence we need to build it separately. | |
67 | run_ld_link_tests [list \ | |
68 | [list \ | |
69 | "$testname (initial static object)" \ | |
897aea50 | 70 | "$LDFLAGS -r" "" \ |
a521a329 MR |
71 | "$AFLAGS" \ |
72 | { ../ld-elf/export-class-ref.s } \ | |
73 | {} \ | |
74 | "powerpc-$abi-export-class-ref-r.o" \ | |
75 | ] \ | |
76 | ] | |
77 | ||
78 | # Build static objects that satisfy symbol dependencies and preempt | |
79 | # shared-object symbol definitions, and link all the objects built into | |
80 | # the final shared object. The command-line order of objects linked is | |
81 | # important to make sure the linker correctly preempts versioned symbols | |
82 | # from the auxiliary shared object and is as follows: ref, lib, dep, def. | |
83 | # Get a dump to make sure symbol dependencies are resolved internally. | |
84 | run_ld_link_tests [list \ | |
85 | [list \ | |
86 | "$testname (final shared object)" \ | |
897aea50 | 87 | "$LDFLAGS -shared -Tdata=0x12340000 tmpdir/powerpc-$abi-export-class-ref-r.o tmpdir/powerpc-$abi-export-class-lib.so" "" \ |
a521a329 MR |
88 | "$AFLAGS" \ |
89 | { ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \ | |
90 | [list \ | |
91 | [list readelf -r powerpc-$abi-export-class.rd] \ | |
92 | [list readelf "-x .data" powerpc-$abi-export-class.xd] \ | |
93 | ] \ | |
94 | "powerpc-$abi-export-class.so" \ | |
95 | ] \ | |
96 | ] | |
97 | } | |
98 | ||
99 | if { [supports_ppc64] } { | |
100 | set abis { 32 elf32ppclinux 64 elf64ppc } | |
101 | } else { | |
102 | set abis { 32 elf32ppclinux } | |
103 | } | |
104 | foreach { abi emul } $abis { | |
105 | powerpc_export_class_test $abi $emul | |
106 | } |