OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-stable/binutils-2.20.1/ld/testsuite/ld-undefined
    from Rev 816 to Rev 818
    Reverse comparison

Rev 816 → Rev 818

/entry-1.d
0,0 → 1,8
#name: --entry foo archive
#source: dummy.s
#ld: --entry foo tmpdir/libentry.a
#nm: -n
 
#...
[0-9a-f]+ T +foo
#...
/weak-undef.exp
0,0 → 1,83
# Test handling of weak undefined symbols
# Copyright 2001, 2002, 2004, 2005, 2007
# 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.
 
set testname "weak undefined symbols"
 
# This test only works for ELF targets. It ought to work for some
# a.out targets, but it doesn't.
 
if { ![istarget *-*-sysv4*] \
&& ![istarget *-*-unixware*] \
&& ![istarget *-*-elf*] \
&& ![istarget *-*-eabi*] \
&& ![istarget hppa*64*-*-hpux*] \
&& ![istarget *-*-linux*] \
&& ![istarget *-*-irix5*] \
&& ![istarget *-*-irix6*] \
&& ![is_pecoff_format] \
&& ![istarget *-*-solaris2*] } then {
unsupported $testname
return
}
 
if { [istarget *-*-linux*aout*] \
|| [istarget *-*-linux*oldld*] } {
unsupported $testname
return
}
 
# Weak symbols are broken for non-i386 PE targets.
if {! [istarget i?86-*-*]} {
setup_xfail *-*-pe*
}
 
setup_xfail hppa64-*-* pj-*-*
 
if {! [ld_assemble $as $srcdir/$subdir/weak-undef.s tmpdir/weak-undef.o]} then {
# It's OK if .weak doesn't work on this target.
unresolved $testname
return
}
 
# The linker should accept references to undefined weaks without error,
# and resolve them to zero.
 
set output_regexp \
".*Contents of section .data:.*0000 00000000 11111111.*"
 
if {! [ld_simple_link $ld tmpdir/weak-undef "$flags tmpdir/weak-undef.o -T $srcdir/$subdir/weak-undef.t"] } then {
fail $testname
} else {
if {![is_remote host] && [which $objdump] == 0} then {
unresolved $testname
return
}
 
set exec_output [run_host_cmd "$objdump" "-s tmpdir/weak-undef"]
set exec_output [prune_warnings $exec_output]
verbose -log $exec_output
 
if {[regexp $output_regexp $exec_output]} then {
pass $testname
} else {
fail $testname
}
}
/entry-2.d
0,0 → 1,8
#name: --entry foo -u foo archive
#source: dummy.s
#ld: --entry foo -u foo tmpdir/libentry.a
#nm: -n
 
#...
[0-9a-f]+ T +foo
#...
/entry.s
0,0 → 1,4
.text
.globl foo
foo:
.byte 0
/undefined.c
0,0 → 1,10
/* This file is used to test the linker's reporting of undefined
symbols. */
 
extern int this_function_is_not_defined ();
 
int
function ()
{
return this_function_is_not_defined ();
}
/entry-3.d
0,0 → 1,9
#name: -shared --entry foo archive
#source: dummy.s
#ld: -shared --entry foo tmpdir/libentry.a
#nm: -n
#target: *-*-linux*
 
#...
[0-9a-f]+ T +foo
#...
/entry-4.d
0,0 → 1,9
#name: -shared --entry foo -u foo archive
#source: dummy.s
#ld: -shared --entry foo -u foo tmpdir/libentry.a
#nm: -n
#target: *-*-linux*
 
#...
[0-9a-f]+ T +foo
#...
/entry-5.d
0,0 → 1,8
#name: --entry foo
#source: entry.s
#ld: --entry foo
#nm: -n
 
#...
[0-9a-f]+ T +foo
#...
/entry-6.d
0,0 → 1,8
#name: --entry foo -u foo
#source: entry.s
#ld: --entry foo -u foo
#nm: -n
 
#...
[0-9a-f]+ T +foo
#...
/weak-undef.s
0,0 → 1,4
.data
.weak foo
.long foo
.long 0x11111111
/weak-undef.t
0,0 → 1,9
SECTIONS
{
.data : {
tmpdir/weak-undef.o(.data)
}
/DISCARD/ : {
*(*)
}
}
/dummy.s
0,0 → 1,2
.text
.byte 0
/entry.exp
0,0 → 1,35
# Expect script for ld --entry tests
# Copyright (C) 2009 Free Software Foundation
#
# 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.
#
 
set build_tests {
{"Build libentry.a"
"" ""
{entry.s} {} "libentry.a"}
}
 
run_ld_link_tests $build_tests
 
set test_list [lsort [glob -nocomplain $srcdir/$subdir/entry*.d]]
foreach t $test_list {
# We need to strip the ".d", but can leave the dirname.
verbose [file rootname $t]
run_dump_test [file rootname $t]
}
/undefined.exp
0,0 → 1,144
# Test that the linker reports undefined symbol errors correctly.
# By Ian Lance Taylor, Cygnus Support
#
# Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2007, 2008 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.
 
set testund "undefined"
set testfn "undefined function"
set testline "undefined line"
 
if { ![is_remote host] && [which $CC] == 0 } {
verbose "Could not find C compiler!" 1
untested $testund
untested $testfn
untested $testline
return
}
 
if ![ld_compile "$CC -g" $srcdir/$subdir/undefined.c tmpdir/undefined.o] {
verbose "Unable to compile test file!" 1
unresolved $testund
unresolved $testfn
unresolved $testline
return
}
 
remote_file host delete "tmpdir/undefined"
 
set flags [big_or_little_endian]
 
# Using -e start prevents the SunOS linker from trying to build a
# shared library.
send_log "$ld -e start $flags -o tmpdir/undefined tmpdir/undefined.o\n"
set exec_output [run_host_cmd "$ld" "-e start $flags -o tmpdir/undefined tmpdir/undefined.o"]
 
send_log "$exec_output\n"
verbose "$exec_output"
 
proc checkund { string testname } {
global exec_output
 
if [string match "*$string*" $exec_output] {
pass $testname
} else {
fail $testname
}
}
 
set mu "undefined reference to `*this_function_is_not_defined'"
checkund $mu $testund
 
# ARM PE defaults to using stabs debugging, which we can't handle for
# a COFF file.
#setup_xfail "arm*-*-pe*"
#setup_xfail "thumb*-*-pe*"
 
# For Xtensa on GNU Linux systems (or any other system where PIC code is
# always used), the address of the undefined function is in a literal pool
# outside the function, so that both the "undefined function" and "undefined
# line" tests fail.
setup_xfail xtensa*-*-linux*
 
set mf "tmpdir/undefined.o* In function `function':"
checkund $mf $testfn
 
if ![is_elf_format] {
# COFF SH gets this test wrong--it reports line 10, because although
# the jump is at line 9, the function address, and the reloc, is
# stored at the end of the function.
setup_xfail "sh-*-*"
 
# ARM PE defaults to using stabs debugging, which we can't handle for
# a COFF file.
#setup_xfail "arm*-*-pe*"
#setup_xfail "thumb*-*-pe*"
}
 
set ml "undefined.c:9: undefined reference to `*this_function_is_not_defined'"
# With targets that use elf/dwarf2, such as the arm-elf and thumb-elf
# toolchains, the code in bfd/elf.c:_bfd_elf_find_nearest_line() is called
# in order to locate the file name/line number where the undefined
# reference occurs. Unfortunately this tries to use the dwarf2 debug
# information held in the .debug_info section. This section contains a series
# of comp_unit structures, each of which has a low/high address range
# representing the span of memory locations covered by that structure. The
# structures also index into other structures held in the .debug_line section
# and together they can translate memory locations back into file/function/line
# number addresses in the source code. Since the information about the memory
# region covered by a comp_unit is only determined at link time, the low/high
# addresses in the .debug_info section and the line addresses in the .debug_line
# section are computed by generating relocs against known symbols in the object
# code.
#
# When the undefined reference is detected, the relocs in the dwarf2
# debug sections have not yet been resolved, so the low/high addresses and the
# line number address are all set at zero. Thus when _bfd_elf_find_nearest_line()
# calls _bfd_dwarf2_find_nearest_line() no comp_unit can be found which
# actually covers the address where the reference occured, and so
# _bfd_elf_find_nearest_line() fails.
#
# The upshot of all of this, is that the error message reported by the
# linker, instead of having a source file name & line number as in:
#
# undefined.c:9: undefined reference to `this_function_is_not_defined'
#
# has an object file & section address instead:
#
# undefined.0(.text+0xc): undefined reference to `this_function_is_not_defined'
#
# hence the xfails below.
 
setup_xfail mcore-*-elf
setup_xfail mep-*-*
setup_xfail mips-sgi-irix6*
setup_xfail "sh64-*-*"
 
# The undefined test fails on 31 bit s/390 because the address of the
# function `this_function_is_not_defined' is stored in the literal pool of
# the function. Therefore the line number in the error message is 8 instead
# of 9. On 64 bit s/390 this works because of the new brasl instruction that
# doesn't need a literal pool entry.
setup_xfail s390-*-*
 
# See comments above for Xtensa.
setup_xfail xtensa*-*-linux*
 
checkund $ml $testline

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.