diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2002-05-07 11:08:57 +0000 |
---|---|---|
committer | Richard Sandiford <rdsandiford@googlemail.com> | 2002-05-07 11:08:57 +0000 |
commit | 3e3f011f9342b3ae7fd2f4b0e9a1484be6a31d60 (patch) | |
tree | 0f400df6d751c416063420d40b895933e86a3259 /ld | |
parent | 9f88b410a04363dbc584211667fcc3b565f37466 (diff) | |
download | gdb-3e3f011f9342b3ae7fd2f4b0e9a1484be6a31d60.zip gdb-3e3f011f9342b3ae7fd2f4b0e9a1484be6a31d60.tar.gz gdb-3e3f011f9342b3ae7fd2f4b0e9a1484be6a31d60.tar.bz2 |
* lib/ld-lib.exp (run_dump_test): Add -L$srcdir/$subdir.
(is_elf_format): New, extracted from...
* ld-scripts/weak.exp: ...here.
* ld-scripts/overlay-size.exp: New test.
* ld-scripts/overlay-size.[tsd],
* ld-scripts/overlay-size-map.d: New files for it.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/overlay-size-map.d | 23 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/overlay-size.d | 29 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/overlay-size.exp | 31 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/overlay-size.s | 25 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/overlay-size.t | 57 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/weak.exp | 14 | ||||
-rw-r--r-- | ld/testsuite/lib/ld-lib.exp | 29 |
8 files changed, 203 insertions, 14 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index b65e4f7..0bdf71f 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2002-05-07 Richard Sandiford <rsandifo@redhat.com> + + * lib/ld-lib.exp (run_dump_test): Add -L$srcdir/$subdir. + (is_elf_format): New, extracted from... + * ld-scripts/weak.exp: ...here. + * ld-scripts/overlay-size.exp: New test. + * ld-scripts/overlay-size.[tsd], + * ld-scripts/overlay-size-map.d: New files for it. + 2002-05-02 Richard Sandiford <rsandifo@redhat.com> * ld-scripts/map-address.exp: Quote conditions. diff --git a/ld/testsuite/ld-scripts/overlay-size-map.d b/ld/testsuite/ld-scripts/overlay-size-map.d new file mode 100644 index 0000000..3607169 --- /dev/null +++ b/ld/testsuite/ld-scripts/overlay-size-map.d @@ -0,0 +1,23 @@ +#... +\.bss1 *0x0*20000 *0x10 +#... +\.bss2 *0x0*20000 *0x30 load address 0x0*20010 +#... +\.bss3 *0x0*20000 *0x20 load address 0x0*20040 +#... +\.mtext *0x0*10000 *0x20 load address 0x0*30000 +#... +\.mbss *0x0*20030 *0x230 load address 0x0*20060 +#... +\.text1 *0x0*10020 *0x80 load address 0x0*30020 +#... +\.text2 *0x0*10020 *0x40 load address 0x0*300a0 +#... +\.text3 *0x0*10020 *0x20 load address 0x0*300e0 +#... +\.data1 *0x0*20260 *0x30 load address 0x0*30100 +#... +\.data2 *0x0*20260 *0x40 load address 0x0*30130 +#... +\.data3 *0x0*20260 *0x50 load address 0x0*30170 +#pass diff --git a/ld/testsuite/ld-scripts/overlay-size.d b/ld/testsuite/ld-scripts/overlay-size.d new file mode 100644 index 0000000..cf1f5e8 --- /dev/null +++ b/ld/testsuite/ld-scripts/overlay-size.d @@ -0,0 +1,29 @@ +# ld: -T overlay-size.t -Map tmpdir/overlay-size.map +# name: overlay size +# objdump: --headers +# +# The .bss[123] LMAs are deliberately blanked out. We can't +# reliably map overlaid sections to segments. +#... + 0 \.bss1 +0+010 +0+20000 .* +#... + 1 \.bss2 +0+030 +0+20000 .* +#... + 2 \.bss3 +0+020 +0+20000 .* +#... + 3 \.mtext +0+020 +0+10000 +0+30000 .* +#... + 4 \.mbss +0+230 +0+20030 +0+20060 .* +#... + 5 \.text1 +0+080 +0+10020 +0+30020 .* +#... + 6 \.text2 +0+040 +0+10020 +0+300a0 .* +#... + 7 \.text3 +0+020 +0+10020 +0+300e0 .* +#... + 8 \.data1 +0+030 +0+20260 +0+30100 .* +#... + 9 \.data2 +0+040 +0+20260 +0+30130 .* +#... + 10 \.data3 +0+050 +0+20260 +0+30170 .* +#pass diff --git a/ld/testsuite/ld-scripts/overlay-size.exp b/ld/testsuite/ld-scripts/overlay-size.exp new file mode 100644 index 0000000..e44466a --- /dev/null +++ b/ld/testsuite/ld-scripts/overlay-size.exp @@ -0,0 +1,31 @@ +# Test the OVERLAY statement. +# Copyright 2002 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. + +if ![is_elf_format] { + return +} + +run_dump_test overlay-size + +set testname "overlay size (map check)" + +if [regexp_diff "tmpdir/overlay-size.map" \ + "$srcdir/$subdir/overlay-size-map.d"] { + fail $testname +} else { + pass $testname +} diff --git a/ld/testsuite/ld-scripts/overlay-size.s b/ld/testsuite/ld-scripts/overlay-size.s new file mode 100644 index 0000000..5428c97 --- /dev/null +++ b/ld/testsuite/ld-scripts/overlay-size.s @@ -0,0 +1,25 @@ + .section .bss1, "aw", "nobits" + .space 0x10 + .section .bss2, "aw", "nobits" + .space 0x30 + .section .bss3, "aw", "nobits" + .space 0x20 + + .section .text1, "ax", "progbits" + .space 0x80 + .section .text2, "ax", "progbits" + .space 0x40 + .section .text3, "ax", "progbits" + .space 0x20 + + .section .data1, "aw", "progbits" + .space 0x30 + .section .data2, "aw", "progbits" + .space 0x40 + .section .data3, "aw", "progbits" + .space 0x50 + + .section .mtext, "ax", "progbits" + .space 0x20 + .section .mbss, "aw", "nobits" + .space 0x30 diff --git a/ld/testsuite/ld-scripts/overlay-size.t b/ld/testsuite/ld-scripts/overlay-size.t new file mode 100644 index 0000000..f7ffbbb --- /dev/null +++ b/ld/testsuite/ld-scripts/overlay-size.t @@ -0,0 +1,57 @@ +MEMORY +{ + TEXTMEM (ARX) : ORIGIN = 0x10000, LENGTH = 32K + DATAMEM (AW) : ORIGIN = 0x20000, LENGTH = 32K + LOADMEM (AW) : ORIGIN = 0x30000, LENGTH = 32K +} + +/* Map should be: + + SIZE VMA LMA + .bss1 10 20000 20000 + .bss2 30 20000 20010 + .bss3 20 20000 20040 + .mbss 230 20030 20060 + + .mtext 20 10000 30000 + .text1 80 10020 30020 + .text2 40 10020 300a0 + .text3 20 10020 300e0 + + .data1 30 20260 30100 + .data2 40 20260 30130 + .data3 50 20260 30170 */ + +SECTIONS +{ + OVERLAY : + { + .bss1 { *(.bss1) } + .bss2 { *(.bss2) } + .bss3 { *(.bss3) } + } > DATAMEM + + .mtext : { *(.mtext) } > TEXTMEM AT > LOADMEM + + .mbss : AT (__load_stop_bss3) + { + *(.mbss) + . += 0x200; + } > DATAMEM + + OVERLAY : + { + .text1 { *(.text1) } + .text2 { *(.text2) } + .text3 { *(.text3) } + } > TEXTMEM AT > LOADMEM + + OVERLAY : + { + .data1 { *(.data1) } + .data2 { *(.data2) } + .data3 { *(.data3) } + } > DATAMEM AT > LOADMEM + + . = 0x8000; +} diff --git a/ld/testsuite/ld-scripts/weak.exp b/ld/testsuite/ld-scripts/weak.exp index f5d6e20..3167ea4 100644 --- a/ld/testsuite/ld-scripts/weak.exp +++ b/ld/testsuite/ld-scripts/weak.exp @@ -21,22 +21,10 @@ set testname "weak symbols" # This test only works for ELF targets. It ought to work for some # a.out targets, but it doesn't. - -if { ![istarget *-*-sysv4*] \ - && ![istarget *-*-unixware*] \ - && ![istarget *-*-elf*] \ - && ![istarget *-*-eabi*] \ - && ![istarget *-*-linux*] \ - && ![istarget *-*-irix5*] \ - && ![istarget *-*-irix6*] \ - && ![istarget *-*-solaris2*] } then { +if ![is_elf_format] { return } -if { [istarget *-*-linux*aout*] \ - || [istarget *-*-linux*oldld*] } { - return -} if {! [ld_assemble $as $srcdir/$subdir/weak1.s tmpdir/weak1.o] || ! [ld_assemble $as $srcdir/$subdir/weak2.s tmpdir/weak2.o]} then { diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index 06583e5..418c000 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -323,6 +323,29 @@ proc default_ld_nm { nm nmflags object } { } # +# is_elf_format +# true if the object format is known to be ELF +# +proc is_elf_format {} { + if { ![istarget *-*-sysv4*] \ + && ![istarget *-*-unixware*] \ + && ![istarget *-*-elf*] \ + && ![istarget *-*-eabi*] \ + && ![istarget *-*-linux*] \ + && ![istarget *-*-irix5*] \ + && ![istarget *-*-irix6*] \ + && ![istarget *-*-solaris2*] } { + return 0 + } + + if { [istarget *-*-linux*aout*] \ + || [istarget *-*-linux*oldld*] } { + return 0 + } + return 1 +} + +# # simple_diff # compares two files line-by-line # returns differences if exist @@ -685,7 +708,11 @@ proc run_dump_test { name } { # Perhaps link the file(s). if { $run_ld } { set objfile "tmpdir/dump" - set cmd "$LD $LDFLAGS $opts(ld) -o $objfile $objfiles" + + # Add -L$srcdir/$subdir so that the linker command can use + # linker scripts in the source directory. + set cmd "$LD $LDFLAGS -L$srcdir/$subdir \ + $opts(ld) -o $objfile $objfiles" send_log "$cmd\n" set cmdret [catch "exec $cmd" comp_output] |