diff options
Diffstat (limited to 'ld/testsuite')
40 files changed, 422 insertions, 61 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index a2c3050..8c94dc8 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,103 @@ +2008-10-29 Nick Clifton <nickc@redhat.com> + + * ld-gc/gc.c (dummy_func): New function - present so that + underscore prefixed aliases can be created of the used_func and + main functions. + +2008-10-10 Nathan Froyd <froydnj@codesourcery.com> + + * ld-powerpc/gnu-attr-12-1.s: New file. + * ld-powerpc/gnu-attr-12-2.s: New file. + * ld-powerpc/gnu-attr-12-11.d: New file. + * ld-powerpc/gnu-attr-12-21.d: New file. + * ld-powerpc/powerpc.exp: Run new dump tests. + +2008-10-07 Nick Clifton <nickc@redhat.com> + + * ld-ia64/tlsbin.rd: Update expected output now that --wide does + not truncate section names. + * ld-ia64/tlspic.rd: Likewise. + +2008-10-06 Tom Tromey <tromey@redhat.com> + + * ld-elf/eh1.d, ld-elf/eh2.d, ld-elf/eh3.d, ld-elf/eh4.d, + ld-elf/eh5.d, ld-elf/eh6.d, ld-mips-elf/eh-frame1-n32.d, + ld-mips-elf/eh-frame1-n64.d, ld-mips-elf/eh-frame2-n32.d, + ld-mips-elf/eh-frame2-n64.d, ld-mips-elf/eh-frame3.d, + ld-mips-elf/eh-frame4.d: Update for readelf change. + +2008-10-04 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/6931 + * ld-elf/group7.d: New. + +2008-10-03 H.J. Lu <hongjiu.lu@intel.com> + + * ld-elf/group5.d: Updated. + * ld-elf/group6.d: Likewise. + +2008-10-03 Tristan Gingold <gingold@adacore.com> + + * ld-elf/stab.d: Don't run on alpha (to avoid relocation + overflow on 64 bits targets whose stab values is 32 bits). + +2008-10-03 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/6931 + * ld-elf/group4.d: New. + * ld-elf/group5.d: Likewise. + * ld-elf/group6.d: Likewise. + +2008-10-03 Alan Modra <amodra@bigpond.net.au> + + * ld-powerpc/vxworks1-lib.rd: Update. + +2008-09-29 Alan Modra <amodra@bigpond.net.au> + + * ld-elf/extract-symbol-1sec.d: Correct section lma. + +2008-09-25 Alan Modra <amodra@bigpond.net.au> + + * ld-elf/eh-group.exp: Only run on ELF targets. + * ld-elf/eh5b.s: Export main, start, __start. + +2008-09-20 Richard Sandiford <rdsandiford@googlemail.com> + + * ld-mips-elf/reloc-estimate-1.d: Make endian-neutral. + +2008-09-20 Jan Kratochvil <jan.kratochvil@redhat.com> + + Provide virtual target "cfi" for targets supporting CFI. + * ld-elf/eh-frame-hdr.d: Replace target and xfail statements by single + `target: cfi'. + * ld-elf/eh-group.exp: Call check_as_cfi instead of is_elf_format. + * ld-elf/eh-group1.s, elf/eh-group2.s: Use more compatible section + flags prefix '%'. + * ld-elf/eh5.d: Replace target statement by `target: cfi' with an Alpha + exception. Relax the `Code alignment factor' matching. + * lib/ld-lib.exp: Rename istarget as istarget_ld. + (istarget, check_as_cfi): New procedure. + (run_dump_test): New comment for the virtual target `cfi'. + +2008-09-17 Jan Kratochvil <jan.kratochvil@redhat.com> + + * ld-elf/eh-group.exp, ld-elf/eh-group1.s, ld-elf/eh-group2.s: New test. + +2008-09-17 Jan Kratochvil <jan.kratochvil@redhat.com> + + Fix testcases compilation failures due to unused variables. + * ld-elfcomm/common1b.c (dummy1): Mark the variable for GCC as USED. + * ld-shared/main.c (main): Move the P variable only to the places where + it is used. + +2008-09-16 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/6877 + * ld-elf/comm1.c: New. + * ld-elf/func1.c: Likewise. + + * ld-elf/shared.exp: Add tests for libfunc1.so and comm1. + 2008-08-26 Nick Clifton <nickc@redhat.com> * ld-arm/arm-elf.exp: Add farcall-thumb-arm-short test. diff --git a/ld/testsuite/ld-elf/comm1.c b/ld/testsuite/ld-elf/comm1.c new file mode 100644 index 0000000..c553d86 --- /dev/null +++ b/ld/testsuite/ld-elf/comm1.c @@ -0,0 +1,17 @@ +#include <stdio.h> +#include <stdlib.h> + +int foo; +void bar (void); + +int +main () +{ + if (foo != 0) + abort (); + foo = 200; + bar (); + if (foo == 200) + printf ("PASS\n"); + return 0; +} diff --git a/ld/testsuite/ld-elf/eh-frame-hdr.d b/ld/testsuite/ld-elf/eh-frame-hdr.d index b465e5d..af8ae04 100644 --- a/ld/testsuite/ld-elf/eh-frame-hdr.d +++ b/ld/testsuite/ld-elf/eh-frame-hdr.d @@ -1,17 +1,7 @@ #source: eh-frame-hdr.s #ld: -e _start --eh-frame-hdr #objdump: -hw -#target: alpha*-*-* -#target: arm*-*-* -#target: i?86-*-* -#target: m68k-*-* -#target: mips*-*-* -#target: powerpc*-*-* -#target: s390*-*-* -#target: sh*-*-* -#xfail: sh*l*-*-* -#target: sparc*-*-* -#target: x86_64-*-* +#target: cfi #... [0-9] .eh_frame_hdr 0*[12][048c] .* #pass diff --git a/ld/testsuite/ld-elf/eh-group.exp b/ld/testsuite/ld-elf/eh-group.exp new file mode 100644 index 0000000..6072355 --- /dev/null +++ b/ld/testsuite/ld-elf/eh-group.exp @@ -0,0 +1,56 @@ +# Expect script for .eh_frame entries to a removed section. +# Copyright 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. +# + +# +# Written by Jan Kratochvil (jan.kratochvil@redhat.com) +# +# .eh_frame with relocations to a removed (group) section did result to: +# error in tmpdir/eh-group.o(.eh_frame); no .eh_frame_hdr table will be created. +# The purpose of this test is to merge two .o files with -r and then link this +# merged file (containing a discarded R_X86_64_NONE relocation) to the final +# executable trying to create .eh_frame_hdr. It needs a separate .exp file due +# to the requirement of two `ld' runs. + +# Exclude non-CFI (such as ia64) targets. + +if {![check_as_cfi]} { + return +} + +# The test uses ELF .section directive +if ![is_elf_format] { + return +} + +set build_tests_ld { + {"Build eh-group1.o" + "-r" "" + {eh-group1.s eh-group2.s} {} "eh-group.o"} +} + +run_ld_link_tests $build_tests_ld + +set testname "Link eh-group.o to eh-group" +if [ld_simple_link $ld "tmpdir/eh-group" "-e _start tmpdir/eh-group.o"] { + pass $testname +} else { + fail $testname +} diff --git a/ld/testsuite/ld-elf/eh-group1.s b/ld/testsuite/ld-elf/eh-group1.s new file mode 100644 index 0000000..d6fdb88 --- /dev/null +++ b/ld/testsuite/ld-elf/eh-group1.s @@ -0,0 +1,6 @@ + .section sect, "axG", %progbits, sectgroup, comdat + .global _start +_start: + .cfi_startproc + .skip 16 + .cfi_endproc diff --git a/ld/testsuite/ld-elf/eh-group2.s b/ld/testsuite/ld-elf/eh-group2.s new file mode 100644 index 0000000..2ec8919 --- /dev/null +++ b/ld/testsuite/ld-elf/eh-group2.s @@ -0,0 +1,4 @@ + .section sect, "axG", %progbits, sectgroup, comdat + .cfi_startproc + .skip 16 + .cfi_endproc diff --git a/ld/testsuite/ld-elf/eh1.d b/ld/testsuite/ld-elf/eh1.d index a672f5b..f0874f7 100644 --- a/ld/testsuite/ld-elf/eh1.d +++ b/ld/testsuite/ld-elf/eh1.d @@ -4,7 +4,7 @@ #readelf: -wf #target: x86_64-*-* -The section .eh_frame contains: +Contents of the .eh_frame section: 00000000 00000014 00000000 CIE Version: 1 diff --git a/ld/testsuite/ld-elf/eh2.d b/ld/testsuite/ld-elf/eh2.d index 788d23d..1a05d7f 100644 --- a/ld/testsuite/ld-elf/eh2.d +++ b/ld/testsuite/ld-elf/eh2.d @@ -4,7 +4,7 @@ #readelf: -wf #target: x86_64-*-* -The section .eh_frame contains: +Contents of the .eh_frame section: 00000000 00000014 00000000 CIE Version: 1 diff --git a/ld/testsuite/ld-elf/eh3.d b/ld/testsuite/ld-elf/eh3.d index 6816313..1f76b8c 100644 --- a/ld/testsuite/ld-elf/eh3.d +++ b/ld/testsuite/ld-elf/eh3.d @@ -4,7 +4,7 @@ #readelf: -wf #target: x86_64-*-* -The section .eh_frame contains: +Contents of the .eh_frame section: 00000000 00000014 00000000 CIE Version: 1 diff --git a/ld/testsuite/ld-elf/eh4.d b/ld/testsuite/ld-elf/eh4.d index 5efecab..b8f9865 100644 --- a/ld/testsuite/ld-elf/eh4.d +++ b/ld/testsuite/ld-elf/eh4.d @@ -4,7 +4,7 @@ #readelf: -wf #target: x86_64-*-* -The section .eh_frame contains: +Contents of the .eh_frame section: 00000000 00000014 00000000 CIE Version: 1 diff --git a/ld/testsuite/ld-elf/eh5.d b/ld/testsuite/ld-elf/eh5.d index 13bff08..48ab7d7 100644 --- a/ld/testsuite/ld-elf/eh5.d +++ b/ld/testsuite/ld-elf/eh5.d @@ -3,14 +3,15 @@ #source: eh5b.s #ld: #readelf: -wf -#target: x86_64-*-* i?86-*-* +#target: cfi +#notarget: alpha* -The section .eh_frame contains: +Contents of the .eh_frame section: 00000000 0000001[04] 00000000 CIE Version: 1 Augmentation: "zR" - Code alignment factor: 1 + Code alignment factor: .* Data alignment factor: .* Return address column: .* Augmentation data: 1b @@ -29,7 +30,7 @@ The section .eh_frame contains: 000000(2c|30) 00000014 00000000 CIE Version: 1 Augmentation: "zPR" - Code alignment factor: 1 + Code alignment factor: .* Data alignment factor: .* Return address column: .* Augmentation data: 03 .. .. .. .. 1b @@ -53,7 +54,7 @@ The section .eh_frame contains: 0000007[48] 0000001[8c] 00000000 CIE Version: 1 Augmentation: "zPLR" - Code alignment factor: 1 + Code alignment factor: .* Data alignment factor: .* Return address column: .* Augmentation data: 03 .. .. .. .. 0c 1b @@ -74,7 +75,7 @@ The section .eh_frame contains: 000000b[08] 0000001[04] 00000000 CIE Version: 1 Augmentation: "zR" - Code alignment factor: 1 + Code alignment factor: .* Data alignment factor: .* Return address column: .* Augmentation data: 1b @@ -89,7 +90,7 @@ The section .eh_frame contains: 000000[de]8 00000014 00000000 CIE Version: 1 Augmentation: "zPR" - Code alignment factor: 1 + Code alignment factor: .* Data alignment factor: .* Return address column: .* Augmentation data: 03 .. .. .. .. 1b @@ -111,7 +112,7 @@ The section .eh_frame contains: 000001(1c|30) 0000001[8c] 00000000 CIE Version: 1 Augmentation: "zPLR" - Code alignment factor: 1 + Code alignment factor: .* Data alignment factor: .* Return address column: .* Augmentation data: 03 .. .. .. .. 0c 1b diff --git a/ld/testsuite/ld-elf/eh5b.s b/ld/testsuite/ld-elf/eh5b.s index 3e5e010..fa27edd 100644 --- a/ld/testsuite/ld-elf/eh5b.s +++ b/ld/testsuite/ld-elf/eh5b.s @@ -24,6 +24,12 @@ .cfi_def_cfa 0, 16 .cfi_endproc + .globl main + .globl start .globl _start + .globl __start +main: +start: _start: +__start: .long 0 diff --git a/ld/testsuite/ld-elf/eh6.d b/ld/testsuite/ld-elf/eh6.d index 7f4e47a..67c6a06 100644 --- a/ld/testsuite/ld-elf/eh6.d +++ b/ld/testsuite/ld-elf/eh6.d @@ -3,7 +3,7 @@ #readelf: -wf #target: x86_64-*-linux-gnu i?86-*-linux-gnu -The section .eh_frame contains: +Contents of the .eh_frame section: 00000000 0000001[4c] 00000000 CIE Version: 1 diff --git a/ld/testsuite/ld-elf/extract-symbol-1sec.d b/ld/testsuite/ld-elf/extract-symbol-1sec.d index 87d42af..cbe0144 100644 --- a/ld/testsuite/ld-elf/extract-symbol-1sec.d +++ b/ld/testsuite/ld-elf/extract-symbol-1sec.d @@ -7,7 +7,7 @@ #... Sections: *Idx +Name +Size +VMA +LMA .* - *0 +\.foo +0+ +0+10000 +0+10000 .* + *0 +\.foo +0+ +0+10000 +0+ .* *CONTENTS, ALLOC, LOAD, CODE - *1 +\.bar +0+ +0+20000 +0+20000 .* + *1 +\.bar +0+ +0+20000 +0+10000 .* *ALLOC, READONLY, CODE diff --git a/ld/testsuite/ld-elf/func1.c b/ld/testsuite/ld-elf/func1.c new file mode 100644 index 0000000..99443e4 --- /dev/null +++ b/ld/testsuite/ld-elf/func1.c @@ -0,0 +1,2 @@ +void foo (void) { } +void bar (void) { } diff --git a/ld/testsuite/ld-elf/group4.d b/ld/testsuite/ld-elf/group4.d new file mode 100644 index 0000000..92a54bd --- /dev/null +++ b/ld/testsuite/ld-elf/group4.d @@ -0,0 +1,16 @@ +#source: ../../../binutils/testsuite/binutils-all/group-2.s +#ld: -r +#readelf: -Sg --wide + +#... + \[[ 0-9]+\] .group[ \t]+GROUP[ \t]+.* +#... + \[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AXG[ \t]+.* +#... + \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG[ \t]+.* +#... +COMDAT group section \[[ 0-9]+\] `.group' \[.text.foo\] contains 2 sections: + \[Index\] Name + \[[ 0-9]+\] .text.* + \[[ 0-9]+\] .data.* +#pass diff --git a/ld/testsuite/ld-elf/group5.d b/ld/testsuite/ld-elf/group5.d new file mode 100644 index 0000000..7d6eff6 --- /dev/null +++ b/ld/testsuite/ld-elf/group5.d @@ -0,0 +1,16 @@ +#source: ../../../binutils/testsuite/binutils-all/group-3.s +#ld: -r +#readelf: -Sg --wide + +#... + \[[ 0-9]+\] .group[ \t]+GROUP[ \t]+.* +#... + \[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AXG[ \t]+.* +#... + \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG[ \t]+.* +#... +COMDAT group section \[[ 0-9]+\] `.group' \[foo3\] contains 2 sections: + \[Index\] Name + \[[ 0-9]+\] .text.* + \[[ 0-9]+\] .data.* +#pass diff --git a/ld/testsuite/ld-elf/group6.d b/ld/testsuite/ld-elf/group6.d new file mode 100644 index 0000000..b113414 --- /dev/null +++ b/ld/testsuite/ld-elf/group6.d @@ -0,0 +1,16 @@ +#source: ../../../binutils/testsuite/binutils-all/group-4.s +#ld: -r +#readelf: -Sg --wide + +#... + \[[ 0-9]+\] .group[ \t]+GROUP[ \t]+.* +#... + \[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AXG[ \t]+.* +#... + \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG[ \t]+.* +#... +COMDAT group section \[[ 0-9]+\] `.group' \[foo4\] contains 2 sections: + \[Index\] Name + \[[ 0-9]+\] .text.* + \[[ 0-9]+\] .data.* +#pass diff --git a/ld/testsuite/ld-elf/group7.d b/ld/testsuite/ld-elf/group7.d new file mode 100644 index 0000000..bfd1f3f --- /dev/null +++ b/ld/testsuite/ld-elf/group7.d @@ -0,0 +1,28 @@ +#source: ../../../binutils/testsuite/binutils-all/group.s +#source: ../../../binutils/testsuite/binutils-all/group-2.s +#source: ../../../binutils/testsuite/binutils-all/group-3.s +#source: ../../../binutils/testsuite/binutils-all/group-4.s +#ld: -r +#readelf: -g --wide + +#... +COMDAT group section \[[ 0-9]+\] `foo_group' \[foo_group\] contains 2 sections: + \[Index\] Name + \[[ 0-9]+\] .text.foo + \[[ 0-9]+\] .data.foo +#... +COMDAT group section \[[ 0-9]+\] `.group' \[.text.foo\] contains 2 sections: + \[Index\] Name + \[[ 0-9]+\] .text.foo + \[[ 0-9]+\] .data.bar +#... +COMDAT group section \[[ 0-9]+\] `.group' \[foo3\] contains 2 sections: + \[Index\] Name + \[[ 0-9]+\] .text.foo3 + \[[ 0-9]+\] .data.bar3 +#... +COMDAT group section \[[ 0-9]+\] `.group' \[foo4\] contains 2 sections: + \[Index\] Name + \[[ 0-9]+\] .text.foo4 + \[[ 0-9]+\] .data.foo4 +#pass diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 846027e..f0bc403 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -123,6 +123,12 @@ set build_tests { {"Build libdata1.so" "-shared" "-fPIC" {data1.c} {} "libdata1.so"} + {"Build libcomm1.o" + "-r -nostdlib" "" + {comm1.c} {} "libcomm1.o"} + {"Build libfunc1.so" + "-shared" "-fPIC" + {func1.c} {} "libfunc1.so"} } set run_tests { @@ -235,6 +241,12 @@ set run_tests { {"Run with libdata1.so" "tmpdir/libdata1.so" "" {dynbss1.c} "dynbss1" "pass.out"} + {"Run with libfunc1.so comm1.o" + "tmpdir/libfunc1.so tmpdir/comm1.o" "" + {dummy.c} "comm1" "pass.out"} + {"Run with comm1.o libfunc1.so" + "tmpdir/comm1.o tmpdir/libfunc1.so" "" + {dummy.c} "comm1" "pass.out"} } run_cc_link_tests $build_tests diff --git a/ld/testsuite/ld-elf/stab.d b/ld/testsuite/ld-elf/stab.d index 6676238..346640d 100644 --- a/ld/testsuite/ld-elf/stab.d +++ b/ld/testsuite/ld-elf/stab.d @@ -2,7 +2,10 @@ #as: -gstabs #readelf: -S --wide #ld: -#notarget: ia64-*-* +#notarget: "ia64-*-*" "alpha*" + +# Disabled on alpha because the entry point may be above 4GB but the stabs +# value on 32 bits. #... \[[0-9 ][0-9]\] \.stab +PROGBITS +0+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ +[1-9]+ +0.* diff --git a/ld/testsuite/ld-elfcomm/common1b.c b/ld/testsuite/ld-elfcomm/common1b.c index 4ed9e03..a375c90 100644 --- a/ld/testsuite/ld-elfcomm/common1b.c +++ b/ld/testsuite/ld-elfcomm/common1b.c @@ -1,3 +1,7 @@ -static char dummy1 = 'X'; +static +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) + __attribute__((__used__)) +#endif /* __GNUC__ */ + char dummy1 = 'X'; char foo1 [] = "Aligned at odd byte."; char foo2 [4]; diff --git a/ld/testsuite/ld-gc/gc.c b/ld/testsuite/ld-gc/gc.c index 6b356ad..3b0e655 100644 --- a/ld/testsuite/ld-gc/gc.c +++ b/ld/testsuite/ld-gc/gc.c @@ -19,3 +19,23 @@ main (void) { return used_func (5); } + +void +dummy_func (void) +{ + /* These are here in case the target prepends an underscore to + the start of function names. They are inside a dummy function + so that they will appear at the end of gcc's assembler output, + after the definitions of main() and used_func(), rather than + at the beginning of the file. */ + + __asm__(".ifndef main\n\ +.global main\n\ +.set main, _main\n\ +.endif"); + + __asm__(".ifndef used_func\n\ +.global used_func\n\ +.set used_func, _used_func\n\ +.endif"); +} diff --git a/ld/testsuite/ld-ia64/tlsbin.rd b/ld/testsuite/ld-ia64/tlsbin.rd index 7f130a4..ca0d69e 100644 --- a/ld/testsuite/ld-ia64/tlsbin.rd +++ b/ld/testsuite/ld-ia64/tlsbin.rd @@ -15,10 +15,10 @@ Section Headers: +\[[ 0-9]+\] .dynsym +.* +\[[ 0-9]+\] .dynstr +.* +\[[ 0-9]+\] .rela.dyn +.* - +\[[ 0-9]+\] .rela.IA_64.pltof +.* + +\[[ 0-9]+\] .rela.IA_64.pltoff +.* +\[[ 0-9]+\] .plt +.* +\[[ 0-9]+\] .text +PROGBITS +40+1000 0+1000 0+140 00 +AX +0 +0 4096 - +\[[ 0-9]+\] .IA_64.unwind_inf +.* + +\[[ 0-9]+\] .IA_64.unwind_info +.* +\[[ 0-9]+\] .IA_64.unwind +.* +\[[ 0-9]+\] .tdata +PROGBITS +60+1[0-9a-f]+ 0+1[0-9a-f]+ 0+60 00 WAT +0 +0 +4 +\[[ 0-9]+\] .tbss +NOBITS +60+1[0-9a-f]+ 0+1[0-9a-f]+ 0+40 00 WAT +0 +0 +1 diff --git a/ld/testsuite/ld-ia64/tlspic.rd b/ld/testsuite/ld-ia64/tlspic.rd index 509e598..9bf4387 100644 --- a/ld/testsuite/ld-ia64/tlspic.rd +++ b/ld/testsuite/ld-ia64/tlspic.rd @@ -14,10 +14,10 @@ Section Headers: +\[[ 0-9]+\] .dynsym +.* +\[[ 0-9]+\] .dynstr +.* +\[[ 0-9]+\] .rela.dyn +.* - +\[[ 0-9]+\] .rela.IA_64.pltof +.* + +\[[ 0-9]+\] .rela.IA_64.pltoff +.* +\[[ 0-9]+\] .plt +.* +\[[ 0-9]+\] .text +PROGBITS +0+1000 0+1000 0+110 00 +AX +0 +0 4096 - +\[[ 0-9]+\] .IA_64.unwind_inf +.* + +\[[ 0-9]+\] .IA_64.unwind_info +.* +\[[ 0-9]+\] .IA_64.unwind +.* +\[[ 0-9]+\] .tdata +PROGBITS +0+11[0-9a-f]+ 0+1[0-9a-f]+ 0+60 00 WAT +0 +0 +4 +\[[ 0-9]+\] .tbss +NOBITS +0+11[0-9a-f]+ 0+1[0-9a-f]+ 0+20 00 WAT +0 +0 +1 diff --git a/ld/testsuite/ld-mips-elf/eh-frame1-n32.d b/ld/testsuite/ld-mips-elf/eh-frame1-n32.d index 3924016..6adb355 100644 --- a/ld/testsuite/ld-mips-elf/eh-frame1-n32.d +++ b/ld/testsuite/ld-mips-elf/eh-frame1-n32.d @@ -17,7 +17,7 @@ Relocation section '\.rel\.dyn' .*: 0003008b [0-9a-f]+ R_MIPS_REL32 00000000 foo 000300d0 [0-9a-f]+ R_MIPS_REL32 00000000 foo 0003010e [0-9a-f]+ R_MIPS_REL32 00000000 foo -The section \.eh_frame contains: +Contents of the section \.eh_frame: 00000000 00000010 00000000 CIE Version: 1 diff --git a/ld/testsuite/ld-mips-elf/eh-frame1-n64.d b/ld/testsuite/ld-mips-elf/eh-frame1-n64.d index f0925b9..1512b4a 100644 --- a/ld/testsuite/ld-mips-elf/eh-frame1-n64.d +++ b/ld/testsuite/ld-mips-elf/eh-frame1-n64.d @@ -33,7 +33,7 @@ Relocation section '\.rel\.dyn' .*: 000000030192 [0-9a-f]+ R_MIPS_REL32 0000000000000000 foo *Type2: R_MIPS_64 * *Type3: R_MIPS_NONE * -The section \.eh_frame contains: +Contents of the section \.eh_frame: 00000000 00000014 00000000 CIE Version: 1 diff --git a/ld/testsuite/ld-mips-elf/eh-frame2-n32.d b/ld/testsuite/ld-mips-elf/eh-frame2-n32.d index ce2aa1d..d831d26 100644 --- a/ld/testsuite/ld-mips-elf/eh-frame2-n32.d +++ b/ld/testsuite/ld-mips-elf/eh-frame2-n32.d @@ -17,7 +17,7 @@ Relocation section '\.rel\.dyn' .*: 0003008b [0-9a-f]+ R_MIPS_REL32 00000000 foo 000300cc [0-9a-f]+ R_MIPS_REL32 00000000 foo 0003010a [0-9a-f]+ R_MIPS_REL32 00000000 foo -The section \.eh_frame contains: +Contents of the section \.eh_frame: 00000000 00000010 00000000 CIE Version: 1 diff --git a/ld/testsuite/ld-mips-elf/eh-frame2-n64.d b/ld/testsuite/ld-mips-elf/eh-frame2-n64.d index 50394f5..8e741f3 100644 --- a/ld/testsuite/ld-mips-elf/eh-frame2-n64.d +++ b/ld/testsuite/ld-mips-elf/eh-frame2-n64.d @@ -33,7 +33,7 @@ Relocation section '\.rel\.dyn' .*: 00000003018a [0-9a-f]+ R_MIPS_REL32 0000000000000000 foo *Type2: R_MIPS_64 * *Type3: R_MIPS_NONE * -The section \.eh_frame contains: +Contents of the section \.eh_frame: 00000000 00000014 00000000 CIE Version: 1 diff --git a/ld/testsuite/ld-mips-elf/eh-frame3.d b/ld/testsuite/ld-mips-elf/eh-frame3.d index 4c91d2c..80f13d9 100644 --- a/ld/testsuite/ld-mips-elf/eh-frame3.d +++ b/ld/testsuite/ld-mips-elf/eh-frame3.d @@ -9,7 +9,7 @@ # combination of 32-bit objects and 64-bit FDE addresses. # -The section \.eh_frame contains: +Contents of the section \.eh_frame: 00000000 0000000c 00000000 CIE Version: 1 diff --git a/ld/testsuite/ld-mips-elf/eh-frame4.d b/ld/testsuite/ld-mips-elf/eh-frame4.d index e04d5fc..c4b7e5c 100644 --- a/ld/testsuite/ld-mips-elf/eh-frame4.d +++ b/ld/testsuite/ld-mips-elf/eh-frame4.d @@ -8,7 +8,7 @@ # This test is for the semi-official ILP32 variation of EABI64. # -The section \.eh_frame contains: +Contents of the section \.eh_frame: 00000000 0000000c 00000000 CIE Version: 1 diff --git a/ld/testsuite/ld-mips-elf/reloc-estimate-1.d b/ld/testsuite/ld-mips-elf/reloc-estimate-1.d index 94dde81..0d49b05 100644 --- a/ld/testsuite/ld-mips-elf/reloc-estimate-1.d +++ b/ld/testsuite/ld-mips-elf/reloc-estimate-1.d @@ -15,4 +15,4 @@ OFFSET TYPE VALUE # The address must be 0x810. We should only ever allocate one dynamic # reloc over and above the first R_MIPS_NONE entry. Contents of section \.foo: - 0810 deadbeef .... + 0810 (deadbeef|efbeadde) .... diff --git a/ld/testsuite/ld-powerpc/attr-gnu-12-1.s b/ld/testsuite/ld-powerpc/attr-gnu-12-1.s new file mode 100644 index 0000000..10cbe3b --- /dev/null +++ b/ld/testsuite/ld-powerpc/attr-gnu-12-1.s @@ -0,0 +1 @@ +.gnu_attribute 12,1 diff --git a/ld/testsuite/ld-powerpc/attr-gnu-12-11.d b/ld/testsuite/ld-powerpc/attr-gnu-12-11.d new file mode 100644 index 0000000..e88c4ba --- /dev/null +++ b/ld/testsuite/ld-powerpc/attr-gnu-12-11.d @@ -0,0 +1,10 @@ +#source: attr-gnu-12-1.s +#source: attr-gnu-12-1.s +#as: -a32 +#ld: -r -melf32ppc +#readelf: -A +#target: powerpc*-*-* + +Attribute Section: gnu +File Attributes + Tag_GNU_Power_ABI_Struct_Return: r3/r4 diff --git a/ld/testsuite/ld-powerpc/attr-gnu-12-2.s b/ld/testsuite/ld-powerpc/attr-gnu-12-2.s new file mode 100644 index 0000000..c39de66 --- /dev/null +++ b/ld/testsuite/ld-powerpc/attr-gnu-12-2.s @@ -0,0 +1 @@ +.gnu_attribute 12,2 diff --git a/ld/testsuite/ld-powerpc/attr-gnu-12-21.d b/ld/testsuite/ld-powerpc/attr-gnu-12-21.d new file mode 100644 index 0000000..ef14e35 --- /dev/null +++ b/ld/testsuite/ld-powerpc/attr-gnu-12-21.d @@ -0,0 +1,6 @@ +#source: attr-gnu-12-2.s +#source: attr-gnu-12-1.s +#as: -a32 +#ld: -r -melf32ppc +#warning: Warning: .* uses r3/r4 for small structure returns, .* uses memory +#target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp index 4e03cf6..af812a0 100644 --- a/ld/testsuite/ld-powerpc/powerpc.exp +++ b/ld/testsuite/ld-powerpc/powerpc.exp @@ -177,3 +177,6 @@ run_dump_test "attr-gnu-4-41" run_dump_test "attr-gnu-8-11" run_dump_test "attr-gnu-8-23" run_dump_test "attr-gnu-8-31" + +run_dump_test "attr-gnu-12-11" +run_dump_test "attr-gnu-12-21" diff --git a/ld/testsuite/ld-powerpc/vxworks1-lib.rd b/ld/testsuite/ld-powerpc/vxworks1-lib.rd index 40a5d55..113462f 100644 --- a/ld/testsuite/ld-powerpc/vxworks1-lib.rd +++ b/ld/testsuite/ld-powerpc/vxworks1-lib.rd @@ -1,9 +1,4 @@ -Relocation section '\.rela\.plt' at offset .* contains 2 entries: - Offset Info Type Sym\.Value Sym\. Name \+ Addend -0009040c .*15 R_PPC_JMP_SLOT 00000000 sexternal \+ 0 -00090410 .*15 R_PPC_JMP_SLOT 00080c48 sglobal \+ 0 - Relocation section '\.rela\.dyn' at offset .* contains 5 entries: Offset Info Type Sym\.Value Sym\. Name \+ Addend 00090800 00000016 R_PPC_RELATIVE * 00080c44 @@ -11,3 +6,8 @@ Relocation section '\.rela\.dyn' at offset .* contains 5 entries: 00080c12 .*04 R_PPC_ADDR16_LO 00000000 __GOTT_BASE__ \+ 0 00080c16 .*03 R_PPC_ADDR16 00000000 __GOTT_INDEX__ \+ 0 00090414 .*14 R_PPC_GLOB_DAT 00090c00 x \+ 0 + +Relocation section '\.rela\.plt' at offset .* contains 2 entries: + Offset Info Type Sym\.Value Sym\. Name \+ Addend +0009040c .*15 R_PPC_JMP_SLOT 00000000 sexternal \+ 0 +00090410 .*15 R_PPC_JMP_SLOT 00080c48 sglobal \+ 0 diff --git a/ld/testsuite/ld-shared/main.c b/ld/testsuite/ld-shared/main.c index ce06261..0817d27 100644 --- a/ld/testsuite/ld-shared/main.c +++ b/ld/testsuite/ld-shared/main.c @@ -38,8 +38,6 @@ shlib_overriddencall2 () int main () { - int (*p) (); - printf ("mainvar == %d\n", mainvar); printf ("overriddenvar == %d\n", overriddenvar); printf ("shlibvar1 == %d\n", shlibvar1); @@ -62,21 +60,29 @@ main () printf ("shlib_checkfunptr2 (main_called) == %d\n", shlib_checkfunptr2 (main_called)); #endif - p = shlib_getfunptr1 (); - printf ("shlib_getfunptr1 () "); - if (p == shlib_shlibvar1) - printf ("=="); - else - printf ("!="); - printf (" shlib_shlibvar1\n"); + { + int (*p) (); + + p = shlib_getfunptr1 (); + printf ("shlib_getfunptr1 () "); + if (p == shlib_shlibvar1) + printf ("=="); + else + printf ("!="); + printf (" shlib_shlibvar1\n"); + } #ifndef XCOFF_TEST - p = shlib_getfunptr2 (); - printf ("shlib_getfunptr2 () "); - if (p == main_called) - printf ("=="); - else - printf ("!="); - printf (" main_called\n"); + { + int (*p) (); + + p = shlib_getfunptr2 (); + printf ("shlib_getfunptr2 () "); + if (p == main_called) + printf ("=="); + else + printf ("!="); + printf (" main_called\n"); + } #endif #endif printf ("shlib_check () == %d\n", shlib_check ()); diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index 1ebb1a2..d4e996e 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -598,7 +598,8 @@ proc simple_diff { file_1 file_2 } { # # target: TARGET # Only run the test for TARGET. This may occur more than once; the -# target being tested must match at least one. +# target being tested must match at least one. You may provide target +# name "cfi" for any target supporting the CFI statements. # # notarget: TARGET # Do not run the test for TARGET. This may occur more than once; @@ -1569,3 +1570,39 @@ proc check_gc_sections_available { } { } return $gc_sections_available_saved } + +# Check if the assembler supports CFI statements. + +proc check_as_cfi { } { + global check_as_cfi_result + global as + if [info exists check_as_cfi_result] { + return $check_as_cfi_result + } + set as_file "tmpdir/check_as_cfi.s" + set as_fh [open $as_file w 0666] + puts $as_fh "# Generated file. DO NOT EDIT" + puts $as_fh "\t.cfi_startproc" + puts $as_fh "\t.cfi_endproc" + close $as_fh + remote_download host $as_file + verbose -log "Checking CFI support:" + rename "perror" "check_as_cfi_perror" + proc perror { args } { } + set success [ld_assemble $as $as_file "/dev/null"] + rename "perror" "" + rename "check_as_cfi_perror" "perror" + #remote_file host delete $as_file + set check_as_cfi_result $success + return $success +} + +# Provide virtual target "cfi" for targets supporting CFI. + +rename "istarget" "istarget_ld" +proc istarget { target } { + if {$target == "cfi"} { + return [check_as_cfi] + } + return [istarget_ld $target] +} |