mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
d4cb0ea0ca
* ld-scripts/phdrs.exp: Expect to fail for the RX. * elf32-rx.c: Add support for PID mode. (rx_elf_relocate_section): Add checks for unsafe PID relocations. Include addend in R_RX_SYM relocations. * config/rx-defs.h (rx_pid_register): New. (rx_gp_register): New. * config/rx-parse.y (rx_lex): Add support for %gpreg and %pidreg. (displacement): Add PID support. * config/tc-rx.c (rx_pid_mode): New. (rx_num_int_regs): New. (rx_pid_register): New. (rx_gp_register): New. (options): Add -mpid and -mint-register= options. (md_longopts): Likewise. (md_parse_option): Likewise. (md_show_usage): Likewise. (rx_pid_symbol): New. (rx_pidreg_symbol): New. (rx_gpreg_symbol): New. (md_begin): Support PID. (rx_validate_fix_sub): Support PID. (tc_gen_reloc): Support PID. * doc/c-rx.texi: Document PID support. * rx.h (E_FLAG_RX_PID): New.
77 lines
3.0 KiB
Plaintext
77 lines
3.0 KiB
Plaintext
# Test PHDRS in a linker script.
|
|
# By Ian Lance Taylor, Cygnus Support.
|
|
# Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2006, 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.
|
|
|
|
# PHDRS is only meaningful for ELF.
|
|
if ![is_elf_format] {
|
|
return
|
|
}
|
|
|
|
# This is a very simplistic test.
|
|
|
|
set testname "PHDRS"
|
|
|
|
set ldopt ""
|
|
if { [istarget spu*-*-*] } {
|
|
set ldopt "--local-store 0:0"
|
|
}
|
|
|
|
if ![ld_assemble $as $srcdir/$subdir/phdrs.s tmpdir/phdrs.o] {
|
|
unresolved $testname
|
|
return
|
|
}
|
|
|
|
set phdrs_regexp \
|
|
".*Program Header:.*PHDR *off *0x00*34 *vaddr *0x00*800034 *paddr *0x00*800034.*filesz *0x0\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* flags r--.*LOAD *off *0x00* *vaddr *0x00*800000 *paddr *0x00*800000.*filesz *0x00*\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* *flags r-x.*LOAD *off *0x0\[0-9a-f\]* *vaddr *0x00*80*\[0-9a-f\]* *paddr *0x00*80*\[0-9a-f\]*.*filesz *0x0\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* *flags *rw-.*"
|
|
|
|
# On a 64 bit ELF format, we need different numbers.
|
|
if [is_elf64 tmpdir/phdrs.o] {
|
|
set phdrs_regexp \
|
|
".*Program Header:.*PHDR *off *0x00*40 *vaddr *0x00*800040 *paddr *0x00*800040.*filesz *0x0\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* flags r--.*LOAD *off *0x00* *vaddr *0x00*800000 *paddr *0x00*800000.*filesz *0x00*\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* *flags r-x.*LOAD *off *0x0\[0-9a-f\]* *vaddr *0x00*80*\[0-9a-f\]* *paddr *0x00*80*\[0-9a-f\]*.*filesz *0x0\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* *flags *rw-.*"
|
|
}
|
|
|
|
set ldopt "$ldopt -T $srcdir/$subdir/phdrs.t tmpdir/phdrs.o"
|
|
if ![ld_simple_link $ld tmpdir/phdrs $ldopt] {
|
|
fail $testname
|
|
} else {
|
|
if {![is_remote host] && [which $objdump] == 0} {
|
|
unresolved $testname
|
|
return
|
|
}
|
|
set exec_output [run_host_cmd "$objdump" "--private-headers tmpdir/phdrs"]
|
|
set exec_output [prune_warnings $exec_output]
|
|
verbose -log $exec_output
|
|
|
|
# The RX port sets the p_paddr of loadable segments to 0 in order
|
|
# to be compatible with Renesas tools. When an RX executable is
|
|
# loaded into a BFD based tool the code tries to reconstruct the
|
|
# correct vaddr and paddr values. This is not always possible
|
|
# however and this test is one example of where the reconstruction
|
|
# fails.
|
|
setup_xfail rx-*-*
|
|
|
|
if [regexp $phdrs_regexp $exec_output] {
|
|
pass $testname
|
|
} else {
|
|
fail $testname
|
|
}
|
|
}
|