1999-05-03 07:29:11 +00:00
|
|
|
# Test NOCROSSREFS in a linker script.
|
|
|
|
# By Ian Lance Taylor, Cygnus Support.
|
2007-07-06 14:09:45 +00:00
|
|
|
# Copyright 2000, 2001, 2002, 2003, 2004, 2007
|
2001-03-13 06:14:29 +00:00
|
|
|
# Free Software Foundation, Inc.
|
|
|
|
#
|
2007-07-06 14:09:45 +00:00
|
|
|
# This file is part of the GNU Binutils.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
2001-03-13 06:14:29 +00:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-07-06 14:09:45 +00:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
2001-03-13 06:14:29 +00:00
|
|
|
# (at your option) any later version.
|
2007-07-06 14:09:45 +00:00
|
|
|
#
|
2001-03-13 06:14:29 +00:00
|
|
|
# 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.
|
2007-07-06 14:09:45 +00:00
|
|
|
#
|
2001-03-13 06:14:29 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
2007-07-06 14:09:45 +00:00
|
|
|
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
# MA 02110-1301, USA.
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
set test1 "NOCROSSREFS 1"
|
|
|
|
set test2 "NOCROSSREFS 2"
|
2005-10-04 19:54:08 +00:00
|
|
|
set test3 "NOCROSSREFS 3"
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2007-08-28 13:21:58 +00:00
|
|
|
if { ![is_remote host] && [which $CC] == 0 } {
|
1999-05-03 07:29:11 +00:00
|
|
|
untested $test1
|
|
|
|
untested $test2
|
2005-10-04 19:54:08 +00:00
|
|
|
untested $test3
|
1999-05-03 07:29:11 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2003-04-01 15:50:31 +00:00
|
|
|
# Xtensa targets currently default to putting literal values in a separate
|
|
|
|
# section and that requires linker script support, so put literals in text.
|
|
|
|
global CFLAGS
|
|
|
|
if [istarget xtensa*-*-*] {
|
|
|
|
set CFLAGS "$CFLAGS -mtext-section-literals"
|
|
|
|
}
|
|
|
|
|
2005-10-18 02:25:42 +00:00
|
|
|
# If we have a compiler that doesn't use/reference dot-symbols, then
|
|
|
|
# calls to functions reference the .opd section function descriptor.
|
|
|
|
# This makes NOCROSSREFS rather useless on powerpc64.
|
|
|
|
if [istarget powerpc64*-*-*] {
|
|
|
|
set CFLAGS "$CFLAGS -mcall-aixdesc"
|
|
|
|
}
|
|
|
|
|
2007-09-19 09:22:07 +00:00
|
|
|
# Prevent the use of the MeP's small data area which references a symbol
|
|
|
|
# called __sdabase which will not be defined by our test linker scripts.
|
|
|
|
if [istarget mep*-*-elf] {
|
|
|
|
set CFLAGS "-mtiny=0"
|
|
|
|
}
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
if { ![ld_compile $CC "$srcdir/$subdir/cross1.c" tmpdir/cross1.o] \
|
|
|
|
|| ![ld_compile $CC "$srcdir/$subdir/cross2.c" tmpdir/cross2.o] } {
|
|
|
|
unresolved $test1
|
|
|
|
unresolved $test2
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2001-03-01 19:13:27 +00:00
|
|
|
set flags [big_or_little_endian]
|
1999-05-03 07:29:11 +00:00
|
|
|
|
Contribute sh64-elf.
2002-02-02 Alexandre Oliva <aoliva@redhat.com>
* ld-sh/sh64/crange3-cmpct.rd: Adjust offsets.
* ld-sh/sh64/crange3-media.rd: Likewise.
* ld-sh/sh64/crange3.rd: Likewise.
* ld-sh/sh64/crangerel1.rd: Likewise.
* ld-sh/sh64/crangerel2.rd: Likewise.
* ld-sh/sh64/reldl32.rd: Likewise.
* ld-sh/sh64/reldl64.rd: Likewise.
2002-01-28 Alexandre Oliva <aoliva@redhat.com>
* ld-sh/sh64/abi32.xd: Formatting changes to match the current
output of objdump.
* ld-sh/sh64/cmpct1.xd: Likewise.
* ld-sh/sh64/crange1.rd: Likewise.
* ld-sh/sh64/crange2.rd: Likewise.
* ld-sh/sh64/crange3-cmpct.rd: Likewise.
* ld-sh/sh64/crange3-media.rd: Likewise.
* ld-sh/sh64/crange3.rd: Likewise.
* ld-sh/sh64/crangerel1.rd: Likewise.
* ld-sh/sh64/crangerel2.rd: Likewise.
* ld-sh/sh64/mix1.xd: Likewise.
* ld-sh/sh64/mix2.xd: Likewise.
* ld-sh/sh64/rel32.xd: Likewise.
* ld-sh/sh64/reldl32.rd: Likewise.
* ld-sh/sh64/reldl64.rd: Likewise.
* ld-sh/sh64/sh64.exp: Likewise. Reordered cranges and stack
sessions, to match changes in the linker script.
2001-06-14 Alexandre Oliva <aoliva@redhat.com>
* ld-sh/sh64/reldl32.rd, ld-sh/sh64/reldl64.rd: Adjust relocation
info to reflect renumbering of relocation types.
2001-03-14 DJ Delorie <dj@redhat.com>
* ld-sh/sh64/endian.dbd: New file, endian tests.
* ld-sh/sh64/endian.dld: Ditto.
* ld-sh/sh64/endian.ld: Ditto.
* ld-sh/sh64/endian.s: Ditto.
* ld-sh/sh64/endian.sbd: Ditto.
* ld-sh/sh64/endian.sld: Ditto.
* ld-sh/sh64/sh64.exp: Add above tests. Add -L option to ld.
2001-03-12 DJ Delorie <dj@redhat.com>
* ld-sh/sh64/relax.exp: New file, test disabling relaxing.
* ld-sh/sh64/relax1.s: Ditto.
* ld-sh/sh64/relax2.s: Ditto.
* ld-sh/sh64/relax3.s: Ditto.
* ld-sh/sh64/relax4.s: Ditto.
* ld-sh/sh64/relfail.exp: New file, test for bogus relocs.
* ld-sh/sh64/relfail.s: Ditto.
2001-03-12 DJ Delorie <dj@redhat.com>
* ld-sh/sh.exp: This test isn't appropriate for SH64 since it
uses SH32 assembler files.
2001-03-07 DJ Delorie <dj@redhat.com>
* ld-selective/selective.exp: Pass "-e _start" for sh64 to
accomodate expected start symbol in test.
2001-03-06 DJ Delorie <dj@redhat.com>
* ld-scripts/crossref.exp: Pass -mshelf32 to the linker for sh64,
to match what gcc passes to the linker by default.
* ld-selective/selective.exp: Ditto.
* ld-srec/srec.exp: Ditto, plus XFAIL for sh64.
* ld-undefined/undefined.exp: Add XFAIL for sh64 (it's dwarf2).
2001-03-06 DJ Delorie <dj@redhat.com>
* ld-sh/sh64/abi32.xd (stack): Adjust for new default stack layout.
* ld-sh/sh64/abi64.xd (stack): Ditto.
* ld-sh/sh64/cmpct1.xd (stack): Ditto.
* ld-sh/sh64/crange1.rd (stack): Ditto.
* ld-sh/sh64/crange2.rd (stack): Ditto.
* ld-sh/sh64/crange3-cmpct.rd (stack): Ditto.
* ld-sh/sh64/crange3-media.rd (stack): Ditto.
* ld-sh/sh64/crange3.rd (stack): Ditto.
* ld-sh/sh64/mix1.xd (stack): Ditto.
* ld-sh/sh64/mix2.xd (stack): Ditto.
* ld-sh/sh64/shdl32.xd (stack): Ditto.
* ld-sh/sh64/shdl64.xd (stack): Ditto.
2001-01-14 Hans-Peter Nilsson <hpn@cygnus.com>
* ld-sh/sh64/mix1.xd: Add SORT_ENTRIES for .cranges section.
* ld-sh/sh64/mix2.xd: Ditto.
2001-01-08 Hans-Peter Nilsson <hpn@cygnus.com>
* ld-sh/sh64/abi32.xd: Adjust for bit 0 set on an entry address
being SHmedia.
* ld-sh/sh64/shdl64.xd: Ditto.
* ld-sh/sh64/shdl32.xd: Ditto.
* ld-sh/sh64/mix2.xd: Ditto.
* ld-sh/sh64/crange3-media.rd: Ditto.
* ld-sh/sh64/abi64.xd: Ditto.
2001-01-06 Hans-Peter Nilsson <hpn@cygnus.com>
* ld-sh/sh64/crange-2a.s (diversion2): New global symbol.
* ld-sh/sh64/crange1.rd: Adjust to presence of new symbol.
Adjust section type for .cranges; expect sorted contents.
* ld-sh/sh64/crange2.rd: Ditto.
* ld-sh/sh64/crange3.dd, ld-sh/sh64/crange3.rd: Ditto.
* ld-sh/sh64/crangerel1.rd: Adjust to presence of new symbol.
* ld-sh/sh64/crangerel2.rd: Ditto.
* ld-sh/sh64/mix1.xd: Adjust to DEBUGGING being set for .cranges.
* ld-sh/sh64/mix2.xd: Ditto.
* ld-sh/sh64/crange3-cmpct.rd, ld-sh/sh64/crange3-media.rd: New
tests.
* ld-sh/sh64/sh64.exp: Tweak test message. Run new tests.
2001-01-05 Hans-Peter Nilsson <hpn@cygnus.com>
* ld-sh/sh64/shmix-1.s (start2): Add a NOP to provide a valid
target for (unexpanded) PTB. Add an .align 2 to SHmedia code to
keep properly aligned.
* ld-sh/sh64/mix1.sd, ld-sh/sh64/mix1.xd: Adjust accordingly.
* ld-sh/sh64/mix1-noexp.sd, ld-sh/sh64/mix2-noexp.sd,
ld-sh/sh64/abixx-noexp.sd: New tests for GAS -no-expand and
R_SH_PT_16 relocation.
* ld-sh/sh64/sh64.exp: Run new tests.
2000-12-30 Hans-Peter Nilsson <hpn@cygnus.com>
* ld-sh/sh64/crange-2f.s, ld-sh/sh64/crange-2g.s,
ld-sh/sh64/crange-2h.s, ld-sh/sh64/crange-2i.s,
ld-sh/sh64/crange3.dd, ld-sh/sh64/crange3.rd: New tests.
* ld-sh/sh64/sh64.exp: Run new tests.
* ld-sh/sh64/crange1.rd: Correct section flags.
* ld-sh/sh64/crange2.rd: Ditto.
* ld-sh/sh64/crangerel1.rd: Ditto.
2000-12-18 Hans-Peter Nilsson <hpn@cygnus.com>
* ld-sh/sh64/crange-1.s, ld-sh/sh64/crange-2a.s,
ld-sh/sh64/crange-2b.s, ld-sh/sh64/crange-2c.s,
ld-sh/sh64/crange-2d.s, ld-sh/sh64/crange-2e.s,
ld-sh/sh64/crange1.rd, ld-sh/sh64/crange2.rd,
ld-sh/sh64/crangerel1.rd, ld-sh/sh64/crangerel2.rd: New tests for
handling .cranges section.
* ld-sh/sh64/sh64.exp: Run new tests.
* ld-sh/sh64/mix1.sd, ld-sh/sh64/mix1.xd, ld-sh/sh64/mix2.sd,
ld-sh/sh64/mix2.xd: Adjust for .cranges section.
2000-12-15 Hans-Peter Nilsson <hpn@cygnus.com>
* ld-sh/sh64/abi32.sd, ld-sh/sh64/abi32.xd, ld-sh/sh64/abi64.sd,
ld-sh/sh64/abi64.xd, ld-sh/sh64/cmpct1.xd, ld-sh/sh64/mix1.sd,
ld-sh/sh64/mix1.xd, ld-sh/sh64/mix2.sd, ld-sh/sh64/mix2.xd,
ld-sh/sh64/shdl32.xd, ld-sh/sh64/shdl64.xd: Adjust to .bss and
.data individually 8-byte aligned.
2000-12-09 Hans-Peter Nilsson <hpn@cygnus.com>
* ld-sh/sh64/rel-1.s, ld-sh/sh64/rel-2.s, ld-sh/sh64/rel32.xd,
ld-sh/sh64/rel64.xd, ld-sh/sh64/reldl-1.s, ld-sh/sh64/reldl-2.s,
ld-sh/sh64/reldl32.rd, ld-sh/sh64/reldl64.rd: New tests.
* ld-sh/sh64/sh64.exp: Make it possible to use readelf as
inspection tool. Run new tests.
2000-12-07 Hans-Peter Nilsson <hpn@cygnus.com>
* ld-sh/sh64/abi64.sd, ld-sh/sh64/abi32.sd, ld-sh/sh64/mix1.sd,
ld-sh/sh64/mix2.sd: Correct offsets in PT/PTA/PTB expansions.
* ld-sh/sh64/shdl-1.s, ld-sh/sh64/shdl-2.s, ld-sh/sh64/shdl64.sd,
ld-sh/sh64/shdl64.xd, ld-sh/sh64/shdl32.xd: New tests.
* ld-sh/sh64/sh64.exp: Run new tests.
2000-12-01 Hans-Peter Nilsson <hpn@cygnus.com>
* ld-sh/sh64/cmpct1.sd, ld-sh/sh64/cmpct1.xd,
ld-sh/sh64/shcmp-1.s: New test.
* ld-sh/sh64/sh64.exp: Add new test to sh64tests. Reformat.
2000-11-30 Hans-Peter Nilsson <hpn@cygnus.com>
* ld-sh/sh64/sh64.exp: Use linker option -mshelf64 for 64-bit ABI
test.
* ld-sh/sh64/abi64.xd: Tweak for 64-bit ELF.
2000-11-29 Hans-Peter Nilsson <hpn@cygnus.com>
* ld-sh/sh64/sh64.exp (sh64tests): Use linker option -mshelf32 for
tests.
2000-11-27 Hans-Peter Nilsson <hpn@cygnus.com>
* ld-sh/sh64/abi32.sd, ld-sh/sh64/abi64.sd: Correct MOVI
registers.
* ld-sh/sh64/mix1.sd, ld-sh/sh64/mix1.xd, ld-sh/sh64/shmix-1.s:
New test.
* ld-sh/sh64/mix2.sd, ld-sh/sh64/mix2.xd, ld-sh/sh64/shmix-2.s,
ld-sh/sh64/shmix-3.s: New test.
* ld-sh/sh64/sh64.exp: Add new tests to sh64tests.
2000-11-26 Hans-Peter Nilsson <hpn@cygnus.com>
* ld-sh/sh64: New testsuite.
2002-02-08 06:50:02 +00:00
|
|
|
if [istarget sh64*-*-elf] {
|
|
|
|
# This is what gcc passes to ld by default.
|
|
|
|
set flags "-mshelf32"
|
|
|
|
}
|
|
|
|
|
2004-07-22 14:19:04 +00:00
|
|
|
# IA64 has both ordered and unordered sections in an input file.
|
|
|
|
setup_xfail ia64-*-*
|
|
|
|
|
2007-08-28 13:21:58 +00:00
|
|
|
set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o"]
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
set exec_output [prune_warnings $exec_output]
|
|
|
|
|
|
|
|
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
|
|
|
|
|
|
|
|
if [string match "" $exec_output] then {
|
|
|
|
fail $test1
|
|
|
|
} else {
|
|
|
|
verbose -log "$exec_output"
|
2002-01-31 03:57:52 +00:00
|
|
|
if [regexp "prohibited cross reference from .* to `.*foo' in" $exec_output] {
|
1999-05-03 07:29:11 +00:00
|
|
|
pass $test1
|
|
|
|
} else {
|
|
|
|
fail $test1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Check cross references within a single object.
|
|
|
|
|
|
|
|
if { ![ld_compile $CC "$srcdir/$subdir/cross3.c" tmpdir/cross3.o] } {
|
|
|
|
unresolved $test2
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2007-08-28 13:21:58 +00:00
|
|
|
set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o"]
|
1999-05-03 07:29:11 +00:00
|
|
|
set exec_output [prune_warnings $exec_output]
|
|
|
|
|
|
|
|
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
|
|
|
|
|
|
|
|
if [string match "" $exec_output] then {
|
|
|
|
fail $test2
|
|
|
|
} else {
|
|
|
|
verbose -log "$exec_output"
|
|
|
|
if [regexp "prohibited cross reference from .* to `.*' in" $exec_output] {
|
|
|
|
pass $test2
|
|
|
|
} else {
|
|
|
|
fail $test2
|
|
|
|
}
|
|
|
|
}
|
2005-10-04 19:54:08 +00:00
|
|
|
|
|
|
|
# Check cross references for ld -r
|
|
|
|
|
|
|
|
if { ![ld_compile $CC "$srcdir/$subdir/cross4.c" tmpdir/cross4.o] } {
|
|
|
|
unresolved $test3
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![ld_relocate $ld tmpdir/cross3-partial.o "tmpdir/cross1.o tmpdir/cross4.o"] {
|
|
|
|
unresolved $test3
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2007-08-28 13:21:58 +00:00
|
|
|
set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross3 -T $srcdir/$subdir/cross3.t tmpdir/cross3-partial.o tmpdir/cross2.o"]
|
2005-10-04 19:54:08 +00:00
|
|
|
|
|
|
|
set exec_output [prune_warnings $exec_output]
|
|
|
|
|
|
|
|
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
|
|
|
|
|
|
|
|
if [string match "" $exec_output] then {
|
|
|
|
pass $test3
|
|
|
|
} else {
|
|
|
|
verbose -log "$exec_output"
|
|
|
|
fail $test3
|
|
|
|
}
|