URL
https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk
Subversion Repositories open8_urisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/open8_urisc/trunk/gnu/binutils/ld
- from Rev 97 to Rev 98
- ↔ Reverse comparison
Rev 97 → Rev 98
/testsuite/ld-scripts/alignof.s
0,0 → 1,9
|
.text |
.p2align 6 |
.long 0 |
|
.data |
.p2align 4 |
.long 0 |
|
/testsuite/ld-scripts/empty-address-1.s
0,0 → 1,5
.text |
.global _start |
_start: |
.long __data_start |
.long __data_end |
/testsuite/ld-scripts/phdrs.s
0,0 → 1,8
.text |
|
.long 1 |
|
.data |
|
.long 2 |
|
/testsuite/ld-scripts/expr1.d
0,0 → 1,2
# ld: -T expr1.t |
# error: undefined section .* in expression |
/testsuite/ld-scripts/alignof.t
0,0 → 1,15
SECTIONS { |
.text : |
{ |
tmpdir/alignof.o (.text) |
} |
.data : |
{ |
tmpdir/alignof.o (.data) |
LONG (ALIGNOF(.text)) |
LONG (ALIGNOF(.data)) |
} |
} |
|
alignof_text = ALIGNOF(.text); |
alignof_data = ALIGNOF(.data); |
/testsuite/ld-scripts/empty-address-1.t
0,0 → 1,11
SECTIONS |
{ |
.text 0x0000000: { *(.text) } |
.data 0x2000000: |
{ |
__data_start = . ; |
*(.data) |
} |
__data_end = .; |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/phdrs.t
0,0 → 1,16
PHDRS |
{ |
header PT_PHDR PHDRS ; |
text PT_LOAD FILEHDR PHDRS ; |
data PT_LOAD ; |
} |
|
SECTIONS |
{ |
/* This test will fail on architectures where the startaddress below |
is less than the constant MAXPAGESIZE. */ |
. = 0x800000 + SIZEOF_HEADERS; |
.text : { *(.text) } :text |
.data : { *(.data) } :data |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/rgn-over1.t
0,0 → 1,13
/* Memory region overflow tests: one region, first output sect doesn't fit. */ |
|
MEMORY { |
bss (rwx) : ORIGIN = 0, LENGTH = 0 |
r1 (rwx) : ORIGIN = 0x1000, LENGTH = 8 |
} |
_start = 0x1000; |
SECTIONS { |
.bss : { *(.bss) } > bss |
.text : { *(.txt) } > r1 |
.data : { *(.dat) } > r1 |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/include-1.t
0,0 → 1,4
|
INCLUDE include-mem.t |
_start = 0x1000; |
INCLUDE include-sections.t |
/testsuite/ld-scripts/empty-address-2a.t
0,0 → 1,7
SECTIONS |
{ |
.text : { *(.text) } |
.data : { *(.data) } |
__data_end = .; |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/sort_n_a-a.s
0,0 → 1,16
.section .text2 |
.p2align 3 |
text2a: |
.long 0 |
.section .text3 |
.p2align 5 |
text3a: |
.long 0 |
.section .text1 |
.p2align 5 |
text1a: |
.long 0 |
.text |
texta: |
.p2align 4 |
.long 0 |
/testsuite/ld-scripts/phdrs3.d
0,0 → 1,4
# name: PHDRS headers |
# source: phdrs.s |
# ld: -T phdrs3.t |
# error: \A[^ \n]*:[^:\n]*:5: PHDRS and FILEHDR.* |
/testsuite/ld-scripts/sort_no.t
0,0 → 1,5
SECTIONS |
{ |
.text : {*(.text*)} |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/rgn-over5.t
0,0 → 1,14
/* Memory region overflow tests: overflow LMA but not VMA. */ |
|
MEMORY { |
bss (rwx) : ORIGIN = 0, LENGTH = 0 |
r1 (rwx) : ORIGIN = 0x1000, LENGTH = 24 |
v1 (rwx) : ORIGIN = 0x2000, LENGTH = 8 |
} |
_start = 0x1000; |
SECTIONS { |
.bss : { *(.bss) } > bss |
.text : { *(.txt) } > r1 AT> v1 |
.data : { *(.dat) } > r1 AT> v1 |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/provide-1.d
0,0 → 1,9
#source: provide-1.s |
#ld: -T provide-1.t |
#objdump: -s -j .data |
|
.*: file format .* |
|
Contents of section .data: |
[0-9a-f]* (1020)?0000(2010)? (2020)?0000(2020)? 00000000 .* |
#pass |
/testsuite/ld-scripts/sort_b_a.s
0,0 → 1,16
.section .text2 |
.p2align 3 |
text2: |
.long 0 |
.section .text3 |
.p2align 6 |
text3: |
.long 0 |
.section .text1 |
.p2align 5 |
text1: |
.long 0 |
.text |
text: |
.p2align 4 |
.long 0 |
/testsuite/ld-scripts/weak.t
0,0 → 1,12
SECTIONS |
{ |
.text 0x1000 : { |
tmpdir/weak1.o(.data) |
} |
.data 0x2000 : { |
tmpdir/weak2.o(.data) |
} |
/DISCARD/ : { |
*(*) |
} |
} |
/testsuite/ld-scripts/default-script2.d
0,0 → 1,9
# source: default-script.s |
# ld: -T default-script.t -defsym _START=0x8000000 |
# nm: -n |
|
#... |
0*8000000 . _START |
#... |
0*9000000 T text |
#pass |
/testsuite/ld-scripts/sort_b_a.t
0,0 → 1,5
SECTIONS |
{ |
.text : {*(SORT_BY_ALIGNMENT(.text*))} |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/cross1.c
0,0 → 1,6
extern int foo (); |
int |
func () |
{ |
return foo (); |
} |
/testsuite/ld-scripts/rgn-at2.d
0,0 → 1,15
# name: rgn-at2 |
# source: rgn-at.s |
# ld: -T rgn-at2.t |
# objdump: -w -h |
# xfail: rx-*-* |
# FAILS on the RX because the linker has to set LMA == VMA for the |
# Renesas loader. |
|
.*: file format .* |
|
Sections: |
Idx +Name +Size +VMA +LMA +File off +Algn +Flags |
0 .text +0+[0-9a-f][0-9a-f] +0+0010000 +0+0020000 +.* |
1 .data +0+[0-9a-f][0-9a-f] +0+0030000 +0+0030000 +.* |
2 .bss +0+[0-9a-f][0-9a-f] +0+00300[0-9a-f]+ +0+00300[0-9a-f]+ +.* |
/testsuite/ld-scripts/expr1.s
0,0 → 1,2
.word 0 |
|
/testsuite/ld-scripts/expr1.t
0,0 → 1,12
ENTRY(RAM) |
|
MEMORY |
{ |
ram (rwx) : ORIGIN = 0, LENGTH = 0x1000000 |
} |
|
SECTIONS |
{ |
.text : { } >ram |
} |
RAM = ADDR(ram); |
/testsuite/ld-scripts/align2c.d
0,0 → 1,2
# ld: -T align2.t |
# error: undefined symbol.*in expression |
/testsuite/ld-scripts/defined2.d
0,0 → 1,22
#ld: -Tdefined2.t |
#nm: -B |
#source: phdrs.s |
#xfail: "rs6000-*-aix*" |
|
# Check that arithmetic on DEFINED works. |
# Matching both A and T accounts for formats that can't tell a .text |
# symbol from an absolute symbol (mmo), but matches whatever section that |
# contains an address matching the value. The symbol sym1 is supposed to |
# be in the .text section for all targets, though. |
|
#... |
0+1 [AT] defined1 |
#... |
0+11 A defined2 |
#... |
0+100 A defined3 |
#... |
0+1ff A defined4 |
#... |
0+3 T sym1 |
#pass |
/testsuite/ld-scripts/phdrs3.t
0,0 → 1,16
PHDRS |
{ |
data PT_LOAD ; |
header PT_PHDR PHDRS ; /* OK */ |
text PT_LOAD FILEHDR PHDRS ; |
} |
|
SECTIONS |
{ |
/* This test will fail on architectures where the startaddress below |
is less than the constant MAXPAGESIZE. */ |
. = 0x800000 + SIZEOF_HEADERS; |
.text : { *(.text) } :text |
.data : { *(.data) } :data |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/assert2.d
0,0 → 1,3
# source: assert.s |
# ld: -T assert2.t |
# error: assert failed |
/testsuite/ld-scripts/provide-1.s
0,0 → 1,4
.data |
.globl foo |
foo: .long 0 |
.p2align 4 |
/testsuite/ld-scripts/provide-1.t
0,0 → 1,12
SECTIONS |
{ |
.data 0x2000 : |
{ |
LONG (foo) |
LONG (bar) |
. = ALIGN (0x10); |
*(.data) |
} |
PROVIDE (foo = .); |
PROVIDE (bar = .); |
} |
/testsuite/ld-scripts/expr.exp
0,0 → 1,25
# Test expressions in a linker script. |
# By Nathan Sidwell, CodeSourcery LLC |
# Copyright 2006, 2007, 2010 |
# 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. |
|
run_dump_test expr1 |
run_dump_test expr2 |
run_dump_test sane1 |
/testsuite/ld-scripts/region-alias-1.t
0,0 → 1,7
MEMORY |
{ |
MY_REGION (ARX) : ORIGIN = 0, LENGTH = 32K |
} |
|
REGION_ALIAS ("MY_ALIAS", MY_REGION); |
REGION_ALIAS ("MY_ALIAS", MY_REGION); |
/testsuite/ld-scripts/sort_b_a_a-3.d
0,0 → 1,23
#source: sort_n_a-a.s |
#source: sort_n_a-b.s |
#ld: -T sort_b_a_a.t --sort-section name |
#name: SORT_BY_ALIGNMENT(SORT_BY_ALIGNMENT()) --sort-section name |
#nm: -n |
|
#... |
0[0-9a-f]* t text3b |
#... |
0[0-9a-f]* t text1a |
#... |
0[0-9a-f]* t text1b |
#... |
0[0-9a-f]* t text3a |
#... |
0[0-9a-f]* t texta |
#... |
0[0-9a-f]* t textb |
#... |
0[0-9a-f]* t text2a |
#... |
0[0-9a-f]* t text2b |
#pass |
/testsuite/ld-scripts/empty-address.exp
0,0 → 1,32
# Make sure that "dot" is updated for empty sections if their addresses |
# are set. |
# Copyright 2006, 2007, 2009 |
# 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. |
|
if [istarget "x86_64-*-mingw*"] then { |
set LDFLAGS "$LDFLAGS --image-base 0" |
} |
|
run_dump_test empty-address-1 |
run_dump_test empty-address-2a |
run_dump_test empty-address-2b |
run_dump_test empty-address-3a |
run_dump_test empty-address-3b |
run_dump_test empty-address-3c |
/testsuite/ld-scripts/cross1.t
0,0 → 1,10
NOCROSSREFS ( .text .data ) |
SECTIONS |
{ |
.dynsym : { *(.dynsym) } |
.dynstr : { *(.dynstr) } |
.hash : { *(.hash) } |
.toc : { *(.toc) } |
.text : { tmpdir/cross1.o } |
.data : { tmpdir/cross2.o } |
} |
/testsuite/ld-scripts/rgn-at2.t
0,0 → 1,14
/* Memory region at test, >AT should propagate by default */ |
|
MEMORY { |
ram : ORIGIN = 0x10000, LENGTH = 0x100 |
rom : ORIGIN = 0x20000, LENGTH = 0x200 |
other : ORIGIN = 0x30000, LENGTH = 0x200 |
} |
_start = 0x1000; |
SECTIONS { |
.text : { *(.text) } >ram AT>rom |
.data : { *(.data) } >other /* No default AT>rom */ |
.bss : { *(.bss) } >other |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/include.exp
0,0 → 1,40
# Test for proper diagnosis of overflowed memory regions. |
# Copyright 2008, 2009 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. |
|
load_lib ld-lib.exp |
|
if [is_aout_format] { |
return |
} |
|
set old_ldflags $LDFLAGS |
if { [istarget spu*-*-*] } { |
set LDFLAGS "$LDFLAGS --local-store 0:0 --no-overlays" |
} |
|
set test_list [lsort [glob -nocomplain $srcdir/$subdir/include*.d]] |
foreach test_file $test_list { |
set test_name [file rootname $test_file] |
set map_file "tmpdir/[file tail $test_name].map" |
verbose $test_name |
run_dump_test $test_name |
} |
|
set LDFLAGS $old_ldflags |
/testsuite/ld-scripts/empty-orphan.exp
0,0 → 1,37
# Make sure orphan sections do not lead to huge output files. |
# By David Heine, Tensilica, Inc. |
# Copyright 2005, 2006, 2007, 2009 |
# 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 |
} |
|
set old_ldflags $LDFLAGS |
if { [istarget spu*-*-*] } { |
set LDFLAGS "$LDFLAGS --local-store 0:0" |
} |
|
set testname "empty-orphan" |
|
run_dump_test empty-orphan |
|
set LDFLAGS $old_ldflags |
/testsuite/ld-scripts/section-match-1.d
0,0 → 1,16
#source: section-match-1.s |
#ld: -T section-match-1.t |
#objdump: -s |
#notarget: *-*-osf* *-*-aix* *-*-pe *-*-*aout *-*-*oldld *-*-ecoff *-*-netbsd *-*-vms h8300-*-* tic30-*-* |
# This test uses arbitary section names, which are not support by some |
# file formts. Also these section names must be present in the |
# output, not translated into some other name, eg .text |
|
.*: file format .* |
|
#... |
Contents of section \.secA: |
[0-9a-f]* (01)?0+(01)? .* |
Contents of section \.secC: |
[0-9a-f]* (02)?0+(02)? .* |
#pass |
/testsuite/ld-scripts/align2c.s
0,0 → 1,4
.text |
.long 0 |
.data |
.long 0x12345678 |
/testsuite/ld-scripts/crossref.exp
0,0 → 1,140
# Test NOCROSSREFS in a linker script. |
# By Ian Lance Taylor, Cygnus Support. |
# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 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. |
|
set test1 "NOCROSSREFS 1" |
set test2 "NOCROSSREFS 2" |
set test3 "NOCROSSREFS 3" |
|
if { ![is_remote host] && [which $CC] == 0 } { |
untested $test1 |
untested $test2 |
untested $test3 |
return |
} |
|
# 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" |
} |
|
# 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" |
} |
|
# 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" |
} |
|
# The .dsbt section and __c6xabi_DSBT_BASE are not defined in our test |
# linker scripts. |
if [istarget tic6x*-*-*] { |
set CFLAGS "-mno-dsbt -msdata=none" |
} |
|
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 |
} |
|
set flags [big_or_little_endian] |
|
if [istarget sh64*-*-elf] { |
# This is what gcc passes to ld by default. |
set flags "-mshelf32" |
} |
|
# IA64 has both ordered and unordered sections in an input file. |
setup_xfail ia64-*-* |
|
set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o"] |
|
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" |
if [regexp "prohibited cross reference from .* to `.*foo' in" $exec_output] { |
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 |
} |
|
set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o"] |
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 |
} |
} |
|
# 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 |
} |
|
set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross3 -T $srcdir/$subdir/cross3.t tmpdir/cross3-partial.o tmpdir/cross2.o"] |
|
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 |
} |
/testsuite/ld-scripts/defined2.t
0,0 → 1,9
SECTIONS { |
.text : { *(.text) sym1 = 3 - DEFINED (x); } |
.data : { *(.data) } |
.bss : { *(.bss) *(COMMON) } |
} |
defined1 = !DEFINED (x); |
defined2 = DEFINED (defined1) + 16; |
defined3 = DEFINED (defined2) * 256; |
defined4 = 0x200 - DEFINED (defined3); |
/testsuite/ld-scripts/rgn-at.exp
0,0 → 1,33
# Test for proper diagnosis of overflowed memory regions. |
# Copyright 2009 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. |
|
if ![is_elf_format] { |
return |
} |
|
load_lib ld-lib.exp |
|
set test_list [lsort [glob -nocomplain $srcdir/$subdir/rgn-at*.d]] |
foreach test_file $test_list { |
set test_name [file rootname $test_file] |
set map_file "tmpdir/[file tail $test_name].map" |
verbose $test_name |
run_dump_test $test_name |
} |
/testsuite/ld-scripts/assert2.t
0,0 → 1,33
ASSERT(2 * 2 == 5, "assert failed"); |
/testsuite/ld-scripts/sort_b_a_n-1.d
0,0 → 1,23
#source: sort_n_a-a.s |
#source: sort_n_a-b.s |
#ld: -T sort_b_a_n.t |
#name: SORT_BY_ALIGNMENT(SORT_BY_NAME()) |
#nm: -n |
|
#... |
0[0-9a-f]* t text3b |
#... |
0[0-9a-f]* t text1a |
#... |
0[0-9a-f]* t text1b |
#... |
0[0-9a-f]* t text3a |
#... |
0[0-9a-f]* t texta |
#... |
0[0-9a-f]* t textb |
#... |
0[0-9a-f]* t text2a |
#... |
0[0-9a-f]* t text2b |
#pass |
/testsuite/ld-scripts/phdrs3a.d
0,0 → 1,9
#name: PHDRS headers 3a |
#source: phdrs.s |
#ld: -T phdrs3a.t |
#readelf: -l --wide |
|
#... |
[ \t]+LOAD[ x0-9a-f]+ R [ x0-9a-f]+ |
[ \t]+LOAD[ x0-9a-f]+ E [ x0-9a-f]+ |
#pass |
/testsuite/ld-scripts/sane1.d
0,0 → 1,33
# source: data.s |
# ld: -T sane1.t |
# nm: -B |
# notarget: mmix-* pdp11-* rs6000-*-aix* tic30-*-aout |
# mmix symbol sections are wrong, pdp sign extends 16-bit addresses |
# rs6000-aix and tic30 don't like empty .text |
|
#... |
0+8004 D d1 |
0+8024 D d2 |
0+0020 A diff |
0+0100 A e1 |
0+0080 A e2 |
0+8000 A e3 |
0+0090 A prod |
0+8002 D s1 |
0+8001 D s2 |
0+8007 D s3 |
0+8002 A s4 |
0+0004 A s5 |
0+19a0 A s6 |
0+8020 D s_diff |
0+8090 D s_prod |
0+8028 D s_sum |
0+8020 D s_sum_neg |
0+0028 A sum |
0+0020 A sum_neg |
0+8002 D x1 |
0+8001 D x2 |
0+8007 D x3 |
0+8002 A x4 |
0+0004 A x5 |
0+19a0 A x6 |
/testsuite/ld-scripts/rgn-over.exp
0,0 → 1,54
# Test for proper diagnosis of overflowed memory regions. |
# Copyright 2007, 2008 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. |
|
if ![is_elf_format] { |
return |
} |
|
load_lib ld-lib.exp |
|
set old_ldflags $LDFLAGS |
if { [istarget spu*-*-*] } { |
set LDFLAGS "$LDFLAGS --no-overlays" |
} |
|
set test_list [lsort [glob -nocomplain $srcdir/$subdir/rgn-over*.d]] |
foreach test_file $test_list { |
set test_name [file rootname $test_file] |
set map_file "tmpdir/[file tail $test_name].map" |
verbose $test_name |
run_dump_test $test_name |
|
if { ! [regexp ".*-ok.d" $test_file] } { |
set testname "[file tail $test_name] (map check)" |
if [file exists $map_file] { |
# compare the map file to the expectations in the .d file |
# (run_dump_test can't do that). |
if [regexp_diff $map_file $test_file] { |
fail $testname |
} else { |
pass $testname |
} |
} else { |
untested $testname |
} |
} |
} |
set LDFLAGS $old_ldflags |
/testsuite/ld-scripts/map-address.exp
0,0 → 1,47
# Test address printed by --print-map |
# Copyright 2002, 2005, 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. |
|
set testname "map addresses" |
|
# The source file doesn't matter. Pinch one from the sizeof test. |
if {![ld_assemble $as $srcdir/$subdir/sizeof.s tmpdir/map-address.o]} { |
unresolved $testname |
return |
} |
|
if {![ld_simple_link $ld tmpdir/map-address \ |
"-T $srcdir/$subdir/map-address.t \ |
tmpdir/map-address.o \ |
-Map tmpdir/map-address.map"]} { |
fail $testname |
return |
} |
|
if [is_remote host] then { |
remote_upload host "tmpdir/map_address.map" |
} |
|
if {[regexp_diff \ |
"tmpdir/map-address.map" \ |
"$srcdir/$subdir/map-address.d"]} { |
fail $testname |
} else { |
pass $testname |
} |
/testsuite/ld-scripts/phdrs2.exp
0,0 → 1,75
# Test PHDRS with empty sections in a linker script. |
# Copyright 2006, 2005, 2007, 2010 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. |
|
# PHDRS2 is only meaningful for ELF. |
if { ![istarget *-*-sysv4*] \ |
&& ![istarget *-*-unixware*] \ |
&& ![istarget *-*-elf*] \ |
&& ![istarget *-*-eabi*] \ |
&& ![istarget hppa*64*-*-hpux*] \ |
&& ![istarget *-*-linux*] \ |
&& ![istarget *-*-gnu*] \ |
&& ![istarget *-*-irix5*] \ |
&& ![istarget *-*-irix6*] \ |
&& ![istarget *-*-solaris2*] } { |
return |
} |
|
if { [istarget *-*-linux*aout*] \ |
|| [istarget *-*-linux*oldld*] } { |
return |
} |
|
# This is a very simplistic test. |
|
set testname "PHDRS2" |
|
set ldopt "" |
if { [istarget spu*-*-*] } { |
set ldopt "--local-store 0:0" |
} |
|
if ![ld_assemble $as $srcdir/$subdir/phdrs2.s tmpdir/phdrs2.o] { |
unresolved $testname |
return |
} |
|
set phdrs_regexp \ |
".*Program Header:.*LOAD *off *0x00\[0-9a-f\]* *vaddr *0x00*800000 *paddr *0x00*800000.*filesz *0x0\[0-9a-f\]* *memsz *0x0\[0-9a-f\]*.*LOAD *off *0x00\[0-9a-f\]* *vaddr *0x00*800004 *paddr *0x00*800004.*filesz *0x00*\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* *flags rw.*" |
|
set ldopt "$ldopt -T $srcdir/$subdir/phdrs2.t tmpdir/phdrs2.o" |
if ![ld_simple_link $ld tmpdir/phdrs2 $ldopt] { |
fail $testname |
} else { |
if {![is_remote host] && [which $objdump] == 0} { |
unresolved $testname |
return |
} |
|
set exec_output [run_host_cmd "$objdump" "--private-headers tmpdir/phdrs2"] |
set exec_output [prune_warnings $exec_output] |
verbose -log $exec_output |
|
if [regexp $phdrs_regexp $exec_output] { |
pass $testname |
} else { |
fail $testname |
} |
} |
/testsuite/ld-scripts/section-match-1.s
0,0 → 1,5
.section .sec.foo |
.word 1 |
|
.section .sec..foo |
.word 2 |
/testsuite/ld-scripts/section-match-1.t
0,0 → 1,16
SECTIONS |
{ |
/* .secA should collect all sections with a prefix of ".sec." |
except for those with a prefix of ".sec..". */ |
.secA : { *(*.sec.[^.]*) } |
|
/* .secB should be empty because .secA will have taken all of |
the potential matches. */ |
.secB : { *(*.sec.[!.]*) } |
|
/* .secC should match any sections with a ".sec.." prefix. */ |
.secC : { *(*.sec.*) } |
|
/* Ignore anything else. */ |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/sizeof.s
0,0 → 1,16
.space 16 |
/testsuite/ld-scripts/sizeof.t
0,0 → 1,17
SECTIONS { |
.text : |
{ |
text_start = .; |
tmpdir/sizeof.o |
text_end = .; |
} |
.data : |
{ |
data_start = .; |
. = . + SIZEOF(.text); |
data_end = .; |
} |
} |
|
sizeof_text = SIZEOF(.text); |
sizeof_data = SIZEOF(.data); |
/testsuite/ld-scripts/assert.s
0,0 → 1,17
|
/testsuite/ld-scripts/provide.exp
0,0 → 1,45
# Test PROVIDE in a linker script. |
# By Nathan Sidwell, CodeSourcery LLC |
# Copyright 2004, 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. |
|
# AIX maps .text and .data to other sections. |
# a.out objdump displays the file header inside the text segment, |
# confusing run_dump_test. |
|
if {[istarget "rs6000-*-aix*"] || [is_aout_format]} { |
unsupported provide-1 |
unsupported provide-2 |
unsupported provide-3 |
return |
} |
|
global LDFLAGS |
set saved_LDFLAGS "$LDFLAGS" |
if [istarget "x86_64-*-mingw*"] then { |
set LDFLAGS "$LDFLAGS --image-base 0" |
} |
|
run_dump_test provide-1 |
run_dump_test provide-2 |
setup_xfail *-*-* |
run_dump_test provide-3 |
|
set LDFLAGS "$saved_LDFLAGS" |
/testsuite/ld-scripts/assert.t
0,0 → 1,10
SECTIONS |
{ |
.empty : { |
here = . == ADDR(.empty); |
ASSERT (. == ADDR(.empty), "dot is not ADDR"); |
ASSERT (here, "here is zero"); |
} |
ASSERT (!SIZEOF(.empty), "Empty is not empty") |
/DISCARD/ : { *(.reginfo) } |
} |
/testsuite/ld-scripts/rgn-over2.d
0,0 → 1,35
# name: rgn-over2 |
# source: rgn-over.s |
# ld: -T rgn-over2.t -Map tmpdir/rgn-over2.map |
# error: \A[^ \n]*?ld[^:\n]*?: [^\n]*?section `\.data' will not fit in region `r1'\n[^ \n]*?ld[^:\n]*?: region `r1' overflowed by 4 bytes\Z |
|
Discarded input sections |
#... |
Memory\s+Configuration |
|
Name\s+Origin\s+Length\s+Attributes |
bss\s+0x0+0000\s+0x0+0000\s+xrw |
r1\s+0x0+1000\s+0x0+0014\s+xrw |
\*default\*\s+0x0+0000\s+0xf+ffff |
|
Linker\s+script\s+and\s+memory\s+map |
|
\s*0x0+1000\s+_start\s+=\s+0x1000 |
|
\s*\.bss\s+0x0+0000\s+0x0 |
\s*\*\(\.bss\) |
\s*\.bss\s+0x0+0000\s+0x0\s+.*? |
|
\s*\.text\s+0x0+1000\s+0xc |
\s*\*\(\.txt\) |
\s*\.txt\s+0x0+1000\s+0xc\s+.*? |
|
\s*\.data\s+0x0+100c\s+0xc |
\s*\*\(\.dat\) |
\s*\.dat\s+0x0+100c\s+0xc\s+.*? |
|
/DISCARD/ |
\*\(\*\) |
LOAD\s+.*? |
OUTPUT\(.*?\) |
#pass |
/testsuite/ld-scripts/sort_b_n_n-2.d
0,0 → 1,23
#source: sort_n_a-a.s |
#source: sort_n_a-b.s |
#ld: -T sort_b_n_n.t --sort-section name |
#name: SORT_BY_NAME(SORT_BY_NAME()) --sort-section name |
#nm: -n |
|
#... |
0[0-9a-f]* t texta |
#... |
0[0-9a-f]* t textb |
#... |
0[0-9a-f]* t text1a |
#... |
0[0-9a-f]* t text1b |
#... |
0[0-9a-f]* t text2a |
#... |
0[0-9a-f]* t text2b |
#... |
0[0-9a-f]* t text3a |
#... |
0[0-9a-f]* t text3b |
#pass |
/testsuite/ld-scripts/empty-address-2b.d
0,0 → 1,9
#source: empty-address-2.s |
#ld: -Ttext 0x0000000 -Tdata 0x2000000 -T empty-address-2b.t |
#nm: -n |
#notarget: frv-*-*linux* *-*-linux*aout *-*-linux*oldld |
#... |
0+0 T _start |
#... |
0+10 A __data_end |
#pass |
/testsuite/ld-scripts/phdrs3a.t
0,0 → 1,15
PHDRS |
{ |
data PT_LOAD FILEHDR PHDRS FLAGS(4); |
text PT_LOAD FILEHDR PHDRS FLAGS(1); |
} |
|
SECTIONS |
{ |
/* This test will fail on architectures where the startaddress below |
is less than the constant MAXPAGESIZE. */ |
. = 0x800000 + SIZEOF_HEADERS; |
.text : { *(.text) } :text |
.data : { *(.data) } :data |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/rgn-over6.d
0,0 → 1,36
# name: rgn-over6 |
# source: rgn-over.s |
# ld: -T rgn-over6.t -Map tmpdir/rgn-over6.map |
# error: \A[^ \n]*?ld[^:\n]*?: [^\n]*?section `\.text' will not fit in region `r1'\n[^ \n]*?ld[^:\n]*?: [^\n]*?section `\.text' will not fit in region `v1'\n[^ \n]*?ld[^:\n]*?: region `r1' overflowed by 16 bytes\n[^ \n]*?ld[^:\n]*?: region `v1' overflowed by 16 bytes\Z |
|
Discarded input sections |
#... |
Memory\s+Configuration |
|
Name\s+Origin\s+Length\s+Attributes |
bss\s+0x0+0000\s+0x0+0000\s+xrw |
r1\s+0x0+1000\s+0x0+0008\s+xrw |
v1\s+0x0+2000\s+0x0+0008\s+xrw |
\*default\*\s+0x0+0000\s+0xf+ffff |
|
Linker\s+script\s+and\s+memory\s+map |
|
\s*0x0+1000\s+_start\s+=\s+0x1000 |
|
\s*\.bss\s+0x0+0000\s+0x0 |
\s*\*\(\.bss\) |
\s*\.bss\s+0x0+0000\s+0x0\s+.*? |
|
\s*\.text\s+0x0+1000\s+0xc\s+load\s+address\s+0x0+2000 |
\s*\*\(\.txt\) |
\s*\.txt\s+0x0+1000\s+0xc\s+.*? |
|
\s*\.data\s+0x0+100c\s+0xc\s+load\s+address\s+0x0+200c |
\s*\*\(\.dat\) |
\s*\.dat\s+0x0+100c\s+0xc\s+.*? |
|
/DISCARD/ |
\*\(\*\) |
LOAD\s+.*? |
OUTPUT\(.*?\) |
#pass |
/testsuite/ld-scripts/sort_b_a_n.t
0,0 → 1,5
SECTIONS |
{ |
.text : {*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.text*)))} |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/sane1.t
0,0 → 1,36
LD_FEATURE("SANE_EXPR") |
e1 = 0x100; |
e2 = 0x80; |
e3 = e1 * e2; |
SECTIONS |
{ |
. = e3; |
.data : |
{ |
d1 = 4; |
. += d1 + 5 << 2; |
d2 = .; |
s_diff = d2 - d1; |
s_sum_neg = d2 + -d1; |
s_sum = d2 + d1; |
s_prod = d2 * d1; |
s1 = d1 - 2; |
s2 = d2 % 5; |
s3 = d2 / 5; |
s4 = ABSOLUTE (d1) - 2; |
s5 = ABSOLUTE (d2) % 5; |
s6 = ABSOLUTE (d2) / 5; |
} |
/DISCARD/ : {*(*)} |
|
diff = d2 - d1; |
sum_neg = d2 + -d1; |
sum = d2 + d1; |
prod = d2 * d1; |
x1 = d1 - 2; |
x2 = d2 % 5; |
x3 = d2 / 5; |
x4 = ABSOLUTE (d1) - 2; |
x5 = ABSOLUTE (d2) % 5; |
x6 = ABSOLUTE (d2) / 5; |
} |
/testsuite/ld-scripts/empty-aligned.d
0,0 → 1,14
#source: empty-aligned.s |
#ld: -T empty-aligned.t |
#readelf: -l --wide |
#xfail: "hppa64-*-*" |
#notarget: frv-*-*linux* |
|
#... |
Program Headers: |
+Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg +Align |
+LOAD +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ [RWE ]+ +0x[0-9a-f]+ |
|
Section to Segment mapping: |
+Segment Sections\.\.\. |
+00 +.text |
/testsuite/ld-scripts/empty-address-2.s
0,0 → 1,5
.text |
.global _start |
_start: |
.long __data_end |
.p2align 4 |
/testsuite/ld-scripts/map-address.d
0,0 → 1,12
#... |
Linker script and memory map |
#... |
*0x0*000020 *def1 = .* |
*0x0*000020 *def2 = def1 |
*0x0*010001 *\. = 0x10001 |
*0x0*010001 *foo = \. |
*0x0*010201 *\. = \(\. \+ 0x200\) |
*0x0*010201 *bar = \. |
*0x0*010204 *\. = ALIGN \(0x4\) |
*0x0*010204 *frob = \. |
#pass |
/testsuite/ld-scripts/expr2.d
0,0 → 1,7
# ld: -T expr2.t |
#nm: -B |
#xfail: rs6000-*-aix* arm-*-*aout |
|
#... |
.* D defined |
#pass |
/testsuite/ld-scripts/rgn-over2.t
0,0 → 1,14
/* Memory region overflow tests: one region, first output sect fits, |
second doesn't. */ |
|
MEMORY { |
bss (rwx) : ORIGIN = 0, LENGTH = 0 |
r1 (rwx) : ORIGIN = 0x1000, LENGTH = 20 |
} |
_start = 0x1000; |
SECTIONS { |
.bss : { *(.bss) } > bss |
.text : { *(.txt) } > r1 |
.data : { *(.dat) } > r1 |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/empty-address-2b.t
0,0 → 1,11
SECTIONS |
{ |
.text 0x0000000: { *(.text) } |
.data : |
{ |
PROVIDE (__data_start = .); |
*(.data) |
} |
__data_end = .; |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/sort_n_a-b.s
0,0 → 1,16
.section .text2 |
.p2align 3 |
text2b: |
.long 0 |
.section .text3 |
.p2align 6 |
text3b: |
.long 0 |
.section .text1 |
.p2align 5 |
text1b: |
.long 0 |
.text |
textb: |
.p2align 4 |
.long 0 |
/testsuite/ld-scripts/sort_b_n-1.d
0,0 → 1,14
#source: sort_b_n-1.s |
#ld: -T sort.t --sort-section name |
#name: --sort-section name |
#nm: -n |
|
#... |
0[0-9a-f]* t text |
#... |
0[0-9a-f]* t text1 |
#... |
0[0-9a-f]* t text2 |
#... |
0[0-9a-f]* t text3 |
#pass |
/testsuite/ld-scripts/rgn-over6.t
0,0 → 1,14
/* Memory region overflow tests: overflow LMA and VMA. */ |
|
MEMORY { |
bss (rwx) : ORIGIN = 0, LENGTH = 0 |
r1 (rwx) : ORIGIN = 0x1000, LENGTH = 8 |
v1 (rwx) : ORIGIN = 0x2000, LENGTH = 8 |
} |
_start = 0x1000; |
SECTIONS { |
.bss : { *(.bss) } > bss |
.text : { *(.txt) } > r1 AT> v1 |
.data : { *(.dat) } > r1 AT> v1 |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/sort_b_n.d
0,0 → 1,14
#source: sort_b_n.s |
#ld: -T sort_b_n.t |
#name: SORT_BY_NAME |
#nm: -n |
|
#... |
0[0-9a-f]* t text |
#... |
0[0-9a-f]* t text1 |
#... |
0[0-9a-f]* t text2 |
#... |
0[0-9a-f]* t text3 |
#pass |
/testsuite/ld-scripts/provide-2.d
0,0 → 1,7
#source: provide-2.s |
#ld: -T provide-2.t |
#nm: -B |
#... |
0+3 A baz |
0+2000 D foo |
#pass |
/testsuite/ld-scripts/rgn-at.s
0,0 → 1,6
.section .text |
.long 0x12345678 |
.section .data |
.long 0x9abcdef0 |
.section .bss |
.long 0 |
/testsuite/ld-scripts/section-match.exp
0,0 → 1,22
# Expect script for section regular expressions tests |
# Copyright (C) 2010 Free Software Foundation |
# |
# 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. |
# |
|
run_dump_test section-match-1 |
/testsuite/ld-scripts/sort.t
0,0 → 1,5
SECTIONS |
{ |
.text : {*(.text .text.*)} |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/align.s
0,0 → 1,2
.text |
.long 0 |
/testsuite/ld-scripts/default-script3.d
0,0 → 1,9
# source: default-script.s |
# ld: -defsym _START=0x8000000 -dT default-script.t |
# nm: -n |
|
#... |
0*8000000 . _START |
#... |
0*8000000 T text |
#pass |
/testsuite/ld-scripts/include-data.t
0,0 → 1,4
.data : { |
INCLUDE include-subdata.t |
__end = .; |
}>ram |
/testsuite/ld-scripts/cross2.c
0,0 → 1,5
int |
foo () |
{ |
return 1; |
} |
/testsuite/ld-scripts/align.t
0,0 → 1,8
SECTIONS |
{ |
.text : {*(.text)} |
.data ALIGN(0x40) : AT (ALIGN (LOADADDR (.text) + SIZEOF (.text), 0x80)) |
{} |
ASSERT (LOADADDR(.data) == 0x80, "dyadic ALIGN broken") |
ASSERT (ADDR(.data) == 0x40, "monadic ALIGN broken") |
} |
/testsuite/ld-scripts/assert.exp
0,0 → 1,36
# Test ASSERT in a linker script. |
# By Nathan Sidwell, CodeSourcery LLC |
# Copyright 2004, 2005, 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. |
|
set testname "ASSERT" |
|
if ![ld_assemble $as $srcdir/$subdir/assert.s tmpdir/assert.o] { |
unresolved $testname |
return |
} |
|
if ![ld_simple_link $ld tmpdir/assert "-T $srcdir/$subdir/assert.t tmpdir/assert.o"] { |
fail $testname |
} else { |
pass $testname |
} |
|
run_dump_test "assert2" |
/testsuite/ld-scripts/rgn-at3.d
0,0 → 1,15
# name: rgn-at3 |
# source: rgn-at.s |
# ld: -T rgn-at3.t |
# objdump: -w -h |
# xfail: rx-*-* |
# FAILS on the RX because the linker has to set LMA == VMA for the |
# Renesas loader. |
|
.*: file format .* |
|
Sections: |
Idx +Name +Size +VMA +LMA +File off +Algn +Flags |
0 .text +0+[0-9a-f][0-9a-f] +0+0010000 +0+0020000 +.* |
1 .data +0+[0-9a-f][0-9a-f] +0+00100[0-9a-f]+ +0+0030000 +.* |
2 .bss +0+[0-9a-f][0-9a-f] +0+00100[0-9a-f]+ +0+00300[0-9a-f]+ +.* |
/testsuite/ld-scripts/empty-aligned.s
0,0 → 1,2
.text |
.long 123 |
/testsuite/ld-scripts/expr2.s
0,0 → 1,4
.globl defined |
.data |
defined: |
.word 0 |
/testsuite/ld-scripts/empty-aligned.t
0,0 → 1,29
SECTIONS |
{ |
.text : { *(.text) } |
/* Alignment at beginning shouldn't result in empty section being kept. */ |
.text1 ALIGN (4096) : |
{ |
*(.text1) |
} |
/* Same for alignment at beginning and end. */ |
.text2 ALIGN (4096) : |
{ |
*(.text2) |
. = ALIGN (4096); |
} |
/* Same for alignment just at end, although we need to be careful in |
the expression used to align. */ |
.text3 : |
{ |
*(.text3) |
. = ALIGN (. != 0 ? 4096 : 1); |
} |
/* Same when setting vma and lma. This also shouldn't result in |
.text3 being kept. */ |
.text4 ADDR (.text3) + SIZEOF (.text3) + 8192 : AT (LOADADDR (.text3)) |
{ |
*(.text4) |
} |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/map-address.t
0,0 → 1,11
SECTIONS |
{ |
def1 = DEFINED(foo) ? 0x10 : 0x20; |
def2 = def1; |
. = 0x10001; |
foo = .; |
. += 0x200; |
bar = .; |
. = ALIGN (4); |
frob = .; |
} |
/testsuite/ld-scripts/expr2.t
0,0 → 1,11
SECTIONS |
{ |
. = 0xc000; |
.text : |
{ |
_text = .; |
*(.text) |
} |
_end = .; |
} |
ASSERT (_end - _text <= 0x100, "fail"); |
/testsuite/ld-scripts/defined3.d
0,0 → 1,35
#ld: -Tdefined3.t |
#nm: -B |
#source: phdrs.s |
#source: defined.s |
#xfail: "rs6000-*-aix*" |
|
# Check that DEFINED matches only symbols defined before its location. |
# The ellipsis account for target-specific symbols. Matching both A and T |
# accounts for formats that can't tell a .text symbol from an absolute |
# symbol (mmo), but matches whatever section that contains an address |
# matching the value. |
|
#... |
0+1 [AT] defined |
#... |
0+200 A defined1 |
#... |
0+201 A defined2 |
#... |
0+100 A defined3 |
#... |
0+ [AT] defined4 |
#... |
0+2a A defined5 |
#... |
0+ [AT] defined6 |
#... |
0+1 [AT] defined7 |
#... |
0+1 [AT] defined8 |
#... |
0+2a A sym1 |
#... |
[0-9a-f]+ T sym2 |
#pass |
/testsuite/ld-scripts/empty-address-3a.d
0,0 → 1,9
#source: empty-address-3.s |
#ld: -T empty-address-3a.t |
#nm: -n |
#notarget: mmix-knuth-mmixware |
#... |
0+0 T _start |
#... |
0+10 A __data_end |
#pass |
/testsuite/ld-scripts/sort_b_n-1.s
0,0 → 1,12
.section .text.2 |
text2: |
.long 0 |
.section .text.3 |
text3: |
.long 0 |
.section .text.1 |
text1: |
.long 0 |
.text |
text: |
.long 0 |
/testsuite/ld-scripts/sort_b_n.s
0,0 → 1,12
.section .text2 |
text2: |
.long 0 |
.section .text3 |
text3: |
.long 0 |
.section .text1 |
text1: |
.long 0 |
.text |
text: |
.long 0 |
/testsuite/ld-scripts/sort_b_n.t
0,0 → 1,5
SECTIONS |
{ |
.text : {*(SORT_BY_NAME(.text*))} |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/provide-2.s
0,0 → 1,8
.data |
.globl foo |
foo: .long 0 |
|
.globl baz |
.long baz |
|
.p2align 4 |
/testsuite/ld-scripts/provide-2.t
0,0 → 1,10
SECTIONS |
{ |
PROVIDE (foo = 1); |
PROVIDE (bar = 2); |
PROVIDE (baz = 3); |
.data 0x2000 : |
{ |
*(.data) |
} |
} |
/testsuite/ld-scripts/region-alias-2.t
0,0 → 1,6
MEMORY |
{ |
MY_REGION (ARX) : ORIGIN = 0, LENGTH = 32K |
} |
|
REGION_ALIAS ("MY_ALIAS", "NIL"); |
/testsuite/ld-scripts/cross2.t
0,0 → 1,6
NOCROSSREFS ( .text .data ) |
SECTIONS |
{ |
.text : { *(.text) *(.text.*) *(.pr) } |
.data : { *(.data) *(.data.*) *(.sdata) *(.rw) *(.tc0) *(.tc) *(.toc) } |
} |
/testsuite/ld-scripts/rgn-at3.t
0,0 → 1,13
/* Memory region at test, >AT should propagate by default */ |
|
MEMORY { |
ram : ORIGIN = 0x10000, LENGTH = 0x100 |
rom : ORIGIN = 0x20000, LENGTH = 0x200 |
} |
_start = 0x1000; |
SECTIONS { |
.text : { *(.text) } >ram AT>rom |
.data : AT (0x30000) { *(.data) } >ram /* NO default AT>rom */ |
.bss : { *(.bss) } >ram /* NO default AT>rom */ |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/align2.t
0,0 → 1,7
SECTIONS |
{ |
.text : {*(.text)} |
. = ALIGN(data_align); |
.data : {*(.data)} |
/DISCARD/ : {*(*)} |
} |
/testsuite/ld-scripts/defined3.t
0,0 → 1,15
defined6 = DEFINED (sym2) ? 1 : 0; |
SECTIONS { |
.text : { *(.text) sym2 = .; } |
.data : { *(.data) } |
.bss : { *(.bss) *(COMMON) } |
} |
defined4 = DEFINED (sym1) ? 1 : 0; |
sym1 = 42; |
defined3 = DEFINED (defined1) ? defined1 + 1 : 256; |
defined1 = DEFINED (defined1) ? defined1 + 1 : 512; |
defined2 = DEFINED (defined1) ? defined1 + 1 : 1024; |
defined5 = DEFINED (sym1) ? sym1 : 0; |
defined7 = DEFINED (sym2); |
defined8 = !DEFINED (defined8); |
defined = DEFINED (defined) ? defined : 42; |
/testsuite/ld-scripts/empty-address-3a.t
0,0 → 1,10
SECTIONS |
{ |
.text 0x00000000: { *(.text) } |
.data ALIGN(0x1000) + (. & (0x1000 - 1)): |
{ |
*(.data) |
} |
__data_end = .; |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/sort_b_n_a-1.d
0,0 → 1,23
#source: sort_n_a-a.s |
#source: sort_n_a-b.s |
#ld: -T sort_b_n_a.t |
#name: SORT_BY_NAME(SORT_BY_ALIGNMENT()) |
#nm: -n |
|
#... |
0[0-9a-f]* t texta |
#... |
0[0-9a-f]* t textb |
#... |
0[0-9a-f]* t text1a |
#... |
0[0-9a-f]* t text1b |
#... |
0[0-9a-f]* t text2a |
#... |
0[0-9a-f]* t text2b |
#... |
0[0-9a-f]* t text3b |
#... |
0[0-9a-f]* t text3a |
#pass |
/testsuite/ld-scripts/sort_b_a_n-2.d
0,0 → 1,23
#source: sort_n_a-a.s |
#source: sort_n_a-b.s |
#ld: -T sort_b_a_n.t --sort-section name |
#name: SORT_BY_ALIGNMENT(SORT_BY_NAME()) --sort-section name |
#nm: -n |
|
#... |
0[0-9a-f]* t text3b |
#... |
0[0-9a-f]* t text1a |
#... |
0[0-9a-f]* t text1b |
#... |
0[0-9a-f]* t text3a |
#... |
0[0-9a-f]* t texta |
#... |
0[0-9a-f]* t textb |
#... |
0[0-9a-f]* t text2a |
#... |
0[0-9a-f]* t text2b |
#pass |
/testsuite/ld-scripts/dynamic-sections.d
0,0 → 1,6
# nm: -C |
# ld: -T dynamic-sections.t |
# name: dynamic sections |
# source: dynamic-sections-1.s |
# source: dynamic-sections-2.s |
#pass |
/testsuite/ld-scripts/script.exp
0,0 → 1,139
# Test basic linker script functionality |
# By Ian Lance Taylor, Cygnus Support |
# Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2009, 2010 |
# 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. |
|
set testname "script" |
|
if ![ld_assemble $as $srcdir/$subdir/script.s tmpdir/script.o] { |
unresolved $testname |
return |
} |
|
proc check_script { } { |
global nm |
global testname |
global nm_output |
|
if ![ld_nm $nm "" tmpdir/script] { |
unresolved $testname |
return |
} |
|
if {![info exists nm_output(text_start)] \ |
|| ![info exists nm_output(text_end)] \ |
|| ![info exists nm_output(data_start)] \ |
|| ![info exists nm_output(data_end)]} { |
send_log "bad output from nm\n" |
verbose "bad output from nm" |
fail $testname |
return |
} |
|
set passes 1 |
set text_end 0x104 |
set data_end 0x1004 |
|
if [istarget *c4x*-*-*] then { |
set text_end 0x101 |
set data_end 0x1001 |
} |
|
if [istarget *c54x*-*-*] then { |
set text_end 0x102 |
set data_end 0x1002 |
} |
|
if {$nm_output(text_start) != 0x100} { |
send_log "text_start == $nm_output(text_start)\n" |
verbose "text_start == $nm_output(text_start)" |
set passes 0 |
} |
|
if {$nm_output(text_end) < $text_end \ |
|| $nm_output(text_end) > 0x110} { |
send_log "text_end == $nm_output(text_end)\n" |
verbose "text_end == $nm_output(text_end)" |
set passes 0 |
} |
|
if {$nm_output(data_start) != 0x1000} { |
send_log "data_start == $nm_output(data_start)\n" |
verbose "data_start == $nm_output(data_start)" |
set passes 0 |
} |
|
if {$nm_output(data_end) < $data_end \ |
|| $nm_output(data_end) > 0x1010} { |
send_log "data_end == $nm_output(data_end)\n" |
verbose "data_end == $nm_output(data_end)" |
set passes 0 |
} |
|
if { $passes } { |
pass $testname |
} else { |
fail $testname |
} |
} |
|
# PE targets need to set the image base to 0 to avoid complications from nm. |
set flags "" |
if {[istarget "*-*-pe*"] \ |
|| [istarget "*-*-cygwin*"] \ |
|| [istarget "*-*-mingw*"] \ |
|| [istarget "*-*-winnt*"] \ |
|| [istarget "*-*-nt"] \ |
|| [istarget "*-*-interix*"] } then { |
set flags "--image-base 0" |
} |
|
if ![ld_simple_link $ld tmpdir/script "$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] { |
fail $testname |
} else { |
check_script |
} |
|
set testname "MRI script" |
|
if ![ld_simple_link $ld tmpdir/script "$flags -c $srcdir/$subdir/scriptm.t"] { |
fail $testname |
} else { |
check_script |
} |
|
set testname "MEMORY" |
|
if ![ld_simple_link $ld tmpdir/script "$flags -T $srcdir/$subdir/memory.t tmpdir/script.o"] { |
fail $testname |
} else { |
check_script |
} |
|
set test_script_list [lsort [glob $srcdir/$subdir/region-alias-*.t]] |
|
foreach test_script $test_script_list { |
set testname [file tail $test_script] |
if ![ld_simple_link $ld tmpdir/script "$flags -T $test_script tmpdir/script.o"] { |
xfail "REGION_ALIAS: $testname" |
} else { |
xpass "REGION_ALIAS: $testname" |
} |
} |
/testsuite/ld-scripts/sort_no-1.d
0,0 → 1,14
#source: sort_b_n.s |
#ld: -T sort_no.t |
#name: no SORT_BY_NAME/SORT_BY_ALIGNMENT/SORT |
#nm: -n |
|
#... |
0[0-9a-f]* t text |
#... |
0[0-9a-f]* t text2 |
#... |
0[0-9a-f]* t text3 |
#... |
0[0-9a-f]* t text1 |
#pass |
/testsuite/ld-scripts/rgn-over3.d
0,0 → 1,36
# name: rgn-over3 |
# source: rgn-over.s |
# ld: -T rgn-over3.t -Map tmpdir/rgn-over3.map |
# error: \A[^ \n]*?ld[^:\n]*?: [^\n]*?section `\.text' will not fit in region `r1'\n[^ \n]*?ld[^:\n]*?: [^\n]*?section `\.data' will not fit in region `r2'\n[^ \n]*?ld[^:\n]*?: region `r1' overflowed by 4 bytes\n[^ \n]*?ld[^:\n]*?: region `r2' overflowed by 4 bytes\Z |
|
Discarded input sections |
#... |
Memory\s+Configuration |
|
Name\s+Origin\s+Length\s+Attributes |
bss\s+0x0+0000\s+0x0+0000\s+xrw |
r1\s+0x0+1000\s+0x0+0008\s+xrw |
r2\s+0x0+2000\s+0x0+0008\s+xrw |
\*default\*\s+0x0+0000\s+0xf+ffff |
|
Linker\s+script\s+and\s+memory\s+map |
|
\s*0x0+1000\s+_start\s+=\s+0x1000 |
|
\s*\.bss\s+0x0+0000\s+0x0 |
\s*\*\(\.bss\) |
\s*\.bss\s+0x0+0000\s+0x0\s+.*? |
|
\s*\.text\s+0x0+1000\s+0xc |
\s*\*\(\.txt\) |
\s*\.txt\s+0x0+1000\s+0xc\s+.*? |
|
\s*\.data\s+0x0+2000\s+0xc |
\s*\*\(\.dat\) |
\s*\.dat\s+0x0+2000\s+0xc\s+.*? |
|
/DISCARD/ |
\*\(\*\) |
LOAD\s+.*? |
OUTPUT\(.*?\) |
#pass |
/testsuite/ld-scripts/sort_b_n_n-3.d
0,0 → 1,23
#source: sort_n_a-a.s |
#source: sort_n_a-b.s |
#ld: -T sort_b_n_n.t --sort-section alignment |
#name: SORT_BY_NAME(SORT_BY_NAME()) --sort-section alignment |
#nm: -n |
|
#... |
0[0-9a-f]* t texta |
#... |
0[0-9a-f]* t textb |
#... |
0[0-9a-f]* t text1a |
#... |
0[0-9a-f]* t text1b |
#... |
0[0-9a-f]* t text2a |
#... |
0[0-9a-f]* t text2b |
#... |
0[0-9a-f]* t text3b |
#... |
0[0-9a-f]* t text3a |
#pass |
/testsuite/ld-scripts/empty-orphan.d
0,0 → 1,6
#source: empty-orphan.s |
#ld: -T empty-orphan.t |
#readelf: -l --wide |
#... |
+LOAD +[x0-9a-f]+ [x0]+70000000 [x0]+70000000 [x0]+(2|4|8|10|20|40|80) .* |
#pass |
/testsuite/ld-scripts/sort_b_n_a.t
0,0 → 1,5
SECTIONS |
{ |
.text : {*(SORT_BY_NAME(SORT_BY_ALIGNMENT(.text*)))} |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/dynamic-sections-1.s
0,0 → 1,2
.data |
.4byte foo |
/testsuite/ld-scripts/rgn-over7.d
0,0 → 1,36
# name: rgn-over7 |
# source: rgn-over.s |
# ld: -T rgn-over7.t -Map tmpdir/rgn-over7.map |
# error: \A[^ \n]*?ld[^:\n]*?: [^\n]*?section `\.text' will not fit in region `r1'\n[^ \n]*?ld[^:\n]*?: section \.data loaded at \[0+1008,0+1013\] overlaps section \.text loaded at \[0+1000,0+100b\]\n[^ \n]*?ld[^:\n]*?: region `r1' overflowed by 4 bytes\Z |
|
Discarded input sections |
#... |
Memory\s+Configuration |
|
Name\s+Origin\s+Length\s+Attributes |
bss\s+0x0+0000\s+0x0+0000\s+xrw |
r1\s+0x0+1000\s+0x0+0008\s+xrw |
r2\s+0x0+1008\s+0x0+000c\s+xrw |
\*default\*\s+0x0+0000\s+0xf+ffff |
|
Linker\s+script\s+and\s+memory\s+map |
|
\s*0x0+1000\s+_start\s+=\s+0x1000 |
|
\s*\.bss\s+0x0+0000\s+0x0 |
\s*\*\(\.bss\) |
\s*\.bss\s+0x0+0000\s+0x0\s+.*? |
|
\s*\.text\s+0x0+1000\s+0xc |
\s*\*\(\.txt\) |
\s*\.txt\s+0x0+1000\s+0xc\s+.*? |
|
\s*\.data\s+0x0+1008\s+0xc |
\s*\*\(\.dat\) |
\s*\.dat\s+0x0+1008\s+0xc\s+.*? |
|
/DISCARD/ |
\*\(\*\) |
LOAD\s+.*? |
OUTPUT\(.*?\) |
#pass |
/testsuite/ld-scripts/weak1.s
0,0 → 1,11
.data |
.global foo1 |
.global sym1 |
.weak sym2 |
foo1: |
.long sym1 |
.long sym2 |
sym1: |
.long 0x12121212 |
sym2: |
.long 0x34343434 |
/testsuite/ld-scripts/overlay-size.d
0,0 → 1,32
# ld: -T overlay-size.t -Map tmpdir/overlay-size.map |
# name: overlay size |
# objdump: --headers |
# xfail: rx-*-* |
# FAILS on the RX because the linker has to set LMA == VMA for the |
# Renesas loader. |
# |
# The .bss[123] LMAs are deliberately blanked out. We can't |
# reliably map overlaid sections to segments. |
#... |
.. \.bss1 +0+010 +0+20000 .* |
#... |
.. \.bss2 +0+030 +0+20000 .* |
#... |
.. \.bss3 +0+020 +0+20000 .* |
#... |
.. \.mtext +0+020 +0+10000 +0+30000 .* |
#... |
.. \.mbss +0+230 +0+20030 .* |
#... |
.. \.text1 +0+080 +0+10020 +0+30020 .* |
#... |
.. \.text2 +0+040 +0+10020 +0+300a0 .* |
#... |
.. \.text3 +0+020 +0+10020 +0+300e0 .* |
#... |
.. \.data1 +0+030 +0+20260 +0+30100 .* |
#... |
.. \.data2 +0+040 +0+20260 +0+30130 .* |
#... |
.. \.data3 +0+050 +0+20260 +0+30170 .* |
#pass |
/testsuite/ld-scripts/dynamic-sections.t
0,0 → 1,11
SECTIONS |
{ |
.data : { *(.data) } |
.rodata : { *(.rodata) } |
|
/* The .rel* sections are typically placed here, because of the way |
elf32.em handles orphaned sections. A bug introduced on 2002-06-10 |
would cause . to be 0 at this point. */ |
|
_bar = ASSERT (. > 0, "Bad . value"); |
} |
/testsuite/ld-scripts/empty-address-3.s
0,0 → 1,5
.text |
.global _start |
_start: |
.byte 0,0,0,0,0,0,0,0 |
.byte 0,0,0,0,0,0,0,0 |
/testsuite/ld-scripts/include.s
0,0 → 1,5
.text |
.fill 32,1,0x12 |
|
.data |
.fill 16,1,0x34 |
/testsuite/ld-scripts/empty-orphan.s
0,0 → 1,4
.section .orphan_data, "a" |
# empty but defined |
.section .data |
.word 0x1111 |
/testsuite/ld-scripts/rgn-over3.t
0,0 → 1,15
/* Memory region overflow tests: two regions, each too small for the single |
section placed there. */ |
|
MEMORY { |
bss (rwx) : ORIGIN = 0, LENGTH = 0 |
r1 (rwx) : ORIGIN = 0x1000, LENGTH = 8 |
r2 (rwx) : ORIGIN = 0x2000, LENGTH = 8 |
} |
_start = 0x1000; |
SECTIONS { |
.bss : { *(.bss) } > bss |
.text : { *(.txt) } > r1 |
.data : { *(.dat) } > r2 |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/empty-orphan.t
0,0 → 1,22
MEMORY |
{ |
default_mem : ORIGIN = 0x0, LENGTH = 0x100000 |
text_mem : ORIGIN = 0x60000000, LENGTH = 0x100 |
data_mem : ORIGIN = 0x70000000, LENGTH = 0x100 |
} |
|
PHDRS |
{ |
default_phdr PT_LOAD; |
text_phdr PT_LOAD; |
data_phdr PT_LOAD; |
} |
|
SECTIONS |
{ |
.text : { *(.text) } > text_mem : text_phdr |
.data : { *(.data) } > data_mem : data_phdr |
.bss : { *(.bss) } > data_mem : data_phdr |
/DISCARD/ : { *(.reginfo) *(.glue*) } |
/* .orphan_data is an orphan */ |
} |
/testsuite/ld-scripts/default-script.s
0,0 → 1,4
.text |
.global text |
text: |
.long 0 |
/testsuite/ld-scripts/default-script.t
0,0 → 1,7
_START = DEFINED(_START) ? _START : 0x9000000; |
SECTIONS |
{ |
. = _START; |
.text : {*(.text)} |
/DISCARD/ : {*(*)} |
} |
/testsuite/ld-scripts/rgn-over7.t
0,0 → 1,14
/* Memory region overflow tests: overflow r1 plus text/data collision. */ |
|
MEMORY { |
bss (rwx) : ORIGIN = 0, LENGTH = 0 |
r1 (rwx) : ORIGIN = 0x1000, LENGTH = 8 |
r2 (rwx) : ORIGIN = 0x1008, LENGTH = 12 |
} |
_start = 0x1000; |
SECTIONS { |
.bss : { *(.bss) } > bss |
.text : { *(.txt) } > r1 |
.data : { *(.dat) } > r2 |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/provide-3.d
0,0 → 1,3
#source: provide-3.s |
#ld: -T provide-3.t |
#error: symbol defined in linker script and object file |
/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 |
/testsuite/ld-scripts/overlay-size.t
0,0 → 1,64
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 |
|
end_of_bss_overlays = . ; |
|
.mtext : { *(.mtext) } > TEXTMEM AT > LOADMEM |
|
.mbss : AT (__load_stop_bss3) |
{ |
*(.mbss) |
. += 0x200; |
} > DATAMEM |
|
OVERLAY : |
{ |
.text1 { *(.text1) } |
.text2 { *(.text2) } |
.text3 { *(.text3) } |
} > TEXTMEM AT > LOADMEM |
|
end_of_text_overlays = . ; |
|
OVERLAY : |
{ |
.data1 { *(.data1) } |
.data2 { *(.data2) } |
.data3 { *(.data3) } |
} > DATAMEM AT > LOADMEM |
|
end_of_data_overlays = . ; |
|
. = 0x8000; |
/DISCARD/ : { *(.reginfo) } |
} |
/testsuite/ld-scripts/default-script4.d
0,0 → 1,9
# source: default-script.s |
# ld: --default-script default-script.t -defsym _START=0x8000000 |
# nm: -n |
|
#... |
0*8000000 . _START |
#... |
0*8000000 T text |
#pass |
/testsuite/ld-scripts/cross3.c
0,0 → 1,7
int i = 4; |
|
int |
foo () |
{ |
return i; |
} |
/testsuite/ld-scripts/rgn-at4.d
0,0 → 1,16
# name: rgn-at4 |
# source: rgn-at.s |
# ld: -T rgn-at4.t |
# objdump: -w -h |
# xfail: rx-*-* |
# FAILS on the RX because the linker has to set LMA == VMA for the |
# Renesas loader. |
|
.*: file format .* |
|
Sections: |
Idx +Name +Size +VMA +LMA +File off +Algn +Flags |
0 .text +0+[0-9a-f][0-9a-f] +0+0010000 +0+0020000 +.* |
1 .data +0+[0-9a-f][0-9a-f] +0+00100[0-9a-f]+ +0+00200[0-9a-f]+ +.* |
2 .bss +0+[0-9a-f][0-9a-f] +0+00100[0-9a-f]+ +0+00200[0-9a-f]+ +.* |
3 .trail +0+[0-9a-f][0-9a-f] +0+00100[0-9a-f]+ +0+00200[0-9a-f]+ +.* |
/testsuite/ld-scripts/align2a.d
0,0 → 1,12
# ld: --defsym data_align=16 -T align2.t |
# objdump: --section-headers |
|
[^:]+: +file format.* |
|
Sections: |
Idx +Name +Size +VMA +LMA +File +off +Algn |
[ ]+0 +\.text +[^ ]* +0+ +0+ .* |
[ ]+CONTENTS, +ALLOC, +LOAD,.* CODE |
[ ]+1 +\.data +[^ ]* +0+10 +0+10 .* |
[ ]+CONTENTS, +ALLOC, +LOAD, +DATA |
#pass |
/testsuite/ld-scripts/defined.s
0,0 → 1,2
.globl defined |
defined == 1 |
/testsuite/ld-scripts/defined.t
0,0 → 1,7
SECTIONS { |
.text : { *(.text) } |
.data : { *(.data) } |
.bss : { *(.bss) *(COMMON) } |
} |
value1 = DEFINED (defined) ? 1 : 2; |
value2 = DEFINED (undefined) ? 1 : 2; |
/testsuite/ld-scripts/rgn-over.s
0,0 → 1,9
.section .txt, "ax", "progbits" |
.4byte 0x11223344 |
.4byte 0x55667788 |
.4byte 0x99aabbcc |
|
.section .dat, "aw", "progbits" |
.4byte 0x01020304 |
.4byte 0x05060708 |
.4byte 0x090a0b0c |
/testsuite/ld-scripts/defined4.d
0,0 → 1,14
#ld: -Tdefined4.t |
#nm: -B |
#source: defined4.s |
#xfail: rs6000-*-aix* |
#notarget: mips*-*-* mmix-*-* |
# We check that defined and defined1 have the same address. MIPS targets |
# use different address. MMIX puts defined and defined1 in text section. |
|
# Check that arithmetic on DEFINED works. |
#... |
0+0 D defined |
#... |
0+0 D defined1 |
#pass |
/testsuite/ld-scripts/dynamic-sections.exp
0,0 → 1,27
# Copyright 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. |
|
# Check for bug introduced on 2002-06-10. See dynamic-sections.t for |
# more details |
|
if ![is_elf_format] { |
return |
} |
|
run_dump_test dynamic-sections |
/testsuite/ld-scripts/empty-address-3b.d
0,0 → 1,9
#source: empty-address-3.s |
#ld: -T empty-address-3b.t |
#nm: -n |
#notarget: mmix-knuth-mmixware |
#... |
0+0 T _start |
#... |
0+10 A __data_end |
#pass |
/testsuite/ld-scripts/script.s
0,0 → 1,8
.text |
.globl text_symbol |
text_symbol: |
.long 1 |
.data |
.globl data_symbol |
data_symbol: |
.long 2 |
/testsuite/ld-scripts/extern.s
0,0 → 1,8
.text |
/testsuite/ld-scripts/script.t
0,0 → 1,16
SECTIONS |
{ |
.text 0x100 : { |
text_start = .; |
*(.text) |
*(.pr) |
text_end = .; |
} |
. = 0x1000; |
.data : { |
data_start = .; |
*(.data) |
*(.rw) |
data_end = .; |
} |
} |
/testsuite/ld-scripts/extern.t
0,0 → 1,14
|
EXTERN(sym1) |
EXTERN(sym2, sym3) |
EXTERN(sym4 sym5) |
|
PROVIDE(sym1 = 1); |
PROVIDE(sym2 = 2); |
PROVIDE(sym3 = 3); |
PROVIDE(sym4 = 4); |
PROVIDE(sym5 = 5); |
|
SECTIONS |
{ |
} |
/testsuite/ld-scripts/sort_b_a_a-1.d
0,0 → 1,23
#source: sort_n_a-a.s |
#source: sort_n_a-b.s |
#ld: -T sort_b_a_a.t |
#name: SORT_BY_ALIGNMENT(SORT_BY_ALIGNMENT()) |
#nm: -n |
|
#... |
0[0-9a-f]* t text3b |
#... |
0[0-9a-f]* t text3a |
#... |
0[0-9a-f]* t text1a |
#... |
0[0-9a-f]* t text1b |
#... |
0[0-9a-f]* t texta |
#... |
0[0-9a-f]* t textb |
#... |
0[0-9a-f]* t text2a |
#... |
0[0-9a-f]* t text2b |
#pass |
/testsuite/ld-scripts/provide-3.s
0,0 → 1,4
.data |
.globl foo |
foo: .long 0 |
.p2align 4 |
/testsuite/ld-scripts/provide-3.t
0,0 → 1,11
SECTIONS |
{ |
.data : |
{ |
LONG (foo) |
LONG (bar) |
*(.data) |
} |
foo = .; |
bar = .; |
} |
/testsuite/ld-scripts/alignof.exp
0,0 → 1,67
# Test ALIGNOF in a linker script. |
# Copyright 2007 Free Software Foundation, Inc. |
# Contributed by Nathan Sidwell <nathan@codesourcery.com> |
# |
# 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. |
|
# Only ELF and PE-COFF targets record section alignment. |
|
if {![is_elf_format] && ![is_pecoff_format]} { |
return |
} |
|
set testname "ALIGNOF" |
|
if ![ld_assemble $as $srcdir/$subdir/alignof.s tmpdir/alignof.o] { |
unresolved $testname |
return |
} |
|
if ![ld_simple_link $ld tmpdir/alignof "-T $srcdir/$subdir/alignof.t tmpdir/alignof.o"] { |
fail $testname |
return |
} |
|
if ![ld_nm $nm "" tmpdir/alignof] { |
unresolved $testname |
return |
} |
|
if {![info exists nm_output(alignof_text)] \ |
|| ![info exists nm_output(alignof_data)]} { |
send_log "bad output from nm\n" |
verbose "bad output from nm" |
fail $testname |
return |
} |
|
if {$nm_output(alignof_text) != 64} { |
send_log "alignof_text != 64\n" |
verbose "alignof_text != 64" |
fail $testname |
return |
} |
|
if {$nm_output(alignof_data) != 16} { |
send_log "alignof_data != 16\n" |
verbose "alignof_data != 16" |
fail $testname |
return |
} |
|
pass $testname |
/testsuite/ld-scripts/region-alias-3.t
0,0 → 1,6
MEMORY |
{ |
MY_REGION (ARX) : ORIGIN = 0, LENGTH = 32K |
} |
|
REGION_ALIAS ("MY_ALIAS", "*default*"); |
/testsuite/ld-scripts/cross3.t
0,0 → 1,10
NOCROSSREFS(.nocrossrefs .text) |
|
SECTIONS |
{ |
.text : { *(.text) } |
.nocrossrefs : { *(.nocrossrefs) } |
.data : { *(.data) *(.opd) } |
.bss : { *(.bss) *(COMMON) } |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/align2a.s
0,0 → 1,4
.text |
.long 0 |
.data |
.long 0x12345678 |
/testsuite/ld-scripts/rgn-at4.t
0,0 → 1,14
/* Memory region at test, >AT should propagate by default */ |
|
MEMORY { |
ram : ORIGIN = 0x10000, LENGTH = 0x100 |
rom : ORIGIN = 0x20000, LENGTH = 0x200 |
} |
_start = 0x1000; |
SECTIONS { |
.text : { *(.text) } >ram AT>rom |
.data : { *(.data) } >ram |
.bss : { *(.bss) } >ram |
.trail : { LONG(5) } >ram |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/rgn-over8-ok.d
0,0 → 1,15
# name: rgn-over8 |
# source: rgn-over8.s |
# ld: -T rgn-over8.t |
# objdump: -w -h |
# xfail: rx-*-* |
# FAILS on the RX because the linker has to set LMA == VMA for the |
# Renesas loader. |
|
.*: file format .* |
|
Sections: |
Idx +Name +Size +VMA +LMA +File off +Algn +Flags |
0 .text 0+0000400 0+0000000 0+0000000 [0-9a-f]+ 2\*\*[0-9]+ CONTENTS, ALLOC, LOAD, READONLY, CODE |
1 .data 0+0000400 0+0001000 0+0000400 [0-9a-f]+ 2\*\*[0-9]+ CONTENTS, ALLOC, LOAD, DATA |
2 .bss 0+0000400 0+0001400 0+0000800 [0-9a-f]+ 2\*\*[0-9]+ ALLOC |
/testsuite/ld-scripts/weak.exp
0,0 → 1,80
# Test weak symbols. |
# By Ian Lance Taylor, Cygnus Solutions. |
# Copyright 1999, 2000, 2002, 2004, 2005, 2006, 2007, 2009, 2011 |
# 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. |
|
set testname "weak symbols" |
|
# This test only works for ELF targets and some PE targets. |
# It ought to work for some a.out targets, but it doesn't. |
if {! [is_elf_format] && ! [is_pecoff_format]} { |
unsupported $testname |
return |
} |
|
# Weak symbols are broken for most PE targets. |
if {! [istarget i?86-*-*] && ! [istarget sh-*-*]} { |
setup_xfail *-*-pe* |
} |
|
# hppa64 and or32 are incredibly broken |
setup_xfail hppa64-*-* or32-*-* |
|
if {! [ld_assemble $as $srcdir/$subdir/weak1.s tmpdir/weak1.o] |
|| ! [ld_assemble $as $srcdir/$subdir/weak2.s tmpdir/weak2.o]} then { |
# It's OK if .weak doesn't work on this target. |
unresolved $testname |
return |
} |
|
global LDFLAGS |
set saved_LDFLAGS "$LDFLAGS" |
if [istarget "x86_64-*-mingw*"] then { |
set LDFLAGS "$LDFLAGS --image-base 0" |
} |
|
set weak_regexp_big \ |
".*Contents of section .text:.*1000 00001008 0000200c 12121212 34343434.*Contents of section .data:.*2000 00001008 0000200c 56565656 78787878.*" |
|
set weak_regexp_little \ |
".*Contents of section .text:.*1000 08100000 0c200000 12121212 34343434.*Contents of section .data:.*2000 08100000 0c200000 56565656 78787878.*" |
|
if {! [ld_simple_link $ld tmpdir/weak "$flags -T $srcdir/$subdir/weak.t tmpdir/weak1.o tmpdir/weak2.o"] } then { |
fail $testname |
} else { |
if {![is_remote host] && [which $objdump] == 0} then { |
unresolved $testname |
set LDFLAGS "$saved_LDFLAGS" |
return |
} |
|
set exec_output [run_host_cmd "$objdump" "-s tmpdir/weak"] |
set exec_output [prune_warnings $exec_output] |
verbose -log $exec_output |
|
if {[regexp $weak_regexp_big $exec_output] \ |
|| [regexp $weak_regexp_little $exec_output] } then { |
pass $testname |
} else { |
fail $testname |
} |
} |
|
set LDFLAGS "$saved_LDFLAGS" |
/testsuite/ld-scripts/defined4.s
0,0 → 1,4
.globl defined |
.data |
defined: |
.word 0 |
/testsuite/ld-scripts/overlay-size.exp
0,0 → 1,34
# Test the OVERLAY statement. |
# Copyright 2002, 2005, 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. |
|
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 |
} |
/testsuite/ld-scripts/defined4.t
0,0 → 1,6
SECTIONS { |
.text : { *(.text) } |
.data : { *(.data) } |
.bss : { *(.bss) *(COMMON) } |
} |
defined1 = defined; |
/testsuite/ld-scripts/empty-address-3b.t
0,0 → 1,11
SECTIONS |
{ |
.text 0x00000000: { *(.text) } |
.data ALIGN(0x1000) + (. & (0x1000 - 1)): |
{ |
PROVIDE (__data_start = .); |
*(.data) |
} |
__data_end = .; |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/align.exp
0,0 → 1,53
# Test ALIGN in a linker script. |
# By Nathan Sidwell, CodeSourcery LLC |
# Copyright 2004, 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. |
|
if [istarget "rs6000-*-aix*"] { |
# Target maps .text and .data to other sections. |
return |
} |
|
set testname "align1" |
|
if ![ld_assemble $as $srcdir/$subdir/align.s tmpdir/align.o] { |
unresolved $testname |
return |
} |
|
# mingw on x86_64 targets need to set the image base to 0 to avoid auto image-basing. |
global LDFLAGS |
set saved_LDFLAGS "$LDFLAGS" |
if [istarget "x86_64-*-mingw*"] then { |
set LDFLAGS "$LDFLAGS --image-base 0" |
} |
|
if ![ld_simple_link $ld tmpdir/align "$LDFLAGS -T $srcdir/$subdir/align.t tmpdir/align.o"] { |
fail $testname |
} else { |
pass $testname |
} |
|
if ![is_aout_format] { |
run_dump_test align2a |
run_dump_test align2b |
} |
run_dump_test align2c |
set LDFLAGS "$saved_LDFLAGS" |
/testsuite/ld-scripts/sort_b_n_a-2.d
0,0 → 1,23
#source: sort_n_a-a.s |
#source: sort_n_a-b.s |
#ld: -T sort_b_n_a.t --sort-section name |
#name: SORT_BY_NAME(SORT_BY_ALIGNMENT()) --sort-section alignment |
#nm: -n |
|
#... |
0[0-9a-f]* t texta |
#... |
0[0-9a-f]* t textb |
#... |
0[0-9a-f]* t text1a |
#... |
0[0-9a-f]* t text1b |
#... |
0[0-9a-f]* t text2a |
#... |
0[0-9a-f]* t text2b |
#... |
0[0-9a-f]* t text3b |
#... |
0[0-9a-f]* t text3a |
#pass |
/testsuite/ld-scripts/sort_b_a_n-3.d
0,0 → 1,23
#source: sort_n_a-a.s |
#source: sort_n_a-b.s |
#ld: -T sort_b_a_n.t --sort-section alignment |
#name: SORT_BY_ALIGNMENT(SORT_BY_NAME()) --sort-section alignment |
#nm: -n |
|
#... |
0[0-9a-f]* t text3b |
#... |
0[0-9a-f]* t text1a |
#... |
0[0-9a-f]* t text1b |
#... |
0[0-9a-f]* t text3a |
#... |
0[0-9a-f]* t texta |
#... |
0[0-9a-f]* t textb |
#... |
0[0-9a-f]* t text2a |
#... |
0[0-9a-f]* t text2b |
#pass |
/testsuite/ld-scripts/size-1.d
0,0 → 1,14
#source: size-1.s |
#ld: -T size-1.t |
#objdump: -s |
|
.*: file format .* |
|
#... |
Contents of section \.text: |
[0-9a-f]* (01)?000000(01)? (02)?000000(02)? .* |
#... |
Contents of section \.data: |
[0-9a-f]* (03)?000000(03)? (04)?000000(04)? (05)?000000(05)? 00000000 .* |
[0-9a-f]* (20)?000000(20)? (18)?000000(18)? .* |
#pass |
/testsuite/ld-scripts/data.d
0,0 → 1,9
#source: data.s |
#ld: -T data.t |
#objdump: -s -j .text |
|
.*: file format .* |
|
Contents of section .text: |
[0-9a-f]* (04)?000000(04)? (0020)?0000(2000)? .* |
#pass |
/testsuite/ld-scripts/phdrs3.exp
0,0 → 1,39
# Test PHDRS in a linker script. |
# By Nathan Sidwell <nathan@codesourcery.com> |
# Copyright 2009 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 |
} |
|
load_lib ld-lib.exp |
|
set testname "PHDRS headers" |
|
set old_ldflags $LDFLAGS |
if { [istarget spu*-*-*] } { |
set LDFLAGS "$LDFLAGS --no-overlays --local-store 0:0" |
} |
|
run_dump_test "phdrs3" |
run_dump_test "phdrs3a" |
|
set LDFLAGS $old_ldflags |
/testsuite/ld-scripts/extern.exp
0,0 → 1,71
# Test EXTERN in a linker script. |
# By Nathan Sidwell, CodeSourcery LLC |
# Copyright 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. |
|
set testname "EXTERN" |
|
if ![ld_assemble $as $srcdir/$subdir/extern.s tmpdir/extern.o] { |
unresolved $testname |
return |
} |
|
if ![ld_simple_link $ld tmpdir/extern "-T $srcdir/$subdir/extern.t tmpdir/extern.o"] { |
fail $testname |
} |
|
if ![ld_nm $nm "" tmpdir/extern] { |
unresolved $testname |
return |
} |
|
if {![info exists nm_output(sym1)] || $nm_output(sym1) != 1} { |
send_log "sym1 wrong\n" |
verbose "sym1 wrong" |
fail $testname |
return |
} |
|
if {![info exists nm_output(sym2)] || $nm_output(sym2) != 2} { |
send_log "sym1 wrong\n" |
verbose "sym1 wrong" |
fail $testname |
return |
} |
if {![info exists nm_output(sym3)] || $nm_output(sym3) != 3} { |
send_log "sym1 wrong\n" |
verbose "sym1 wrong" |
fail $testname |
return |
} |
if {![info exists nm_output(sym4)] || $nm_output(sym4) != 4} { |
send_log "sym1 wrong\n" |
verbose "sym1 wrong" |
fail $testname |
return |
} |
if {![info exists nm_output(sym5)] || $nm_output(sym5) != 5} { |
send_log "sym1 wrong\n" |
verbose "sym1 wrong" |
fail $testname |
return |
} |
|
pass $testname |
/testsuite/ld-scripts/include-mem.t
0,0 → 1,5
|
MEMORY { |
rom (rwx) : ORIGIN = 0, LENGTH = 0x1000 |
INCLUDE include-ram.t |
} |
/testsuite/ld-scripts/include-ram.t
0,0 → 1,5
ram (rw) : ORIGIN = 0x100000, LENGTH = 512 |
/testsuite/ld-scripts/sort_no-2.d
0,0 → 1,14
#source: sort_b_a.s |
#ld: -T sort_no.t |
#name: no SORT_BY_NAME/SORT_BY_ALIGNMENT/SORT |
#nm: -n |
|
#... |
0[0-9a-f]* t text |
#... |
0[0-9a-f]* t text2 |
#... |
0[0-9a-f]* t text3 |
#... |
0[0-9a-f]* t text1 |
#pass |
/testsuite/ld-scripts/rgn-over4.d
0,0 → 1,36
# name: rgn-over4 |
# source: rgn-over.s |
# ld: -T rgn-over4.t -Map tmpdir/rgn-over4.map |
# error: \A[^ \n]*?ld[^:\n]*?: [^:\n]*?section `\.text' will not fit in region `r1'\n[^ \n]*?ld[^:\n]*?: region `r1' overflowed by 16 bytes\Z |
|
Discarded input sections |
#... |
Memory\s+Configuration |
|
Name\s+Origin\s+Length\s+Attributes |
bss\s+0x0+0000\s+0x0+0000\s+xrw |
r1\s+0x0+1000\s+0x0+0008\s+xrw |
v1\s+0x0+2000\s+0x0+0018\s+xrw |
\*default\*\s+0x0+0000\s+0xf+ffff |
|
Linker\s+script\s+and\s+memory\s+map |
|
\s*0x0+1000\s+_start\s+=\s+0x1000 |
|
\s*\.bss\s+0x0+0000\s+0x0 |
\s*\*\(\.bss\) |
\s*\.bss\s+0x0+0000\s+0x0\s+.*? |
|
\s*\.text\s+0x0+1000\s+0xc\s+load\s+address\s+0x0+2000 |
\s*\*\(\.txt\) |
\s*\.txt\s+0x0+1000\s+0xc\s+.*? |
|
\s*\.data\s+0x0+100c\s+0xc\s+load\s+address\s+0x0+200c |
\s*\*\(\.dat\) |
\s*\.dat\s+0x0+100c\s+0xc\s+.*? |
|
/DISCARD/ |
\*\(\*\) |
LOAD\s+.*? |
OUTPUT\(.*?\) |
#pass |
/testsuite/ld-scripts/sort_b_a-1.d
0,0 → 1,14
#source: sort_b_a-1.s |
#ld: -T sort.t --sort-section alignment |
#name: --sort-section alignment |
#nm: -n |
|
#... |
0[0-9a-f]* t text3 |
#... |
0[0-9a-f]* t text1 |
#... |
0[0-9a-f]* t text |
#... |
0[0-9a-f]* t text2 |
#pass |
/testsuite/ld-scripts/dynamic-sections-2.s
0,0 → 1,3
.data |
.global foo |
foo: .4byte 0 |
/testsuite/ld-scripts/size-1.s
0,0 → 1,7
.text |
.long 1,2 |
.p2align 5 |
|
.data |
.long 3,4,5 |
.p2align 4 |
/testsuite/ld-scripts/memory.t
0,0 → 1,33
MEMORY |
{ |
R_TEXTMEM (ARX) : ORIGIN = 0x100, LENGTH = 32K |
R_DATAMEM (AW) : org = 0x1000, l = (64 * 1024) |
} |
|
REGION_ALIAS ("A_TEXTMEM", R_TEXTMEM); |
REGION_ALIAS ("A_DATAMEM", R_DATAMEM); |
|
REGION_ALIAS ("TEXTMEM", A_TEXTMEM); |
REGION_ALIAS ("DATAMEM", A_DATAMEM); |
|
SECTIONS |
{ |
. = 0; |
.text : |
{ |
text_start = ORIGIN (TEXTMEM); |
*(.text) |
*(.pr) |
text_end = .; |
} > TEXTMEM |
|
data_start = ORIGIN (DATAMEM); |
.data : |
{ |
*(.data) |
*(.rw) |
data_end = .; |
} >DATAMEM |
|
fred = ORIGIN(DATAMEM) + LENGTH(DATAMEM); |
} |
/testsuite/ld-scripts/data.s
0,0 → 1,33
|
/testsuite/ld-scripts/size-1.t
0,0 → 1,10
SECTIONS |
{ |
. = 0x1000 + SIZEOF_HEADERS; |
.text ALIGN (0x20) : { *(.text) } |
.data 0x2000 : { |
*(.data) |
LONG (SIZEOF (.text)) |
LONG (SIZEOF (.data)) |
} |
} |
/testsuite/ld-scripts/weak2.s
0,0 → 1,11
.data |
.global foo2 |
.weak sym1 |
.global sym2 |
foo2: |
.long sym1 |
.long sym2 |
sym1: |
.long 0x56565656 |
sym2: |
.long 0x78787878 |
/testsuite/ld-scripts/data.t
0,0 → 1,11
SECTIONS |
{ |
. = 0x1000 + SIZEOF_HEADERS; |
.text ALIGN (0x20) : |
{ |
LONG (label - .) |
label = .; |
LONG (ADDR (.other)) |
} |
.other 0x2000 : {} |
} |
/testsuite/ld-scripts/sort_b_n_n.t
0,0 → 1,5
SECTIONS |
{ |
.text : {*(SORT_BY_NAME(SORT_BY_NAME(.text*)))} |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/rgn-over4.t
0,0 → 1,14
/* Memory region overflow tests: overflow VMA but not LMA. */ |
|
MEMORY { |
bss (rwx) : ORIGIN = 0, LENGTH = 0 |
r1 (rwx) : ORIGIN = 0x1000, LENGTH = 8 |
v1 (rwx) : ORIGIN = 0x2000, LENGTH = 24 |
} |
_start = 0x1000; |
SECTIONS { |
.bss : { *(.bss) } > bss |
.text : { *(.txt) } > r1 AT> v1 |
.data : { *(.dat) } > r1 AT> v1 |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/sort_b_a-1.s
0,0 → 1,16
.section .text.2 |
.p2align 3 |
text2: |
.long 0 |
.section .text.3 |
.p2align 6 |
text3: |
.long 0 |
.section .text.1 |
.p2align 5 |
text1: |
.long 0 |
.text |
text: |
.p2align 4 |
.long 0 |
/testsuite/ld-scripts/rgn-over8.s
0,0 → 1,7
.text |
.globl main |
.zero 1024 |
.data |
.zero 1024 |
.section .bss, "aw", "nobits" |
.zero 1024 |
/testsuite/ld-scripts/default-script1.d
0,0 → 1,9
# source: default-script.s |
# ld: -defsym _START=0x8000000 -T default-script.t |
# nm: -n |
|
#... |
0*8000000 . _START |
#... |
0*8000000 T text |
#pass |
/testsuite/ld-scripts/rgn-over8.t
0,0 → 1,13
/* Memory region overflow tests: bss to LMA doesn't cause overflow. */ |
|
MEMORY { |
rom (rwx) : ORIGIN = 0, LENGTH = 2048 |
ram (rwx) : ORIGIN = 0x1000, LENGTH = 2048 |
} |
_start = 0x0; |
SECTIONS { |
.text : { *(.text) } >rom AT>rom |
.data : { *(.data) } >ram AT>rom |
.bss : { *(.bss) } >ram AT>rom |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/sizeof.exp
0,0 → 1,74
# Test SIZEOF in a linker script. |
# By Ian Lance Taylor, Cygnus Support |
# Based on a bug report from anders.blomdell@control.lth.se. |
# Copyright 2001, 2005, 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. |
|
set testname "SIZEOF" |
|
if ![ld_assemble $as $srcdir/$subdir/sizeof.s tmpdir/sizeof.o] { |
unresolved $testname |
return |
} |
|
if ![ld_simple_link $ld tmpdir/sizeof "-T $srcdir/$subdir/sizeof.t tmpdir/sizeof.o"] { |
fail $testname |
return |
} |
|
if ![ld_nm $nm "" tmpdir/sizeof] { |
unresolved $testname |
return |
} |
|
if {![info exists nm_output(text_start)] \ |
|| ![info exists nm_output(text_end)] \ |
|| ![info exists nm_output(data_start)] \ |
|| ![info exists nm_output(data_end)] \ |
|| ![info exists nm_output(sizeof_text)] \ |
|| ![info exists nm_output(sizeof_data)]} { |
send_log "bad output from nm\n" |
verbose "bad output from nm" |
fail $testname |
return |
} |
|
if {$nm_output(text_end) - $nm_output(text_start) != $nm_output(sizeof_text)} { |
send_log "text_end - text_start != sizeof_text\n" |
verbose "text_end - text_start != sizeof_text" |
fail $testname |
return |
} |
|
if {$nm_output(data_end) - $nm_output(data_start) != $nm_output(sizeof_data)} { |
send_log "data_end - data_start != sizeof_data\n" |
verbose "data_end - data_start != sizeof_data" |
fail $testname |
return |
} |
|
if {$nm_output(sizeof_text) != $nm_output(sizeof_data)} { |
send_log "sizeof_text != sizeof_data\n" |
verbose "sizeof_text != sizeof_data" |
fail $testname |
return |
} |
|
pass $testname |
/testsuite/ld-scripts/rgn-at1.d
0,0 → 1,15
# name: rgn-at1 |
# source: rgn-at.s |
# ld: -T rgn-at1.t |
# objdump: -w -h |
# xfail: rx-*-* |
# FAILS on the RX because the linker has to set LMA == VMA for the |
# Renesas loader. |
|
.*: file format .* |
|
Sections: |
Idx +Name +Size +VMA +LMA +File off +Algn +Flags |
0 .text +0+[0-9a-f][0-9a-f] +0+0010000 +0+0020000 +.* |
1 .data +0+[0-9a-f][0-9a-f] +0+00100[0-9a-f]+ +0+00200[0-9a-f]+ +.* |
2 .bss +0+[0-9a-f][0-9a-f] +0+00100[0-9a-f]+ +0+00200[0-9a-f]+ +.* |
/testsuite/ld-scripts/cross4.c
0,0 → 1,7
__attribute__ ((section (".nocrossrefs"))) |
static void |
foo () |
{ |
} |
|
void (*dummy) () = foo; |
/testsuite/ld-scripts/rgn-at5.d
0,0 → 1,20
# name: rgn-at5 |
# source: rgn-at5.s |
# ld: -T rgn-at5.t -z max-page-size=0x1000 |
# objdump: -w -h |
# target: *-*-linux* *-*-gnu* |
# xfail: rx-*-* |
# FAILS on the RX because the linker has to set LMA == VMA for the |
# Renesas loader. |
|
.*: file format .* |
|
Sections: |
Idx +Name +Size +VMA +LMA +File off +Algn +Flags |
0 .sec0 +0+4 +0+2000 +0+2000 +0+1000 +.* |
1 .sec1 +0+4 +0+1000 +0+2004 +0+2000 +.* |
2 .sec2 +0+4 +0+4000 +0+603c +0+4000 +.* |
3 .sec3 +0+4 +0+5000 +0+5000 +0+3000 +.* |
4 .sec4 +0+4 +0+2008 +0+2008 +0+2008 +.* |
5 .sec5 +0+4 +0+200c +0+200c +0+200c +.* |
#pass |
/testsuite/ld-scripts/align2b.d
0,0 → 1,12
# ld: --defsym data_align=32 -T align2.t |
# objdump: --section-headers |
|
[^:]+: +file +format.* |
|
Sections: |
Idx +Name +Size +VMA +LMA +File off +Algn |
+0 +\.text +[^ ]* +0+ +0+ .* |
+CONTENTS, +ALLOC, +LOAD,.* CODE |
+1 +\.data +[^ ]* +0+20 +0+20 .* |
+CONTENTS, +ALLOC, +LOAD, +DATA |
#pass |
/testsuite/ld-scripts/phdrs2.s
0,0 → 1,7
.section .foo, "ax" |
.p2align 2 |
.long 1 |
|
.section .bar, "aw" |
.p2align 2 |
.long 2 |
/testsuite/ld-scripts/phdrs2.t
0,0 → 1,23
PHDRS |
{ |
Foo PT_LOAD ; |
Bar PT_LOAD ; |
} |
|
SECTIONS |
{ |
. = 0x800000 - 1; |
/* The PHDRS generated should start at the aligned .foo section |
address, not the unaligned .empty section address */ |
.empty : { |
EMPTY_START = ABSOLUTE(.) ; |
*(.empty) |
EMPTY_END = ABSOLUTE(.) ; |
} : Foo |
.foo : { *(.foo) } : Foo |
.bar : { *(.bar) |
LONG(EMPTY_START) ; |
} : Bar |
|
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/data.exp
0,0 → 1,30
# Test DATA STATEMENT in a linker script. |
# By Nathan Sidwell, CodeSourcery LLC |
# Copyright 2004, 2005, 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. |
|
# An a.out "objdump -s -j .text" has the file header visible inside the |
# text segment, confusing run_dump_test. |
if {[is_aout_format]} { |
unsupported data |
return |
} |
|
run_dump_test data |
/testsuite/ld-scripts/defined5.d
0,0 → 1,9
#ld: -Tdefined5.t |
#nm: -B |
#source: defined5.s |
#xfail: rs6000-*-aix* |
|
# Check that arithmetic on DEFINED works. |
#... |
0+1000 D defined |
#pass |
/testsuite/ld-scripts/size.exp
0,0 → 1,41
# Expect script for SIZEOF tests |
# Copyright (C) 2004, 2005, 2007 Free Software Foundation |
# |
# 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. |
# |
|
# AIX maps .text and .data to other sections. |
# a.out objdump displays the file header inside the text segment, |
# confusing run_dump_test. |
|
if {[istarget "rs6000-*-aix*"] || [is_aout_format]} { |
unsupported size-1 |
unsupported size-2 |
return |
} |
|
run_dump_test size-1 |
|
# size-2 only works on ELF targets. |
# MIPS inserts a REGINFO PHDR |
if {![is_elf_format] || [istarget "mips*-*-*"]} { |
unsupported size-2 |
return |
} |
|
run_dump_test size-2 |
/testsuite/ld-scripts/include-subdata.t
0,0 → 1,2
*(.data) |
|
/testsuite/ld-scripts/empty-address-3c.d
0,0 → 1,10
#source: empty-address-3.s |
#ld: -T empty-address-3c.t |
#nm: -n |
#... |
0+0 T _start |
#... |
0+1010 A __data_end |
#... |
0+1010 [ADT] __data_start |
#pass |
/testsuite/ld-scripts/sort_b_a_a-2.d
0,0 → 1,23
#source: sort_n_a-a.s |
#source: sort_n_a-b.s |
#ld: -T sort_b_a_a.t --sort-section alignment |
#name: SORT_BY_ALIGNMENT(SORT_BY_ALIGNMENT()) --sort-section alignment |
#nm: -n |
|
#... |
0[0-9a-f]* t text3b |
#... |
0[0-9a-f]* t text3a |
#... |
0[0-9a-f]* t text1a |
#... |
0[0-9a-f]* t text1b |
#... |
0[0-9a-f]* t texta |
#... |
0[0-9a-f]* t textb |
#... |
0[0-9a-f]* t text2a |
#... |
0[0-9a-f]* t text2b |
#pass |
/testsuite/ld-scripts/phdrs.exp
0,0 → 1,68
# 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 |
|
if [regexp $phdrs_regexp $exec_output] { |
pass $testname |
} else { |
fail $testname |
} |
} |
/testsuite/ld-scripts/rgn-at1.t
0,0 → 1,13
/* Memory region at test, >AT should propagate by default */ |
|
MEMORY { |
ram : ORIGIN = 0x10000, LENGTH = 0x100 |
rom : ORIGIN = 0x20000, LENGTH = 0x200 |
} |
_start = 0x1000; |
SECTIONS { |
.text : { *(.text) } >ram AT>rom |
.data : { *(.data) } >ram /* default AT>rom */ |
.bss : { *(.bss) } >ram |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/region-alias-4.t
0,0 → 1,6
MEMORY |
{ |
MY_REGION (ARX) : ORIGIN = 0, LENGTH = 32K |
} |
|
REGION_ALIAS ("*default*", MY_REGION); |
/testsuite/ld-scripts/rgn-at5.s
0,0 → 1,14
.section .sec0, "a" |
.long 0 |
|
.section .sec1, "a" |
.long 0x11 |
|
.section .sec2, "a" |
.long 0x22 |
|
.section .sec3, "a" |
.long 0x33 |
|
.section .sec4, "a" |
.long 0x44 |
/testsuite/ld-scripts/align2b.s
0,0 → 1,4
.text |
.long 0 |
.data |
.long 0x12345678 |
/testsuite/ld-scripts/rgn-at5.t
0,0 → 1,26
MEMORY |
{ |
region1 : ORIGIN = 0x1000, LENGTH = 0x1000 , |
region2 (r) : org = 0x2000, len = 300 |
region3 (wx) : o = 0x4000, l = 4 |
region4 (!r) : o = 0x6000 + 60, len = 0x30 * 0x6 |
} |
|
SECTIONS |
{ |
.sec0 : { *(*.sec0) } |
|
.sec1 ORIGIN (region1) : { *(*.sec1) } AT> region2 |
|
fred = ORIGIN (region1) + LENGTH (region1); |
|
.sec2 : { *(*.sec2) } > region3 AT> region4 |
|
.sec3 0x5000 : { *(*.sec3) } |
|
.sec4 : { *(*.sec4) } AT> region2 |
|
.sec5 : { LONG(0x5555) } > region2 |
|
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/default-script.exp
0,0 → 1,34
# Test --default-script/-dT |
# Copyright 2007, 2009 |
# 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. |
|
set old_ldflags $LDFLAGS |
if { [istarget spu*-*-*] } { |
set LDFLAGS "$LDFLAGS --local-store 0:0" |
} |
|
set test_list [lsort [glob -nocomplain $srcdir/$subdir/default-script*.d]] |
foreach t $test_list { |
# We need to strip the ".d", but can leave the dirname. |
verbose [file rootname $t] |
run_dump_test [file rootname $t] |
} |
|
set LDFLAGS $old_ldflags |
/testsuite/ld-scripts/sort.exp
0,0 → 1,40
# Test SORT_BY_NAME/SORT_BY_ALIGNMENT/SORT in a linker script. |
# By H.J. Lu <hongjiu.lu@intel.com> |
# Copyright 2004, 2005, 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. |
|
# FIXME: The expected outputs are correct only for ELF. |
if ![is_elf_format] { |
return |
} |
|
# The h8300 port issues a warning message for |
# new sections created without atrributes. |
if [istarget "h8300-*-*"] { |
return |
} |
|
load_lib ld-lib.exp |
|
set sort_test_list [lsort [glob -nocomplain $srcdir/$subdir/sort*.d]] |
for { set i 0 } { $i < [llength $sort_test_list] } { incr i } { |
verbose [file rootname [lindex $sort_test_list $i]] |
run_dump_test [file rootname [lindex $sort_test_list $i]] |
} |
/testsuite/ld-scripts/scriptm.t
0,0 → 1,10
* MRI script |
sect .text = $100 ; .text start address |
sect .data = 1000h ; .data start address |
public text_start = $100 |
public text_end = # continuation line |
text_start + 4 |
public data_start = 1000h |
public data_end = data_start + 4 |
|
load tmpdir/script.o |
/testsuite/ld-scripts/defined5.s
0,0 → 1,6
.globl defined |
.data |
.byte 0 |
.text |
defined: |
.byte 0 |
/testsuite/ld-scripts/defined5.t
0,0 → 1,7
defined = addr1; |
SECTIONS { |
.text : { *(.text) } |
. = ALIGN (0x1000); |
.data : { *(.data) } |
addr1 = ADDR (.data); |
} |
/testsuite/ld-scripts/overlay-size-map.d
0,0 → 1,29
#... |
\.bss1 *0x0*20000 *0x10 |
#... |
\.bss2 *0x0*20000 *0x30 load address 0x0*20010 |
#... |
\.bss3 *0x0*20000 *0x20 load address 0x0*20040 |
#... |
.*0x0+020030[ ]*end_of_bss_overlays.* |
#... |
\.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 |
#... |
.*0x0+0100a0[ ]*end_of_text_overlays.* |
#... |
\.data1 *0x0*20260 *0x30 load address 0x0*30100 |
#... |
\.data2 *0x0*20260 *0x40 load address 0x0*30130 |
#... |
\.data3 *0x0*20260 *0x50 load address 0x0*30170 |
#... |
.*0x0+0202b0[ ]*end_of_data_overlays.* |
#pass |
/testsuite/ld-scripts/empty-address-3c.t
0,0 → 1,11
SECTIONS |
{ |
.text 0x00000000: { *(.text) } |
.data ALIGN(0x1000) + (. & (0x1000 - 1)): |
{ |
__data_start = .; |
*(.data) |
} |
__data_end = .; |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/sort_b_n_a-3.d
0,0 → 1,23
#source: sort_n_a-a.s |
#source: sort_n_a-b.s |
#ld: -T sort_b_n_a.t --sort-section alignment |
#name: SORT_BY_NAME(SORT_BY_ALIGNMENT()) --sort-section alignment |
#nm: -n |
|
#... |
0[0-9a-f]* t texta |
#... |
0[0-9a-f]* t textb |
#... |
0[0-9a-f]* t text1a |
#... |
0[0-9a-f]* t text1b |
#... |
0[0-9a-f]* t text2a |
#... |
0[0-9a-f]* t text2b |
#... |
0[0-9a-f]* t text3b |
#... |
0[0-9a-f]* t text3a |
#pass |
/testsuite/ld-scripts/defined.exp
0,0 → 1,73
# Test DEFINED in a linker script. |
# By Ian Lance Taylor, Cygnus Support. |
# Copyright 2001, 2003, 2005, 2006, 2007, 2010 |
# 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. |
|
set testname "DEFINED" |
set prms_id 5699 |
|
if ![ld_assemble $as $srcdir/$subdir/defined.s tmpdir/def.o] { |
unresolved $testname |
return |
} |
|
global LDFLAGS |
set saved_LDFLAGS "$LDFLAGS" |
if [istarget "x86_64-*-mingw*"] then { |
set LDFLAGS "$LDFLAGS --image-base 0" |
} |
|
if ![ld_simple_link $ld tmpdir/def "$LDFLAGS -T $srcdir/$subdir/defined.t tmpdir/def.o"] { |
fail $testname |
} else { |
if ![ld_nm $nm "" tmpdir/def] { |
unresolved $testname |
} else { |
if {![info exists nm_output(value1)] \ |
|| ![info exists nm_output(value2)]} { |
send_log "bad output from nm\n" |
verbose "bad output from nm" |
fail $testname |
} else { |
if {$nm_output(value1) != 1} { |
send_log "value1 == $nm_output(value1)\n" |
verbose "value1 == $nm_output(value1)" |
fail $testname |
} else { |
if {$nm_output(value2) != 2} { |
send_log "value2 == $nm_output(value2)\n" |
verbose "value2 == $nm_output(value2)" |
fail $testname |
} else { |
pass $testname |
} |
} |
} |
} |
} |
|
set prms_id 0 |
run_dump_test "defined2" |
run_dump_test "defined3" |
run_dump_test "defined4" |
if ![is_aout_format] { |
run_dump_test "defined5" |
} |
set LDFLAGS "$saved_LDFLAGS" |
/testsuite/ld-scripts/empty-aligned.exp
0,0 → 1,29
# Make sure empty aligned sections do not change output layout. |
# Copyright 2005, 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 |
} |
|
set testname "empty-aligned" |
|
run_dump_test empty-aligned |
/testsuite/ld-scripts/sort_b_a_a.t
0,0 → 1,5
SECTIONS |
{ |
.text : {*(SORT_BY_ALIGNMENT(SORT_BY_ALIGNMENT(.text*)))} |
/DISCARD/ : { *(.*) } |
} |
/testsuite/ld-scripts/size-2.d
0,0 → 1,18
#source: size-2.s |
#ld: -T size-2.t |
#readelf: -l --wide |
#xfail: "hppa64-*-*" "v850-*-*" |
|
#... |
Program Headers: |
+Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg +Align |
+PHDR +0x[0-9a-f]+ 0x0+0000 0x0+0000 0x[0-9a-f]+ 0x[0-9a-f]+ R +0x[0-9a-f]+ |
#... |
+LOAD +0x[0-9a-f]+ 0x0+0100 0x0+0100 0x0+0030 0x0+0030 R E +0x[0-9a-f]+ |
+TLS +0x[0-9a-f]+ 0x0+0108 0x0+0108 0x0+0014 0x0+002c R +0x[0-9a-f]+ |
|
Section to Segment mapping: |
+Segment Sections\.\.\. |
+00 .* |
+01.*\.text.*\.tdata.* |
+02.*\.tdata.* |
/testsuite/ld-scripts/empty-address-1.d
0,0 → 1,9
#ld: -T empty-address-1.t |
#nm: -n |
#notarget: frv-*-*linux* |
#... |
0+0 T _start |
#... |
0+2000000 A __data_end |
0+2000000 [ADT] __data_start |
#pass |
/testsuite/ld-scripts/rgn-over1.d
0,0 → 1,35
# name: rgn-over1 |
# source: rgn-over.s |
# ld: -T rgn-over1.t -Map tmpdir/rgn-over1.map |
# error: \A[^ \n]*?ld[^:\n]*?: [^\n]*?section \`.text' will not fit in region `r1'\n[^ \n]*?ld[^:\n]*?: region `r1' overflowed by 16 bytes\Z |
|
Discarded input sections |
#... |
Memory\s+Configuration |
|
Name\s+Origin\s+Length\s+Attributes |
bss\s+0x0+0000\s+0x0+0000\s+xrw |
r1\s+0x0+1000\s+0x0+0008\s+xrw |
\*default\*\s+0x0+0000\s+0xf+ffff |
|
Linker\s+script\s+and\s+memory\s+map |
|
\s*0x0+1000\s+_start\s+=\s+0x1000 |
|
\s*\.bss\s+0x0+0000\s+0x0 |
\s*\*\(\.bss\) |
\s*\.bss\s+0x0+0000\s+0x0\s+.*? |
|
\s*\.text\s+0x0+1000\s+0xc |
\s*\*\(\.txt\) |
\s*\.txt\s+0x0+1000\s+0xc\s+.*? |
|
\s*\.data\s+0x0+100c\s+0xc |
\s*\*\(\.dat\) |
\s*\.dat\s+0x0+100c\s+0xc\s+.*? |
|
/DISCARD/ |
\*\(\*\) |
LOAD\s+.*? |
OUTPUT\(.*?\) |
#pass |
/testsuite/ld-scripts/sort_b_n_n-1.d
0,0 → 1,23
#source: sort_n_a-a.s |
#source: sort_n_a-b.s |
#ld: -T sort_b_n_n.t |
#name: SORT_BY_NAME(SORT_BY_NAME()) |
#nm: -n |
|
#... |
0[0-9a-f]* t texta |
#... |
0[0-9a-f]* t textb |
#... |
0[0-9a-f]* t text1a |
#... |
0[0-9a-f]* t text1b |
#... |
0[0-9a-f]* t text2a |
#... |
0[0-9a-f]* t text2b |
#... |
0[0-9a-f]* t text3a |
#... |
0[0-9a-f]* t text3b |
#pass |
/testsuite/ld-scripts/include-1.d
0,0 → 1,13
# name: include-1 |
# source: include.s |
# ld: -T include-1.t |
# objdump: -w -h |
# xfail: "*-aix*" |
# AIX targets rename the .text and .data sectons... |
|
.*: file format .* |
|
Sections: |
Idx +Name +Size +VMA +LMA +File off +Algn +Flags |
0 .text 0+0000020 0+0000000 0+0000000 [0-9a-f]+ 2\*\*[0-9]+ CONTENTS, ALLOC, LOAD,.*CODE |
1 .data 0+0000010 0+0100000 0+0100000 [0-9a-f]+ 2\*\*[0-9]+ CONTENTS, ALLOC, LOAD, DATA |
/testsuite/ld-scripts/empty-address-2a.d
0,0 → 1,9
#source: empty-address-2.s |
#ld: -Ttext 0x0000000 -Tdata 0x2000000 -T empty-address-2a.t |
#nm: -n |
#notarget: frv-*-*linux* *-*-linux*aout *-*-linux*oldld |
#... |
0+0 T _start |
#... |
0+10 A __data_end |
#pass |
/testsuite/ld-scripts/rgn-over5.d
0,0 → 1,36
# name: rgn-over5 |
# source: rgn-over.s |
# ld: -T rgn-over5.t -Map tmpdir/rgn-over5.map |
# error: \A[^ \n]*?ld[^:\n]*?: [^\n]*?section `\.text' will not fit in region `v1'\n[^ \n]*?ld[^:\n]*?: region `v1' overflowed by 16 bytes\Z |
|
Discarded input sections |
#... |
Memory\s+Configuration |
|
Name\s+Origin\s+Length\s+Attributes |
bss\s+0x0+0000\s+0x0+0000\s+xrw |
r1\s+0x0+1000\s+0x0+0018\s+xrw |
v1\s+0x0+2000\s+0x0+0008\s+xrw |
\*default\*\s+0x0+0000\s+0xf+ffff |
|
Linker\s+script\s+and\s+memory\s+map |
|
\s*0x0+1000\s+_start\s+=\s+0x1000 |
|
\s*\.bss\s+0x0+0000\s+0x0 |
\s*\*\(\.bss\) |
\s*\.bss\s+0x0+0000\s+0x0\s+.*? |
|
\s*\.text\s+0x0+1000\s+0xc\s+load\s+address\s+0x0+2000 |
\s*\*\(\.txt\) |
\s*\.txt\s+0x0+1000\s+0xc\s+.*? |
|
\s*\.data\s+0x0+100c\s+0xc\s+load\s+address\s+0x0+200c |
\s*\*\(\.dat\) |
\s*\.dat\s+0x0+100c\s+0xc\s+.*? |
|
/DISCARD/ |
\*\(\*\) |
LOAD\s+.*? |
OUTPUT\(.*?\) |
#pass |
/testsuite/ld-scripts/include-sections.t
0,0 → 1,5
SECTIONS { |
.text : { *(.text) } >rom |
INCLUDE include-data.t |
/DISCARD/ : { *(*) } |
} |
/testsuite/ld-scripts/size-2.s
0,0 → 1,8
.text |
.long 1,2 |
|
.section .tdata |
.long 6,7,8,9,10 |
|
.section .tbss |
.long 0,0,0,0,0,0 |
/testsuite/ld-scripts/sort_b_a.d
0,0 → 1,14
#source: sort_b_a.s |
#ld: -T sort_b_a.t |
#name: SORT_BY_ALIGNMENT |
#nm: -n |
|
#... |
0[0-9a-f]* t text3 |
#... |
0[0-9a-f]* t text1 |
#... |
0[0-9a-f]* t text |
#... |
0[0-9a-f]* t text2 |
#pass |
/testsuite/ld-scripts/size-2.t
0,0 → 1,21
PHDRS |
{ |
header PT_PHDR FILEHDR PHDRS ; |
|
image PT_LOAD FLAGS (5); |
tls PT_TLS FLAGS (4); |
|
} |
SECTIONS |
{ |
.text 0x100 : { *(.text) } :image |
.tdata : { *(.tdata) } :image :tls |
.tbss : { *(.tbss) } :image : tls |
.map : { |
LONG (SIZEOF (.text)) |
LONG (SIZEOF (.data)) |
LONG (SIZEOF (.bss)) |
LONG (SIZEOF (.tdata)) |
LONG (SIZEOF (.tbss)) |
} :image |
} |