* config/default.exp (get_link_files, get_target_emul): New procs;
run shell commands to extract information from configure.host and configure.tgt in the source tree. (top level): Use them to get information needed to run tests, if not otherwise provided. Should allow running of at least some of the tests by releng. * ld-shared/elf-offset.ld: New file. Builds a shared library, but gives non-zero addresses for memory region. * ld-shared/shared.exp: Run the non-PIC non-AIX test again using the new linker script. PR ld/17962 -- not fixed, but customer has what should be an adequate workaround.
This commit is contained in:
parent
4c49748e82
commit
687788cd4b
4 changed files with 126 additions and 18 deletions
|
@ -1,3 +1,21 @@
|
|||
1999-01-03 Ken Raeburn <raeburn@cygnus.com>
|
||||
|
||||
* config/default.exp (get_link_files, get_target_emul): New procs;
|
||||
run shell commands to extract information from configure.host and
|
||||
configure.tgt in the source tree.
|
||||
(top level): Use them to get information needed to run tests, if
|
||||
not otherwise provided.
|
||||
|
||||
* ld-shared/elf-offset.ld: New file. Builds a shared library, but
|
||||
gives non-zero addresses for memory region.
|
||||
* ld-shared/shared.exp: Run the non-PIC non-AIX test again using
|
||||
the new linker script.
|
||||
|
||||
Tue Dec 8 22:56:05 1998 Geoff Keating <geoffk@ozemail.com.au>
|
||||
|
||||
* ld-srec/srec.exp: Delete xfails for PPC Linux targets,
|
||||
newer glibc lets link succeed.
|
||||
|
||||
Sun Dec 6 12:59:37 1998 H.J. Lu <hjl@gnu.org>
|
||||
|
||||
* ld-elfvers/vers1.c: Add missing return types and values.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Basic expect script for LD Regression Tests
|
||||
# Copyright (C) 1993,1994 Free Software Foundation
|
||||
# Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -13,31 +13,83 @@
|
|||
#
|
||||
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# Written by Jeffrey Wheat (cassidy@cygnus.com)
|
||||
#
|
||||
|
||||
if ![info exists ld] then {
|
||||
set ld [findfile $objdir/ld.new $objdir/ld.new [transform ld]]
|
||||
set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]]
|
||||
}
|
||||
|
||||
if ![info exists as] then {
|
||||
set as [findfile $base_dir/../gas/as.new $base_dir/../gas/as.new [transform as]]
|
||||
set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]]
|
||||
}
|
||||
|
||||
if ![info exists nm] then {
|
||||
set nm [findfile $base_dir/../binutils/nm.new $base_dir/../binutils/nm.new [transform nm]]
|
||||
set nm [findfile $base_dir/../binutils/nm-new $base_dir/../binutils/nm-new [transform nm]]
|
||||
}
|
||||
|
||||
if ![info exists objdump] then {
|
||||
set objdump [findfile $base_dir/../binutils/objdump]
|
||||
}
|
||||
|
||||
if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status}
|
||||
if ![info exists objcopy] then {
|
||||
set objcopy [findfile $base_dir/../binutils/objcopy]
|
||||
}
|
||||
|
||||
if ![info exists ar] then {
|
||||
set ar [findfile $base_dir/../binutils/ar]
|
||||
}
|
||||
|
||||
if ![info exists strip] then {
|
||||
set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]]
|
||||
}
|
||||
|
||||
if {![file isdirectory tmpdir]} then {
|
||||
catch "exec mkdir tmpdir" status
|
||||
}
|
||||
|
||||
# Make a symlink from tmpdir/as to the assembler in the build tree, so
|
||||
# that we can use a -B option to gcc to force it to use the newly
|
||||
# built assembler.
|
||||
if {![file isdirectory tmpdir/gas]} then {
|
||||
catch "exec mkdir tmpdir/gas" status
|
||||
catch "exec ln -s ../../../gas/as-new tmpdir/gas/as" status
|
||||
}
|
||||
set gcc_gas_flag "-B[pwd]/tmpdir/gas/"
|
||||
|
||||
# load the utility procedures
|
||||
load_lib ld.exp
|
||||
load_lib ld-lib.exp
|
||||
|
||||
proc get_link_files {varname} {
|
||||
global $varname
|
||||
global target_triplet
|
||||
global srcdir
|
||||
global CC
|
||||
if ![info exists $varname] {
|
||||
set status [catch "exec sh -c \"host=$target_triplet && CC=$CC && . $srcdir/../configure.host && eval echo \\$$varname\"" result]
|
||||
if $status { error "Error getting native link files: $result" }
|
||||
set $varname $result
|
||||
}
|
||||
}
|
||||
|
||||
proc get_target_emul {} {
|
||||
global target_triplet
|
||||
global srcdir
|
||||
set status [catch "exec sh -c \"targ=$target_triplet && . $srcdir/../configure.tgt && echo \\\$targ_emul\"" result]
|
||||
if $status { error "Error getting emulation name: $result" }
|
||||
return $result
|
||||
}
|
||||
|
||||
if [isnative] {
|
||||
foreach x {HOSTING_CRT0 HOSTING_LIBS} {
|
||||
get_link_files $x
|
||||
}
|
||||
} else {
|
||||
foreach x {HOSTING_CRT0 HOSTING_LIBS} { set $x "" }
|
||||
}
|
||||
if ![info exists HOSTING_EMU] { set HOSTING_EMU "-m [get_target_emul]" }
|
||||
|
||||
#
|
||||
# ld_version -- extract and print the version number of ld compiler (GCC)
|
||||
|
|
33
ld/testsuite/ld-shared/elf-offset.ld
Normal file
33
ld/testsuite/ld-shared/elf-offset.ld
Normal file
|
@ -0,0 +1,33 @@
|
|||
PHDRS {
|
||||
code PT_LOAD FLAGS(5);
|
||||
data PT_LOAD FLAGS(6);
|
||||
dynamic PT_DYNAMIC FLAGS(6);
|
||||
}
|
||||
|
||||
MEMORY {
|
||||
RAM : ORIGIN = 0x10000, LENGTH = 0x7fffff
|
||||
}
|
||||
|
||||
SECTIONS {
|
||||
.text : { *(.text) *(.stub) *(.gnu.warning) *(.gnu.linkonce.t*) } > RAM :code
|
||||
.plt : { *(.plt) } > RAM :code
|
||||
.rodata : { *(.rodata) } > RAM :code
|
||||
.rdata : { *(.rdata) } > RAM :code
|
||||
.data ALIGN(0x1000) : { *(.data) *(.gnu.linkonce.d*) } > RAM :data
|
||||
.got : { *(.got) *(.got.plt) } > RAM :data
|
||||
.bss : { *(.bss) *(.dynbss) *(COMMON) } > RAM :data
|
||||
.dynamic : { *(.dynamic ) } > RAM :dynamic :data
|
||||
.dynsym : { *(.dynsym) } > RAM :dynamic :data
|
||||
.dynstr : { *(.dynstr) } > RAM :dynamic :data
|
||||
.rela.text : { *(.rela.text) } > RAM :dynamic :data
|
||||
.rela.plt : { *(.rela.plt) } > RAM :dynamic :data
|
||||
.rela.data : { *(.rela.data) } > RAM :dynamic :data
|
||||
.rel.text : { *(.rel.text) } > RAM :dynamic :data
|
||||
.rel.plt : { *(.rel.plt) } > RAM :dynamic :data
|
||||
.rel.data : { *(.rel.data) } > RAM :dynamic :data
|
||||
.hash : { *(.hash) } > RAM :dynamic :data
|
||||
.interp : { *(.interp) } > RAM :dynamic :data
|
||||
.gnu.version_r : { *(.gnu.version_r) } > RAM :dynamic :data
|
||||
.gnu.version_d : { *(.gnu.version_d) }> RAM :dynamic :data
|
||||
.gnu.version : { *(.gnu.version) } > RAM :dynamic :data
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
# Expect script for ld-shared tests
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -41,6 +41,9 @@ if { ![istarget i386-*-sysv4*] \
|
|||
&& ![istarget i586-*-linux*] \
|
||||
&& ![istarget m68k-*-linux*] \
|
||||
&& ![istarget mips*-*-irix5*] \
|
||||
&& ![istarget powerpc-*-elf*] \
|
||||
&& ![istarget powerpc-*-linux*] \
|
||||
&& ![istarget powerpc-*-sysv4*] \
|
||||
&& ![istarget sparc*-*-elf] \
|
||||
&& ![istarget sparc*-*-solaris2*] \
|
||||
&& ![istarget sparc*-*-sunos4*] \
|
||||
|
@ -93,7 +96,7 @@ if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
|
|||
}
|
||||
|
||||
# The test procedure.
|
||||
proc shared_test { progname testname main sh1 sh2 dat } {
|
||||
proc shared_test { progname testname main sh1 sh2 dat args } {
|
||||
global ld
|
||||
global srcdir
|
||||
global subdir
|
||||
|
@ -101,13 +104,15 @@ proc shared_test { progname testname main sh1 sh2 dat } {
|
|||
global host_triplet
|
||||
global tmpdir
|
||||
|
||||
if [llength $args] { set shldflags [lindex $args 0] } else { set shldflags "" }
|
||||
|
||||
# Build the shared library.
|
||||
# On AIX, we need to use an export file.
|
||||
set shared -shared
|
||||
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
|
||||
set shared "-bM:SRE -bE:$tmpdir/xcoff.exp"
|
||||
}
|
||||
if {![ld_simple_link $ld $tmpdir/$progname.so "$shared $tmpdir/$sh1 $tmpdir/$sh2"]} {
|
||||
if {![ld_simple_link $ld $tmpdir/$progname.so "$shared $shldflags $tmpdir/$sh1 $tmpdir/$sh2"]} {
|
||||
fail "$testname"
|
||||
return
|
||||
}
|
||||
|
@ -195,11 +200,15 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o]
|
|||
# SunOS non PIC shared libraries don't permit some cases of
|
||||
# overriding.
|
||||
setup_xfail "*-*-sunos4*"
|
||||
# On Linux/m68k this fails because non-pic references to symbols
|
||||
# in the same section may be resolved by the assembler if they
|
||||
# are pc-relative.
|
||||
setup_xfail "m68k-*-linux*"
|
||||
shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o shared
|
||||
|
||||
# Test ELF shared library relocations with a non-zero load
|
||||
# address for the library. Near as I can tell, the R_*_RELATIVE
|
||||
# relocations for various targets are broken in the case where
|
||||
# the load address is not zero (which is the default).
|
||||
setup_xfail "*-*-sunos4*"
|
||||
shared_test shnp "shared (non PIC, load offset)" \
|
||||
mainnp.o sh1np.o sh2np.o shared "$srcdir/$subdir/elf-offset.ld"
|
||||
} }
|
||||
|
||||
# Now compile the code using -fpic.
|
||||
|
@ -231,10 +240,6 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdir/m
|
|||
# SunOS non PIC shared libraries don't permit some cases of
|
||||
# overriding.
|
||||
setup_xfail "*-*-sunos4*"
|
||||
# On Linux/m68k this fails because non-pic references to symbols
|
||||
# in the same section may be resolved by the assembler if they
|
||||
# are pc-relative.
|
||||
setup_xfail "m68k-*-linux*"
|
||||
shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o shared
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue