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