897aea504d
its contents to ar_simple_create and ld_simple_link after objfiles. * ld-aarch64/aarch64-elf.exp: Adjust accordingly. * ld-alpha/alpha.exp: Likewise. * ld-arm/arm-elf.exp: Likewise. * ld-arm/export-class.exp: Likewise. * ld-elf/comm-data.exp: Likewise. * ld-elf/eh-group.exp: Likewise. * ld-elf/elf.exp: Likewise. * ld-elf/export-class.exp: Likewise. * ld-elfvers/vers.exp: Likewise. * ld-frv/tls.exp: Likewise. * ld-i386/export-class.exp: Likewise. * ld-i386/i386.exp: Likewise. * ld-ia64/ia64.exp: Likewise. * ld-libs/libs.exp: Likewise. * ld-m68k/m68k.exp: Likewise. * ld-metag/metag.exp: Likewise. * ld-mips-elf/comm-data.exp: Likewise. * ld-mips-elf/export-class.exp: Likewise. * ld-mips-elf/mips-elf.exp: Likewise. * ld-mn10300/mn10300.exp: Likewise. * ld-pe/pe-compile.exp: Likewise. * ld-pe/pe.exp: Likewise. * ld-plugin/plugin.exp: Likewise. * ld-powerpc/aix52.exp: Likewise. * ld-powerpc/export-class.exp: Likewise. * ld-powerpc/powerpc.exp: Likewise. * ld-s390/s390.exp: Likewise. * ld-sh/sh-vxworks.exp: Likewise. * ld-sh/sh64/sh64.exp: Likewise. * ld-sparc/sparc.exp: Likewise. * ld-tic6x/tic6x.exp: Likewise. * ld-tilegx/tilegx.exp: Likewise. * ld-tilepro/tilepro.exp: Likewise. * ld-undefined/entry.exp: Likewise. * ld-vax-elf/vax-elf.exp: Likewise. * ld-x86-64/dwarfreloc.exp: Likewise. * ld-x86-64/export-class.exp: Likewise. * ld-x86-64/x86-64.exp: Likewise. * ld-xc16x/xc16x.exp: Likewise. * ld-xstormy16/xstormy16.exp: Likewise. * ld-xtensa/xtensa.exp: Likewise.
201 lines
8.2 KiB
Text
201 lines
8.2 KiB
Text
# Expect script for ld-tic6x tests
|
|
#
|
|
# Copyright 2012 Free Software Foundation, Inc.
|
|
#
|
|
# This file is part of the GNU Binutils.
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
# MA 02110-1301, USA.
|
|
|
|
if { ! [istarget tic6x-*-*] } {
|
|
return
|
|
}
|
|
|
|
foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.d]] {
|
|
if { [runtest_file_p $runtests $test] } {
|
|
run_dump_test [file rootname $test]
|
|
}
|
|
}
|
|
|
|
set shlibtests {
|
|
{"C6X shared library without --dsbt-index"
|
|
"-shared -Tdsbt.ld --dsbt-size=3" ""
|
|
"-mdsbt -mpic -mpid=near" {shlib-1.s shlib-2.s}
|
|
{{readelf -WSsrld shlib-noindex.rd}
|
|
{objdump "-drj.plt -j.text" shlib-noindex.dd}
|
|
{objdump -sj.got shlib-noindex.sd}}
|
|
"libtestn.so"}
|
|
{"C6X shared library, LE, RELA"
|
|
"-shared -Tdsbt.ld --dsbt-index=2 --dsbt-size=3" ""
|
|
"-mdsbt -mpic -mpid=near" {shlib-1.s shlib-2.s}
|
|
{{readelf -WSsrld shlib-1.rd}
|
|
{objdump "-drj.plt -j.text" shlib-1.dd}
|
|
{objdump -sj.got shlib-1.sd}}
|
|
"libtest.so"}
|
|
{"C6X nonstatic app using shared library, LE, RELA"
|
|
"-Tdsbt.ld --dsbt-index 0 --dsbt-size=3 tmpdir/libtest.so" ""
|
|
"-mdsbt -mpic -mpid=near" {shlib-app-1.s}
|
|
{{readelf -WSsrld shlib-app-1.rd}
|
|
{objdump "-drj.plt -j.text" shlib-app-1.dd}
|
|
{objdump -sj.got shlib-app-1.sd}
|
|
{objdump -R shlib-app-1.od}}
|
|
"shlib-dynapp-1"}
|
|
{"C6X shared library, LE, REL"
|
|
"-shared -Tdsbt.ld --dsbt-index=2 --dsbt-size=3" ""
|
|
"-mdsbt -mpic -mpid=near -mgenerate-rel" {shlib-1.s shlib-2.s}
|
|
{{readelf -WSsrld shlib-1r.rd}
|
|
{objdump "-drj.plt -j.text" shlib-1r.dd}
|
|
{objdump -sj.got shlib-1r.sd}}
|
|
"libtestr.so"}
|
|
{"C6X nonstatic app using shared library, LE, REL"
|
|
"-Tdsbt.ld --dsbt-index 0 --dsbt-size=3 tmpdir/libtestr.so" ""
|
|
"-mdsbt -mpic -mpid=near -mgenerate-rel" {shlib-app-1r.s}
|
|
{{readelf -WSsrld shlib-app-1r.rd}
|
|
{objdump "-drj.plt -j.text" shlib-app-1r.dd}
|
|
{objdump -sj.got shlib-app-1r.sd}
|
|
{objdump -R shlib-app-1r.od}}
|
|
"shlib-dynapp-1r"}
|
|
{"C6X shared library, BE, RELA"
|
|
"-shared -Tdsbt-be.ld --dsbt-index=2 --dsbt-size=3" ""
|
|
"-mdsbt -mpic -mpid=near -mbig-endian" {shlib-1.s shlib-2.s}
|
|
{{readelf -WSsrld shlib-1b.rd}
|
|
{objdump "-drj.plt -j.text" shlib-1b.dd}
|
|
{objdump -sj.got shlib-1b.sd}}
|
|
"libtestb.so"}
|
|
{"C6X nonstatic app using shared library, BE, RELA"
|
|
"-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3 tmpdir/libtestb.so" ""
|
|
"-mdsbt -mpic -mpid=near -mbig-endian" {shlib-app-1.s}
|
|
{{readelf -WSsrld shlib-app-1b.rd}
|
|
{objdump "-drj.plt -j.text" shlib-app-1b.dd}
|
|
{objdump -sj.got shlib-app-1b.sd}
|
|
{objdump -R shlib-app-1b.od}}
|
|
"shlib-dynapp-1b"}
|
|
{"C6X shared library, BE, REL"
|
|
"-shared -Tdsbt-be.ld --dsbt-index=2 --dsbt-size=3" ""
|
|
"-mdsbt -mpic -mpid=near -mgenerate-rel -mbig-endian" {shlib-1.s shlib-2.s}
|
|
{{readelf -WSsrld shlib-1rb.rd}
|
|
{objdump "-drj.plt -j.text" shlib-1rb.dd}
|
|
{objdump -sj.got shlib-1rb.sd}}
|
|
"libtestrb.so"}
|
|
{"C6X nonstatic app using shared library, BE, REL"
|
|
"-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3 tmpdir/libtestrb.so" ""
|
|
"-mdsbt -mpic -mpid=near -mgenerate-rel -mbig-endian" {shlib-app-1r.s}
|
|
{{readelf -WSsrld shlib-app-1rb.rd}
|
|
{objdump "-drj.plt -j.text" shlib-app-1rb.dd}
|
|
{objdump -sj.got shlib-app-1rb.sd}
|
|
{objdump -R shlib-app-1rb.od}}
|
|
"shlib-dynapp-1rb"}
|
|
|
|
{"C6X static app, LE, RELA"
|
|
"-Tdsbt.ld --dsbt-index 0 --dsbt-size=3" ""
|
|
"-mdsbt -mpic -mpid=near" {shlib-1.s shlib-2.s shlib-app-1.s}
|
|
{{readelf -WSsrld static-app-1.rd}
|
|
{objdump "-drj.plt -j.text" static-app-1.dd}
|
|
{objdump -sj.got static-app-1.sd}
|
|
{objdump -R static-app-1.od}}
|
|
"static-app-1"}
|
|
{"C6X static app, LE, REL"
|
|
"-Tdsbt.ld --dsbt-index 0 --dsbt-size=3" ""
|
|
"-mdsbt -mpic -mpid=near -mgenerate-rel" {shlib-1.s shlib-2.s shlib-app-1r.s}
|
|
{{readelf -WSsrld static-app-1r.rd}
|
|
{objdump "-drj.plt -j.text" static-app-1r.dd}
|
|
{objdump -sj.got static-app-1r.sd}
|
|
{objdump -R static-app-1r.od}}
|
|
"static-app-1r"}
|
|
{"C6X static app, BE, RELA"
|
|
"-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3" ""
|
|
"-mdsbt -mpic -mpid=near -mbig-endian" {shlib-1.s shlib-2.s shlib-app-1.s}
|
|
{{readelf -WSsrld static-app-1b.rd}
|
|
{objdump "-drj.plt -j.text" static-app-1b.dd}
|
|
{objdump -sj.got static-app-1b.sd}
|
|
{objdump -R static-app-1b.od}}
|
|
"static-app-1b"}
|
|
{"C6X static app, BE, REL"
|
|
"-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3" ""
|
|
"-mdsbt -mpic -mpid=near -mbig-endian -mgenerate-rel" {shlib-1.s shlib-2.s shlib-app-1r.s}
|
|
{{readelf -WSsrld static-app-1rb.rd}
|
|
{objdump "-drj.plt -j.text" static-app-1rb.dd}
|
|
{objdump -sj.got static-app-1rb.sd}
|
|
{objdump -R static-app-1rb.od}}
|
|
"static-app-1rb"}
|
|
}
|
|
|
|
run_ld_link_tests $shlibtests
|
|
|
|
if { [istarget tic6x-*-elf] } {
|
|
set expected_osabi "Bare-metal C6000"
|
|
} elseif { [istarget tic6x-*-uclinux] } {
|
|
set expected_osabi "Linux C6000"
|
|
} else {
|
|
return
|
|
}
|
|
|
|
if { ![ld_assemble_flags $as "-mpic -mpid=near" $srcdir/$subdir/shlib-1.s tmpdir/shlib-1.o]
|
|
|| ![ld_assemble_flags $as "-mpic -mpid=near" $srcdir/$subdir/shlib-2.s tmpdir/shlib-2.o]
|
|
|| ![ld_assemble $as $srcdir/$subdir/shlib-app-1.s tmpdir/shlib-app-1.o]
|
|
|| ![ld_assemble_flags $as "-mpic -mpid=near -mbig-endian" $srcdir/$subdir/shlib-1.s tmpdir/shlib-1b.o]
|
|
|| ![ld_assemble_flags $as "-mpic -mpid=near -mbig-endian" $srcdir/$subdir/shlib-2.s tmpdir/shlib-2b.o]
|
|
|| ![ld_assemble_flags $as -mbig-endian $srcdir/$subdir/shlib-app-1.s tmpdir/shlib-app-1b.o]
|
|
|| ![ld_simple_link $ld tmpdir/libtest.so "-shared tmpdir/shlib-1.o tmpdir/shlib-2.o"]
|
|
|| ![ld_simple_link $ld tmpdir/libtestb.so "-shared -EB tmpdir/shlib-1b.o tmpdir/shlib-2b.o"]
|
|
|| ![ld_simple_link $ld tmpdir/shlib.o "-r tmpdir/shlib-1.o tmpdir/shlib-2.o"]
|
|
|| ![ld_simple_link $ld tmpdir/shlibb.o "-r -EB tmpdir/shlib-1b.o tmpdir/shlib-2b.o"]
|
|
|| ![ld_simple_link $ld tmpdir/dynapp-1 "tmpdir/libtest.so tmpdir/shlib-app-1.o"]
|
|
|| ![ld_simple_link $ld tmpdir/dynapp-1b "-EB tmpdir/libtestb.so tmpdir/shlib-app-1b.o"] } {
|
|
unresolved "TIC6X OSABI tests"
|
|
return
|
|
}
|
|
|
|
# A procedure to check the OS/ABI field in the ELF header of a binary file.
|
|
proc check_osabi_tic6x { test_name binary_file } {
|
|
global READELF
|
|
global READELFFLAGS
|
|
global expected_osabi
|
|
|
|
set cmd "$READELF $READELFFLAGS --file-header $binary_file"
|
|
send_log "$cmd\n"
|
|
set got [remote_exec host [concat sh -c [list "$cmd >dump.out"]] "" "/dev/null"]
|
|
|
|
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
|
|
send_log "$got\n"
|
|
unresolved "$test_name"
|
|
remote_file build delete "dump.out"
|
|
return
|
|
}
|
|
remote_upload host "dump.out"
|
|
|
|
if { ![regexp "\n\[ \]*OS/ABI:\[ \]*(.+)\n\[ \]*ABI" \
|
|
[file_contents dump.out] nil osabi] } {
|
|
verbose "proc check_osabi_tic6x: Readelf failed to extract an ELF header from $binary_file"
|
|
unresolved "$test_name"
|
|
} elseif { $osabi == $expected_osabi } {
|
|
pass "$test_name"
|
|
} else {
|
|
verbose "Expected OSABI: $expected_osabi, Obtained osabi: $osabi"
|
|
fail "$test_name"
|
|
}
|
|
remote_file build delete "dump.out"
|
|
remote_file host delete "dump.out"
|
|
}
|
|
|
|
check_osabi_tic6x "C6X shared library OSABI, LE" tmpdir/libtest.so
|
|
check_osabi_tic6x "C6X shared library OSABI, BE" tmpdir/libtestb.so
|
|
check_osabi_tic6x "C6X dynamic app OSABI, LE" tmpdir/dynapp-1
|
|
check_osabi_tic6x "C6X dynamic app OSABI, BE" tmpdir/dynapp-1b
|
|
|
|
set expected_osabi "UNIX - System V"
|
|
|
|
check_osabi_tic6x "C6X relocatable link OSABI, LE" tmpdir/shlib.o
|
|
check_osabi_tic6x "C6X relocatable link OSABI, BE" tmpdir/shlibb.o
|