old-cross-binutils/ld/testsuite/ld-undefined/undefined.exp
Nick Clifton 13761a1136 * archures.c: Add some more MSP430 machine numbers.
* config.bfd (msp430): Define targ_selvecs.
	* configure.in: Add bfd_elf32_msp430_ti_vec.
	* cpu-msp430.c: Add some more MSP430 machine numbers.
	* elf32-msp430.c Add support for MSP430X relocations.
	Add support for TI compiler generated relocations.
	Add support for sym_diff relocations.
	Add support for relaxing out of range short branches into long
	branches.
	Add support for MSP430 attribute section.
	* reloc.c: Add MSP430X relocations.
	* targets.c: Add bfd_elf32_msp430_ti_vec.
	* bfd-in2.h: Regenerate.
	* configure: Regenerate.
	* libbfd.h: Regenerate.

	* readelf.c: Add support for MSP430X architecture.

	* readelf.exp: Expect -wi test to fail for the MSP430.

	* config/tc-msp430.c: Add support for the MSP430X architecture.
	Add code to insert a NOP instruction after any instruction that
	might change the interrupt state.
	Add support for the LARGE memory model.
	Add code to initialise the .MSP430.attributes section.
	* config/tc-msp430.h: Add support for the MSP430X architecture.
	* doc/c-msp430.texi: Document the new -mL and -mN command line
	options.
	* NEWS: Mention support for the MSP430X architecture.

	* gas/all/gas.exp: Skip the DIFF1 test for the MSP430.
	Expect the FORWARD test to pass for the MSP430.
	Skip the REDEF tests for the MSP430.
	Expect the 930509A test to fail for the MSP430.
	* gas/all/sleb128-4.d: Skip for the MSP430.
	* gas/elf/elf.exp: Set target_machine to msp430 for the MSP430.
	Skip the EHOPT0 test for the MSP430.
	Skip the REDEF and EQU-RELOC tests for the MSP430.
	* gas/elf/section2.e-msp430: New file.
	* gas/lns/lns-big-delta.d: Remove expectation of 20-bit
	addresses.
	* gas/lns/lns.exp: Use alternate LNS COMMON test for the MSP430.
	* gas/msp430/msp430x.s: New test.
	* gas/msp430/msp430x.d: Expected disassembly.
	* gas/msp430/msp430.exp: Run new test.
	* gas/msp430/opcode.d: Update expected disassembly.

	* msp430.h: Add MSP430X relocs.
	Add some more MSP430 machine numbers.
	Add values used by .MSP430.attributes section.

	* msp430.h: Add patterns for MSP430X instructions.

	* Makefile.am: Add emsp430X.c
	* Makefine.in: Regenerate.
	* configure.tgt (msp430): Add msp430X emulation.
	* ldmain.c (multiple_definition): Only disable relaxation if it
	was enabled by the user.
	* ldmain.h (RELAXATION_ENABLED_BY_USER): New macro.
	* emulparams/msp430all.sh: Add support for MSP430X.
	* emultempl/generic.em: (before_parse): Enable relaxation for the
	MSP430.
	* scripttempl/msp430.sc: Reorganize sections.  Add .rodata
	section.
	* scripttempl/msp430_3.sc: Likewise.
	* NEWS: Mention support for MSP430X.

	* ld-elf/flags1.d: Expect this test to pass on the MSP430.
	* ld-elf/init-fini-arrays.d: Expect this test to fail on the
	MSP430.
	* ld-elf/merge.d: Expect this test to pass on the MSP430.
	* ld-elf/sec64k.exp: Skip these tests for the MSP430.
	* ld-gc/pr13683.d: Expect this test to fail on the MSP430.
	* ld-srec/srec.exp: Expect these tests to fail on the MSP430.
	* ld-undefined/undefined.exp: Expect the UNDEFINED LINE test to
	fail on the MSP430.

	* msp430-dis.c: Add support for MSP430X instructions.
2013-05-02 21:06:15 +00:00

148 lines
5.4 KiB
Text

# 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, 2010, 2011 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*"
# 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*"
}
set ml "undefined.c:9: undefined reference to `*this_function_is_not_defined'"
# With targets that use elf/dwarf2, such as the arm-elf
# toolchain, 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-*-*"
# Fails for the MSP430 because it uses SYM_DIFF relocs but it does
# not provide a special_function for handling them. If optimization
# is enabled then this test passes because function()'s prologue is
# eliminated.
setup_xfail "msp430-*-*"
# 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*
setup_xfail hppa*64*-*-*
checkund $ml $testline