diff options
Diffstat (limited to 'ld/testsuite')
34 files changed, 36 insertions, 1179 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 4d302ec..5195dcc 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,39 @@ +2004-04-21 Chris Demetriou <cgd@broadcom.com> + + * ld-empic/run.c: Removed as part of MIPS --embedded-relocs removal. + * ld-empic/empic.exp: Likewise. + * ld-empic/relax.t: Likewise. + * ld-empic/relax1.c: Likewise. + * ld-empic/relax2.c: Likewise. + * ld-empic/relax3.c: Likewise. + * ld-empic/relax4.c: Likewise. + * ld-empic/runtest1.c: Likewise. + * ld-empic/runtest2.c: Likewise. + * ld-empic/runtesti.s: Likewise. + * ld-mips-elf/empic1-ln.d: Likewise. + * ld-mips-elf/empic1-lp.d: Likewise. + * ld-mips-elf/empic1-mn.d: Likewise. + * ld-mips-elf/empic1-mp.d: Likewise. + * ld-mips-elf/empic1-ref.s: Likewise. + * ld-mips-elf/empic1-sn.d: Likewise. + * ld-mips-elf/empic1-sp.d: Likewise. + * ld-mips-elf/empic1-space.s: Likewise. + * ld-mips-elf/empic1-tgt.s: Likewise. + * ld-mips-elf/empic2-fwd-0.d: Likewise. + * ld-mips-elf/empic2-fwd-1.d: Likewise. + * ld-mips-elf/empic2-fwd-tgt.s: Likewise. + * ld-mips-elf/empic2-ref.s: Likewise. + * ld-mips-elf/empic2-rev-0.d: Likewise. + * ld-mips-elf/empic2-rev-1.d: Likewise. + * ld-mips-elf/empic2-rev-tgt.s: Likewise. + * ld-mips-elf/empic2-space.s: Likewise. + * ld-mips-elf/emrelocs-eb.d: Likewise. + * ld-mips-elf/emrelocs-el.d: Likewise. + * ld-mips-elf/emrelocs.ld: Likewise. + * ld-mips-elf/emrelocs1.s: Likewise. + * ld-mips-elf/emrelocs2.s: Likewise. + * ld-mips-elf/mips-elf.exp: Don't run now-removed tests. + 2004-04-20 H.J. Lu <hongjiu.lu@intel.com> * ld-elfweak/elfweak.exp: Add an undefined weak size change diff --git a/ld/testsuite/ld-empic/empic.exp b/ld/testsuite/ld-empic/empic.exp deleted file mode 100644 index f72b1f3..0000000 --- a/ld/testsuite/ld-empic/empic.exp +++ /dev/null @@ -1,263 +0,0 @@ -# Expect script for ld-empic tests -# Copyright 1994, 1995, 1996 Free Software Foundation, Inc. -# -# 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 -# the Free Software Foundation; either version 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# Written by Ian Lance Taylor (ian@cygnus.com) -# - -# Test the handling of MIPS embedded PIC code. This test essentially -# tests the compiler and assembler as well as the linker, since MIPS -# embedded PIC is a GNU enhancement to standard MIPS tools. - -# Embedded PIC is only supported for MIPS ECOFF targets. -if ![istarget mips*-*-ecoff*] { - return -} - -set testname relax - -if { [which $CC] == 0 } { - untested $testname - return -} - -# Test that relaxation works correctly. This testsuite was composed -# (by experimentation) to force the linker to relax twice--that is, -# the first relaxation pass will force another call to be out of -# range, requiring a second relaxation pass. -if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax1.c tmpdir/relax1.o] - || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax2.c tmpdir/relax2.o] - || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax3.c tmpdir/relax3.o] - || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax4.c tmpdir/relax4.o] } { - unresolved $testname - return -} - -if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir/$subdir/relax.t tmpdir/relax1.o tmpdir/relax2.o tmpdir/relax3.o tmpdir/relax4.o"] { - fail $testname -} else { - # Check that the relaxation produced the correct result. Check - # each bal instruction. Some will go directly to the start of a - # function, which is OK. Some will form part of the five - # instruction expanded call sequence, in which case we compute the - # real destination and make sure it is the start of a function. - # Some bal instructions are used to locate the start of the - # function in order to do position independent addressing into the - # text section, in which case we just check that it correctly - # computes the start of the function. - - # Get the symbol table. - if ![ld_nm $nm "" tmpdir/relax] { - unresolved $testname - return - } - - # Get a disassembly. - send_log "$objdump -d tmpdir/relax >tmpdir/relax.dis\n" - verbose "$objdump -d tmpdir/relax >tmpdir/relax.dis" - catch "exec $objdump -d tmpdir/relax >tmpdir/relax.dis" exec_output - if ![string match "" $exec_output] { - send_log "$exec_output\n" - verbose $exec_output - unresolved $testname - return - } - - set balcnt 0 - set file [open tmpdir/relax.dis r] - while { [gets $file line] != -1 } { - verbose "$line" 2 - - if ![string match "*bal*" $line] { - continue - } - - verbose "$line" - - incr balcnt - - if ![regexp "^(\[0-9a-fA-F\]+) (<\[a-z+0-9A-Z.\]+>)? bal (\[0-9a-fA-F\]+)" $line whole addr label dest] { - perror "unrecognized format for $line" - unresolved $testname - return - } - - if "0x$addr + 8 != 0x$dest" { - # This is a straight function call. All function calls in - # this example are to either foo or bar. - if "0x$dest != $nm_output(foo) && 0x$dest != $nm_output(bar)" { - send_log "fail 1\n" - send_log "$line\n" - fail $testname - return - } - } else { - # Pick up the next line. If it is sll, this is a switch - # prologue, and there is not much we can do to test it. - # Otherwise, it should be lui, and the next instruction - # should be an addiu, followed by an addu to $31. - if { [gets $file l] == -1 } { - send_log "fail 2\n" - send_log "$line\n" - fail $testname - return - } - verbose $l - - if [string match "*sll*" $l] { - continue - } - if ![regexp "lui (\[\$a-z0-9\]+),(\[0-9a-fA-Fx\]+)" $l whole reg upper] { - send_log "fail 3\n" - send_log "$line\n" - send_log "$l\n" - fail $testname - return - } - - if { [gets $file l] == -1 } { - send_log "fail 4\n" - send_log "$line\n" - fail $testname - return - } - verbose "$l" - if ![regexp "addiu \\$reg,\\$reg,(\[-0-9\]+)" $l whole lower] { - send_log "fail 5\n" - send_log "$line\n" - send_log "$l\n" - send_log "addiu \\$reg,\\$reg,(\[-0-9\]+)\n" - fail $testname - return - } - - if { [gets $file l] == -1 } { - send_log "fail 6\n" - send_log "$line\n" - fail $testname - return - } - verbose "$l" - if ![regexp "addu \\$reg,\\$reg,\\\$ra" $l] { - send_log "fail 7\n" - send_log "$line\n" - send_log "$l\n" - fail $testname - return - } - - # The next line will be jalr in the case of an expanded - # call. Otherwise, the code is getting the start of the - # function, and the next line can be anything. - - if { [gets $file l] == -1 } { - send_log "fail 8\n" - send_log "$line\n" - fail $testname - return - } - verbose "$l" - if [string match "*jalr*" $l] { - set dest [expr 0x$addr + 8 + ($upper << 16) + $lower] - if { $dest != $nm_output(foo) && $dest != $nm_output(bar) } { - send_log "fail 9\n" - send_log "$line\n" - fail $testname - return - } - } else { - set dest [expr ($upper << 16) + $lower] - if ![regexp "<(\[.a-z\]+)\\+(\[0-9a-fA-F\]+)>" $label whole base offset] { - send_log "fail 10\n" - send_log "$line\n" - fail $testname - return - } - set offset 0x$offset - if { $base == ".foo" } { - set offset [expr $offset - ($nm_output(foo) - 0x30)] - } - if { $offset + 8 != - $dest } { - send_log "fail 11\n" - send_log "$line\n" - fail $testname - return - } - } - } - } - - close $file - - if {$balcnt < 10} { - send_log "fail 12\n" - fail $testname - } else { - verbose "$balcnt bal instructions" - pass $testname - } -} - -# We now test actually running embedded MIPS PIC code. This can only -# be done on a MIPS host with the same endianness as our target. -if [istarget mipsel-*-*] { - if ![ishost mips*-*-ultrix*] { - return - } -} else { - if ![ishost mips*-*-irix*] { - return - } -} - -set testname "run embedded PIC code" - -# Compile the program which will run the test. This code must be -# compiled for the host, not the target. -send_log "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c\n" -verbose "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c" -catch "exec $CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c" exec_output -if ![string match "" $exec_output] { - send_log "$exec_output\n" - verbose "$exec_output" - unresolved $testname - return -} - -# Compile and link the test. -if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtesti.s tmpdir/runtesti.o] - || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtest1.c tmpdir/runtest1.o] - || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtest2.c tmpdir/runtest2.o] } { - unresolved $testname - return -} -if ![ld_simple_link $ld tmpdir/runtest "--embedded-relocs tmpdir/runtesti.o tmpdir/runtest1.o tmpdir/runtest2.o"] { - fail $testname -} else { - # Now run the test. - send_log "tmpdir/run tmpdir/runtest\n" - verbose "tmpdir/run tmpdir/runtest" - catch "exec tmpdir/run tmpdir/runtest" exec_output - if [string match "*ran and returned 0*" $exec_output] { - send_log "$exec_output\n" - verbose "$exec_output" - pass $testname - } else { - send_log "$exec_output\n" - verbose "$exec_output" - fail $testname - } -} diff --git a/ld/testsuite/ld-empic/relax.t b/ld/testsuite/ld-empic/relax.t deleted file mode 100644 index 8c18b69..0000000 --- a/ld/testsuite/ld-empic/relax.t +++ /dev/null @@ -1,49 +0,0 @@ -OUTPUT_FORMAT("ecoff-bigmips") -SECTIONS -{ - .foo 0x30 : { - tmpdir/relax3.o(.text) - tmpdir/relax1.o(.text) - } - .text 0x20000 : { - _ftext = . ; - *(.init) - eprol = .; - tmpdir/relax4.o(.text) - *(.text) - *(.fini) - etext = .; - _etext = .; - } - .rdata . : { - *(.rdata) - } - _fdata = .; - .data . : { - *(.data) - CONSTRUCTORS - } - _gp = . + 0x8000; - .lit8 . : { - *(.lit8) - } - .lit4 . : { - *(.lit4) - } - .sdata . : { - *(.sdata) - } - edata = .; - _edata = .; - _fbss = .; - .sbss . : { - *(.sbss) - *(.scommon) - } - .bss . : { - *(.bss) - *(COMMON) - } - end = .; - _end = .; -} diff --git a/ld/testsuite/ld-empic/relax1.c b/ld/testsuite/ld-empic/relax1.c deleted file mode 100644 index 20ec39e..0000000 --- a/ld/testsuite/ld-empic/relax1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* First source file in relaxation test. */ - -extern int bar (); -static int foo2 (); - -int foo (int i) -{ - switch (i) - { - case 0: bar (0); break; - case 1: bar (1); break; - case 2: bar (2); break; - case 3: bar (3); break; - case 4: bar (foo2); break; - case 5: bar (bar); break; - } - while (1) - if (i) - return bar (); -} - -static int foo2 () { } diff --git a/ld/testsuite/ld-empic/relax2.c b/ld/testsuite/ld-empic/relax2.c deleted file mode 100644 index 58854a0..0000000 --- a/ld/testsuite/ld-empic/relax2.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Second source file in relaxation test. */ - -int bar2 () -{ - int i; - - for (i = 0; i < 100; i++) - foo (); - return foo () + foo () + foo () + foo (); -} - -int bar (int i) -{ - while (1) - if (i) - return foo (); - else - return foo (); -} diff --git a/ld/testsuite/ld-empic/relax3.c b/ld/testsuite/ld-empic/relax3.c deleted file mode 100644 index 1aaa532..0000000 --- a/ld/testsuite/ld-empic/relax3.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Third source file in relaxation test. */ - -int quux () { return 0; } diff --git a/ld/testsuite/ld-empic/relax4.c b/ld/testsuite/ld-empic/relax4.c deleted file mode 100644 index 21cfb05..0000000 --- a/ld/testsuite/ld-empic/relax4.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Fourth source file in relaxation test. */ - -int xyzzy () { return 0; } diff --git a/ld/testsuite/ld-empic/run.c b/ld/testsuite/ld-empic/run.c deleted file mode 100644 index 9a0377e..0000000 --- a/ld/testsuite/ld-empic/run.c +++ /dev/null @@ -1,160 +0,0 @@ -/* Load and run a MIPS position independent ECOFF file. - Written by Ian Lance Taylor <ian@cygnus.com> - Public domain. */ - -/* This program will load an ECOFF file into memory and execute it. - The file must have been compiled using the GNU -membedded-pic - switch to produce position independent code. This will only work - if this program is run on a MIPS system with the same endianness as - the ECOFF file. The ECOFF file must be complete. System calls may - not work correctly. - - There are further restrictions on the file (they could be removed - by doing some additional programming). The file must be aligned - such that it does not require any gaps introduced in the data - segment; the GNU linker produces such files by default. However, - the file must not assume that the text or data segment is aligned - on a page boundary. The start address must be at the start of the - text segment. - - The ECOFF file is run by calling it as though it were a function. - The address of the data segment is passed as the only argument. - The file is expected to return an integer value, which will be - printed. */ - -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> - -/* Structures used in ECOFF files. We assume that a short is two - bytes and an int is four bytes. This is not much of an assumption, - since we already assume that we are running on a MIPS host with the - same endianness as the file we are examining. */ - -struct ecoff_filehdr { - unsigned short f_magic; /* magic number */ - unsigned short f_nscns; /* number of sections */ - unsigned int f_timdat; /* time & date stamp */ - unsigned int f_symptr; /* file pointer to symtab */ - unsigned int f_nsyms; /* number of symtab entries */ - unsigned short f_opthdr; /* sizeof(optional hdr) */ - unsigned short f_flags; /* flags */ -}; - -struct ecoff_aouthdr -{ - unsigned short magic; /* type of file */ - unsigned short vstamp; /* version stamp */ - unsigned int tsize; /* text size in bytes, padded to FW bdry*/ - unsigned int dsize; /* initialized data " " */ - unsigned int bsize; /* uninitialized data " " */ - unsigned int entry; /* entry pt. */ - unsigned int text_start; /* base of text used for this file */ - unsigned int data_start; /* base of data used for this file */ - unsigned int bss_start; /* base of bss used for this file */ - unsigned int gprmask; /* ?? */ - unsigned int cprmask[4]; /* ?? */ - unsigned int gp_value; /* value for gp register */ -}; - -#define ECOFF_SCNHDR_SIZE (40) - -static void -die (s) - char *s; -{ - perror (s); - exit (1); -} - -int -main (argc, argv) - int argc; - char **argv; -{ - FILE *f; - struct stat s; - char *z; - struct ecoff_filehdr *fh; - struct ecoff_aouthdr *ah; - unsigned int toff; - char *t, *d; - int (*pfn) (); - int ret; - - if (argc != 2) - { - fprintf (stderr, "Usage: %s file\n", argv[0]); - exit (1); - } - - f = fopen (argv[1], "r"); - if (f == NULL) - die (argv[1]); - - if (stat (argv[1], &s) < 0) - die ("stat"); - - z = (char *) malloc (s.st_size); - if (z == NULL) - die ("malloc"); - - if (fread (z, 1, s.st_size, f) != s.st_size) - die ("fread"); - - /* We need to figure out the start of the text segment, which is the - location we are going to call, and the start of the data segment, - which we are going to pass as an argument. We also need the size - and start address of the bss segment. This information is all in - the ECOFF a.out header. */ - - fh = (struct ecoff_filehdr *) z; - if (fh->f_opthdr != sizeof (struct ecoff_aouthdr)) - { - fprintf (stderr, "%s: unexpected opthdr size: is %u, want %u\n", - argv[1], (unsigned int) fh->f_opthdr, - (unsigned int) sizeof (struct ecoff_aouthdr)); - exit (1); - } - - ah = (struct ecoff_aouthdr *) (z + sizeof (struct ecoff_filehdr)); - if (ah->magic != 0413) - { - fprintf (stderr, "%s: bad aouthdr magic number 0%o (want 0413)\n", - argv[1], (unsigned int) ah->magic); - exit (1); - } - - /* We should clear the bss segment at this point. This is the - ah->bsize bytes starting at ah->bss_start, To do this correctly, - we would have to make sure our memory block is large enough. It - so happens that our test case does not have any additional pages - for the bss segment--it is contained within the data segment. - So, we don't bother. */ - if (ah->bsize != 0) - { - fprintf (stderr, - "%s: bss segment is %u bytes; non-zero sizes not supported\n", - argv[1], ah->bsize); - exit (1); - } - - /* The text section starts just after all the headers, rounded to a - 16 byte boundary. */ - toff = (sizeof (struct ecoff_filehdr) + sizeof (struct ecoff_aouthdr) - + fh->f_nscns * ECOFF_SCNHDR_SIZE); - toff += 15; - toff &=~ 15; - t = z + toff; - - /* The tsize field gives us the start of the data segment. */ - d = z + ah->tsize; - - /* Call the code as a function. */ - pfn = (int (*) ()) t; - ret = (*pfn) (d); - - printf ("%s ran and returned %d\n", argv[1], ret); - - exit (0); -} diff --git a/ld/testsuite/ld-empic/runtest1.c b/ld/testsuite/ld-empic/runtest1.c deleted file mode 100644 index f9ab6eb..0000000 --- a/ld/testsuite/ld-empic/runtest1.c +++ /dev/null @@ -1,117 +0,0 @@ -/* First C source file for actual execution test. */ - -/* The main point of this test is to make sure that the code and data - are truly position independent. We statically initialize several - global variables, and make sure that they are correctly adjusted at - runtime. */ - -int i = 1; -int j = 0; -extern int k; -int l; -char small_buf[] = "aaaa"; -char *small_pointer = small_buf; -char big_buf[] = "aaaaaaaaaaaaaaaa"; -char *big_pointer = big_buf; - -extern int bar (); -int (*pbar) () = bar; - -static int -foo2 (arg) - int arg; -{ - l = arg; - return i + j; -} - -int (*pfoo2) () = foo2; - -int -chkstr (z, c) - char *z; - int c; -{ - /* Switch statements need extra effort to be position independent, - so we run one here, even though most of the cases will never be - taken. */ - switch (c) - { - case 1: - case 2: - case 3: - return i - 1; - case 4: - break; - case 5: - case 6: - case 7: - case 8: - case 9: - return i * j; - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - return j; - case 16: - break; - default: - return 0; - } - - while (c-- != 0) - if (*z++ != 'a') - return 0; - - return *z == '\0'; -} - -/* This function is called by the assembler startup routine. It tries - to test that everything was correctly initialized. It returns 0 on - success, something else on failure. */ - -int -foo () -{ - if (i != 1) - return 1; - if (j != 0) - return 2; - if (! chkstr (small_buf, 4)) - return 3; - if (! chkstr (small_pointer, 4)) - return 4; - if (! chkstr (big_buf, 16)) - return 5; - if (! chkstr (big_pointer, 16)) - return 6; - - if (l != 0) - return 7; - if (foo2 (1) != 1) - return 8; - if (l != 1) - return 9; - if ((*pfoo2) (2) != 1) - return 10; - if (l != 2) - return 11; - - if (bar (1) != 0) - return 12; - if (bar (-1) != 1) - return 13; - if ((*pbar) (0xa5a5a5a5) != -1) - return 14; - if (k != 0xa5a5a5a5) - return 15; - if ((*pbar) (0) != 0xa5a5a5a5) - return 16; - if (k != 0) - return 17; - - return 0; -} diff --git a/ld/testsuite/ld-empic/runtest2.c b/ld/testsuite/ld-empic/runtest2.c deleted file mode 100644 index 000525f..0000000 --- a/ld/testsuite/ld-empic/runtest2.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Second C source file for actual execution test. */ - -int k; -extern int i; -extern int j; -extern char small_buf[]; -extern char *small_pointer; - -extern int chkstr (); - -int -bar (n) - int n; -{ - int r; - - if (i != 1 - || j != 0 - || ! chkstr (small_buf, 4) - || ! chkstr (small_pointer, 4)) - return k + 1; - - r = k; - k = n; - return r; -} diff --git a/ld/testsuite/ld-empic/runtesti.s b/ld/testsuite/ld-empic/runtesti.s deleted file mode 100644 index efa1953..0000000 --- a/ld/testsuite/ld-empic/runtesti.s +++ /dev/null @@ -1,94 +0,0 @@ -# Assembler initialization code for actual execution test. - -# This code becomes the start of the execution test program. It is -# responsible for initializing the static data, invoking the C code, -# and returning the result. It is called as though it were a C -# function with an argument of the address of the data segment. - -# We need to know the value of _ftext and _fdata at link time, but we -# have no way to actually get that at runtime. This is because when -# this code is compiled with -membedded-pic, the la instruction will -# be turned into an addiu $gp instruction. We work around this by -# storing the information in words in the .data section. We then load -# the values of these words *before* doing the runtime relocation. - .sdata -text_start: - .word _ftext -data_start: - .word _fdata - - .globl start - .text -start: - # Grab some space on the stack, just as though we were a real - # function. - addiu $sp,$sp,-8 - sw $31,0($sp) - - # Save the $gp register, and set it up for our data section. - sw $gp,4($sp) - - addu $gp,$4,0x8000 # macro - - # The start of the data segment is in $4. - - # Get the address of start into $5 in a position independent - # fashion. - .set noreorder - $LF1 = . + 8 - bal $LF1 - la $5,start-$LF1 # macro - .set reorder - addu $5,$5,$31 - - # Now get the address of _ftext into $6. - la $6,_ftext-start # macro - addu $6,$6,$5 - - # Get the value of _ftext used to link into $7. - lw $7,text_start # macro - - # Get the value of _fdata used to link into $8. - lw $8,data_start # macro - - # Get the address of __runtime_reloc_start into $9. - la $9,__runtime_reloc_start-start # macro - addu $9,$9,$5 - - # Get the address of __runtime_reloc_stop into $10. - la $10,__runtime_reloc_stop-start # macro - addu $10,$10,$5 - - # The words between $9 and $10 are the runtime initialization - # instructions. Step through and relocate them. First set - # $11 and $12 to the values to add to text and data sections, - # respectively. - subu $11,$6,$7 - subu $12,$4,$8 - -1: - bge $9,$10,3f # macro - lw $13,0($9) - and $14,$13,0xfffffffe # macro - move $15,$11 - beq $13,$14,2f - move $15,$12 -2: - addu $14,$14,$4 - lw $24,0($14) - addu $24,$24,$15 - sw $24,0($14) - addiu $9,$9,4 - b 1b -3: - - # Now the statically initialized data has been relocated - # correctly, and we can call the C code which does the actual - # testing. - bal foo - - # We return the value returned by the C code. - lw $31,0($sp) - lw $gp,4($sp) - addu $sp,$sp,8 - j $31 diff --git a/ld/testsuite/ld-mips-elf/empic1-ln.d b/ld/testsuite/ld-mips-elf/empic1-ln.d deleted file mode 100644 index eb78478..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-ln.d +++ /dev/null @@ -1,27 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #1-ln (large negative) -#as: -membedded-pic -mips3 -#source: empic1-tgt.s -#source: empic1-space.s -#source: empic1-space.s -#source: empic1-ref.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -SYMBOL TABLE: -#... -0+410020 g F .text [0-9a-f]+ foo -#... -0+400000 g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: - ... - ... - ... -0+410020 <[^>]*> 00000000 nop -0+410024 <[^>]*> 3c02ffff lui v0,0xffff -0+410028 <[^>]*> 6442ffe0 daddiu v0,v0,-32 - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-lp.d b/ld/testsuite/ld-mips-elf/empic1-lp.d deleted file mode 100644 index bd11e52..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-lp.d +++ /dev/null @@ -1,26 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #1-lp (large positive) -#as: -membedded-pic -mips3 -#source: empic1-ref.s -#source: empic1-space.s -#source: empic1-space.s -#source: empic1-tgt.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -SYMBOL TABLE: -#... -0+400000 g F .text [0-9a-f]+ foo -#... -0+410020 g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: -0+400000 <[^>]*> 00000000 nop -0+400004 <[^>]*> 3c020001 lui v0,0x1 -0+400008 <[^>]*> 64420020 daddiu v0,v0,32 - ... - ... - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-mn.d b/ld/testsuite/ld-mips-elf/empic1-mn.d deleted file mode 100644 index fa43abf..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-mn.d +++ /dev/null @@ -1,25 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #1-mn (medium negative) -#as: -membedded-pic -mips3 -#source: empic1-tgt.s -#source: empic1-space.s -#source: empic1-ref.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -SYMBOL TABLE: -#... -0+408020 g F .text [0-9a-f]+ foo -#... -0+400000 g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: - ... - ... -0+408020 <[^>]*> 00000000 nop -0+408024 <[^>]*> 3c02ffff lui v0,0xffff -0+408028 <[^>]*> 64427fe0 daddiu v0,v0,32736 - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-mp.d b/ld/testsuite/ld-mips-elf/empic1-mp.d deleted file mode 100644 index 27d1574..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-mp.d +++ /dev/null @@ -1,25 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #1-mp (medium positive) -#as: -membedded-pic -mips3 -#source: empic1-ref.s -#source: empic1-space.s -#source: empic1-tgt.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -SYMBOL TABLE: -#... -0+400000 g F .text [0-9a-f]+ foo -#... -0+408020 g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: -0+400000 <[^>]*> 00000000 nop -0+400004 <[^>]*> 3c020001 lui v0,0x1 -0+400008 <[^>]*> 64428020 daddiu v0,v0,-32736 - ... - ... - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-ref.s b/ld/testsuite/ld-mips-elf/empic1-ref.s deleted file mode 100644 index dfa345e..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-ref.s +++ /dev/null @@ -1,9 +0,0 @@ - - .globl foo - .ent foo -foo: - nop - la $2, bar - foo - .end foo - - .p2align 5 diff --git a/ld/testsuite/ld-mips-elf/empic1-sn.d b/ld/testsuite/ld-mips-elf/empic1-sn.d deleted file mode 100644 index 6d041ed..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-sn.d +++ /dev/null @@ -1,23 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #1-sn (small negative) -#as: -membedded-pic -mips3 -#source: empic1-tgt.s -#source: empic1-ref.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -SYMBOL TABLE: -#... -0+400020 g F .text [0-9a-f]+ foo -#... -0+400000 g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: - ... -0+400020 <[^>]*> 00000000 nop -0+400024 <[^>]*> 3c020000 lui v0,0x0 -0+400028 <[^>]*> 6442ffe0 daddiu v0,v0,-32 - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-sp.d b/ld/testsuite/ld-mips-elf/empic1-sp.d deleted file mode 100644 index f91d625..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-sp.d +++ /dev/null @@ -1,23 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #1-sp (small positive) -#as: -membedded-pic -mips3 -#source: empic1-ref.s -#source: empic1-tgt.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -SYMBOL TABLE: -#... -0+400000 g F .text [0-9a-f]+ foo -#... -0+400020 g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: -0+400000 <[^>]*> 00000000 nop -0+400004 <[^>]*> 3c020000 lui v0,0x0 -0+400008 <[^>]*> 64420020 daddiu v0,v0,32 - ... - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-space.s b/ld/testsuite/ld-mips-elf/empic1-space.s deleted file mode 100644 index 9c30cfb..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-space.s +++ /dev/null @@ -1,5 +0,0 @@ - - .ent space -space: - .space (32 * 1024) - .end space diff --git a/ld/testsuite/ld-mips-elf/empic1-tgt.s b/ld/testsuite/ld-mips-elf/empic1-tgt.s deleted file mode 100644 index 909488c..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-tgt.s +++ /dev/null @@ -1,8 +0,0 @@ - - .globl bar - .ent bar -bar: - nop - .end bar - - .p2align 5 diff --git a/ld/testsuite/ld-mips-elf/empic2-fwd-0.d b/ld/testsuite/ld-mips-elf/empic2-fwd-0.d deleted file mode 100644 index e53f1fa..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-fwd-0.d +++ /dev/null @@ -1,20 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #2-fwd-0 (0x7ffc forward edge case) -#as: -membedded-pic -mips3 -#source: empic2-ref.s -#source: empic2-fwd-tgt.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -#... -0+400000 g F .text [0-9a-f]+ foo -#... -0+407ffc g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: -0+400000 <[^>]*> 3c020000 lui v0,0x0 -0+400004 <[^>]*> 64427ffc daddiu v0,v0,32764 - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic2-fwd-1.d b/ld/testsuite/ld-mips-elf/empic2-fwd-1.d deleted file mode 100644 index e720852..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-fwd-1.d +++ /dev/null @@ -1,21 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #2-fwd-1 (0xfffc forward edge case) -#as: -membedded-pic -mips3 -#source: empic2-ref.s -#source: empic2-space.s -#source: empic2-fwd-tgt.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -#... -0+400000 g F .text [0-9a-f]+ foo -#... -0+40fffc g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: -0+400000 <[^>]*> 3c020001 lui v0,0x1 -0+400004 <[^>]*> 6442fffc daddiu v0,v0,-4 - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s b/ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s deleted file mode 100644 index 915cf45..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s +++ /dev/null @@ -1,7 +0,0 @@ - - .space (32768 - 16 - 4) # 16..32764 - - .globl bar - .ent bar -bar: - .end bar diff --git a/ld/testsuite/ld-mips-elf/empic2-ref.s b/ld/testsuite/ld-mips-elf/empic2-ref.s deleted file mode 100644 index 7048887..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-ref.s +++ /dev/null @@ -1,7 +0,0 @@ - .globl foo - .ent foo -foo: - la $2,bar-foo - .end foo - - .p2align 4 diff --git a/ld/testsuite/ld-mips-elf/empic2-rev-0.d b/ld/testsuite/ld-mips-elf/empic2-rev-0.d deleted file mode 100644 index 9bd9acc..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-rev-0.d +++ /dev/null @@ -1,22 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #2-rev-0 (0x0004 backward edge case) -#as: -membedded-pic -mips3 -#source: empic2-rev-tgt.s -#source: empic2-ref.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -#... -0+408000 g F .text [0-9a-f]+ foo -#... -0+407ffc g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: - ... -0+407ffc <[^>]*> 00000000 nop -0+408000 <[^>]*> 3c020000 lui v0,0x0 -0+408004 <[^>]*> 6442fffc daddiu v0,v0,-4 - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic2-rev-1.d b/ld/testsuite/ld-mips-elf/empic2-rev-1.d deleted file mode 100644 index 1a38ec2..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-rev-1.d +++ /dev/null @@ -1,24 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #2-rev-1 (0x8004 backward edge case) -#as: -membedded-pic -mips3 -#source: empic2-rev-tgt.s -#source: empic2-space.s -#source: empic2-ref.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -#... -0+410000 g F .text [0-9a-f]+ foo -#... -0+407ffc g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: - ... -0+407ffc <[^>]*> 00000000 nop - ... -0+410000 <[^>]*> 3c02ffff lui v0,0xffff -0+410004 <[^>]*> 64427ffc daddiu v0,v0,32764 - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic2-rev-tgt.s b/ld/testsuite/ld-mips-elf/empic2-rev-tgt.s deleted file mode 100644 index 8124cfe..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-rev-tgt.s +++ /dev/null @@ -1,8 +0,0 @@ - - .space (32768 - 4) - - .globl bar - .ent bar -bar: - .space 4 - .end bar diff --git a/ld/testsuite/ld-mips-elf/empic2-space.s b/ld/testsuite/ld-mips-elf/empic2-space.s deleted file mode 100644 index 9c30cfb..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-space.s +++ /dev/null @@ -1,5 +0,0 @@ - - .ent space -space: - .space (32 * 1024) - .end space diff --git a/ld/testsuite/ld-mips-elf/emrelocs-eb.d b/ld/testsuite/ld-mips-elf/emrelocs-eb.d deleted file mode 100644 index dd79bdd..0000000 --- a/ld/testsuite/ld-mips-elf/emrelocs-eb.d +++ /dev/null @@ -1,25 +0,0 @@ -#name: MIPS 32-bit ELF embedded relocs (big endian) -#source: emrelocs1.s -EB -#source: emrelocs2.s -EB -#ld: -EB --embedded-relocs -T $srcdir/$subdir/emrelocs.ld -#objdump: -s - -.*: file format elf.*mips.* - -Contents of section \.text: - 100000 00000000 00000001 00000000 00000000 .* - 100010 00000000 00000000 00000003 00000000 .* -Contents of section \.data: - 200000 00000000 00000002 00000000 00000000 .* - 200010 00000000 00000000 00000004 00000000 .* - 200020 00100004 00200004 00100018 00200018 .* - 200030 00000000 00100004 00000000 00200004 .* - 200040 00000000 00100018 00000000 00200018 .* -Contents of section \.rel\.sdata: - 300000 00000020 2e746578 74000000 00000024 .* - 300010 2e646174 61000000 00000028 2e746578 .* - 300020 74000000 0000002c 2e646174 61000000 .* - 300030 00000031 2e746578 74000000 00000039 .* - 300040 2e646174 61000000 00000041 2e746578 .* - 300050 74000000 00000049 2e646174 61000000 .* -#pass diff --git a/ld/testsuite/ld-mips-elf/emrelocs-el.d b/ld/testsuite/ld-mips-elf/emrelocs-el.d deleted file mode 100644 index ad1e495..0000000 --- a/ld/testsuite/ld-mips-elf/emrelocs-el.d +++ /dev/null @@ -1,25 +0,0 @@ -#name: MIPS 32-bit ELF embedded relocs (little endian) -#source: emrelocs1.s -EL -#source: emrelocs2.s -EL -#ld: -EL --embedded-relocs -T $srcdir/$subdir/emrelocs.ld -#objdump: -s - -.*: file format elf.*mips.* - -Contents of section \.text: - 100000 00000000 01000000 00000000 00000000 .* - 100010 00000000 00000000 03000000 00000000 .* -Contents of section \.data: - 200000 00000000 02000000 00000000 00000000 .* - 200010 00000000 00000000 04000000 00000000 .* - 200020 04001000 04002000 18001000 18002000 .* - 200030 04001000 00000000 04002000 00000000 .* - 200040 18001000 00000000 18002000 00000000 .* -Contents of section \.rel\.sdata: - 300000 20000000 2e746578 74000000 24000000 .* - 300010 2e646174 61000000 28000000 2e746578 .* - 300020 74000000 2c000000 2e646174 61000000 .* - 300030 31000000 2e746578 74000000 39000000 .* - 300040 2e646174 61000000 41000000 2e746578 .* - 300050 74000000 49000000 2e646174 61000000 .* -#pass diff --git a/ld/testsuite/ld-mips-elf/emrelocs.ld b/ld/testsuite/ld-mips-elf/emrelocs.ld deleted file mode 100644 index 557f139..0000000 --- a/ld/testsuite/ld-mips-elf/emrelocs.ld +++ /dev/null @@ -1,16 +0,0 @@ -ENTRY(ext_fun) -SECTIONS -{ - .text 0x00100000: - { - *(.text) - } - .data 0x00200000: - { - *(.sdata) - } - .rel.sdata 0x00300000: - { - *(.rel.sdata) - } -} diff --git a/ld/testsuite/ld-mips-elf/emrelocs1.s b/ld/testsuite/ld-mips-elf/emrelocs1.s deleted file mode 100644 index 3e679ae..0000000 --- a/ld/testsuite/ld-mips-elf/emrelocs1.s +++ /dev/null @@ -1,23 +0,0 @@ -# emrelocs1.s: some external symbols to be used in relocations. - - .text - .p2align 4 - - # Pad things so addresses which are used for relocations - # are non-zero. Zero simply isn't as much fun. - .word 0 - - .globl ext_fun - .ent ext_fun -ext_fun: .word 1 - .end ext_fun - - - .sdata - .p2align 4 - - # Padding here, for same reason. - .word 0 - - .globl ext_var -ext_var: .word 2 diff --git a/ld/testsuite/ld-mips-elf/emrelocs2.s b/ld/testsuite/ld-mips-elf/emrelocs2.s deleted file mode 100644 index 77570f1..0000000 --- a/ld/testsuite/ld-mips-elf/emrelocs2.s +++ /dev/null @@ -1,30 +0,0 @@ -# emrelocs2.s: local symbols and data which causes relocations. - - .text - .p2align 4 - - .word 0, 0 - - .ent lcl_fun -lcl_fun: .word 3 - .end lcl_fun - - - .sdata - .p2align 4 - - .word 0, 0 - -lcl_var: .word 4 - - .p2align 4 - - .word ext_fun - .word ext_var - .word lcl_fun - .word lcl_var - - .dword ext_fun - .dword ext_var - .dword lcl_fun - .dword lcl_var diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index f2194a1..50cb811 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -58,25 +58,6 @@ if { $linux_gnu } { } if { $embedded_elf } { - # Check basic Embedded-PIC PC-relative HI/LO relocs. - run_dump_test "empic1-ln" - run_dump_test "empic1-lp" - run_dump_test "empic1-mn" - run_dump_test "empic1-mp" - run_dump_test "empic1-sn" - run_dump_test "empic1-sp" - - # Embedded-PIC PC-relative HI/LO reloc edge-case regression tests. - # As of 2001-12-26, the linker botches the fwd-0 and rev-1 tests. - run_dump_test "empic2-fwd-0" - run_dump_test "empic2-fwd-1" - run_dump_test "empic2-rev-0" - run_dump_test "empic2-rev-1" - - # Check generation of embedded relocs section. - run_dump_test "emrelocs-eb" - run_dump_test "emrelocs-el" - run_dump_test "region1" } |