From 63f2573fe476336550cf141d09a62bc1a349eba2 Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Mon, 19 Jan 2009 17:33:26 +0000 Subject: [PATCH] * ld-cris/expdref3.s, ld-cris/expdref4.s, ld-cris/weakref3.d, ld-cris/weakref4.d: New tests. * ld-cris/libdso-15b.d: Adjust for recent weakref fix. --- ld/testsuite/ChangeLog | 6 ++++++ ld/testsuite/ld-cris/expdref3.s | 9 ++++++++ ld/testsuite/ld-cris/expdref4.s | 7 ++++++ ld/testsuite/ld-cris/libdso-15b.d | 4 +++- ld/testsuite/ld-cris/weakref3.d | 36 +++++++++++++++++++++++++++++++ ld/testsuite/ld-cris/weakref4.d | 32 +++++++++++++++++++++++++++ 6 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 ld/testsuite/ld-cris/expdref3.s create mode 100644 ld/testsuite/ld-cris/expdref4.s create mode 100644 ld/testsuite/ld-cris/weakref3.d create mode 100644 ld/testsuite/ld-cris/weakref4.d diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 3c9fac77090..ee3615b7d55 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-01-19 Hans-Peter Nilsson + + * ld-cris/expdref3.s, ld-cris/expdref4.s, ld-cris/weakref3.d, + ld-cris/weakref4.d: New tests. + * ld-cris/libdso-15b.d: Adjust for recent weakref fix. + 2009-01-19 H.J. Lu * ld-elf/group9.s: Replace .byte with .long. diff --git a/ld/testsuite/ld-cris/expdref3.s b/ld/testsuite/ld-cris/expdref3.s new file mode 100644 index 00000000000..dd35893d340 --- /dev/null +++ b/ld/testsuite/ld-cris/expdref3.s @@ -0,0 +1,9 @@ + .text + .global x + .type x,@function +x: + move.d expobj2,$r10 + move.d expfn2,$r10 +.Lfe1: + .size x,.Lfe1-x + diff --git a/ld/testsuite/ld-cris/expdref4.s b/ld/testsuite/ld-cris/expdref4.s new file mode 100644 index 00000000000..e6390390636 --- /dev/null +++ b/ld/testsuite/ld-cris/expdref4.s @@ -0,0 +1,7 @@ + .data + .global x + .type x,@object +x: + .dword expobj2 +.Lfe1: + .size x,.Lfe1-x diff --git a/ld/testsuite/ld-cris/libdso-15b.d b/ld/testsuite/ld-cris/libdso-15b.d index 0f14c5ea83e..308b110f35f 100644 --- a/ld/testsuite/ld-cris/libdso-15b.d +++ b/ld/testsuite/ld-cris/libdso-15b.d @@ -9,12 +9,14 @@ # definition is also in the other DSO. # There was a bug causing GOT markups to be during symbol handling, # with a newly added assertion failure and a reloc turned R_CRIS_NONE. +# The dynamic __expobj2 entry is unused and seems spurious, or there +# should at least be a similar __expfn2 reference .*: file format elf32-cris DYNAMIC SYMBOL TABLE: #... -0+ w[ ]+DO \*UND\*[ ]+0+ TST3[ ]+__expobj2 +0+[ ]+DO \*UND\*[ ]+0+ TST3[ ]+__expobj2 #... 0+[ ]+DO \*UND\*[ ]+0+ TST3[ ]+expobj2 0+[ ]+DF \*UND\*[ ]+0+ TST3[ ]+expfn2 diff --git a/ld/testsuite/ld-cris/weakref3.d b/ld/testsuite/ld-cris/weakref3.d new file mode 100644 index 00000000000..492ef417a71 --- /dev/null +++ b/ld/testsuite/ld-cris/weakref3.d @@ -0,0 +1,36 @@ +#source: start1.s +#source: expdref3.s +#as: --no-underscore --em=criself +#ld: -m crislinux +#ld_after_inputfiles: tmpdir/libdso-15.so +#readelf: -a -x 10 + +# Like libdso-15b.d, but referencing the weak symbol and function from +# a program. At some time we broke emitting a copy reloc for the +# object, instead yielding NULL. + +#... + \[[0-9]+\] .got PROGBITS 0+82314 000314 000010 04 WA 0 0 4 +#... + \[[0-9]+\] .bss NOBITS 0+82324 .* +#... +Relocation section '.rela.dyn' at offset 0x... contains 1 entries: + Offset Info Type Sym.Value Sym. Name \+ Addend +00082324 00000109 R_CRIS_COPY 00082324 __expobj2 \+ 0 + +Relocation section '.rela.plt' at offset 0x... contains 1 entries: + Offset Info Type Sym.Value Sym. Name \+ Addend +00082320 0000030b R_CRIS_JUMP_SLOT 00080238 expfn2 \+ 0 + +There are no unwind sections in this file. + +Symbol table '.dynsym' contains . entries: +#... + .: 00082324 4 OBJECT GLOBAL DEFAULT 13 __expobj2@TST3 \(2\) +#... + .: 00080238 0 FUNC GLOBAL DEFAULT UND expfn2@TST3 \(2\) +#... +Symbol table '.symtab' contains .. entries: +#... +Hex dump of section '\.text': + 0x0008024c 41b20000 6fae2423 08006fae 38020800 .* diff --git a/ld/testsuite/ld-cris/weakref4.d b/ld/testsuite/ld-cris/weakref4.d new file mode 100644 index 00000000000..8b19f2f28cd --- /dev/null +++ b/ld/testsuite/ld-cris/weakref4.d @@ -0,0 +1,32 @@ +#source: start1.s +#source: expdref4.s +#as: --no-underscore --em=criself +#ld: -m crislinux +#ld_after_inputfiles: tmpdir/libdso-15.so +#readelf: -a -x 11 + +# Like weakref3.d, but just the expobj2 referenced from .data. We +# should avoid a copy reloc (instead emitting a R_CRIS_GLOB_DAT or +# R_CRIS_32 against the weak symbol), but for the time being, make +# sure we get a valid reloc. + +#... + \[[0-9]+\] .data PROGBITS 0+822a4 0002a4 000004 00 WA 0 0 1 +#... + \[[0-9]+\] .bss NOBITS 0+822a8 .* +#... +Relocation section '.rela.dyn' at offset 0x... contains 1 entries: +#... +000822a8 00000109 R_CRIS_COPY 000822a8 __expobj2 \+ 0 + +There are no unwind sections in this file. + +Symbol table '.dynsym' contains . entries: +#... + .: 000822a8 4 OBJECT GLOBAL DEFAULT 12 __expobj2@TST3 \(2\) +#... +Symbol table '.symtab' contains .. entries: +#... +Hex dump of section '.data': + 0x000822a4 a8220800 .* + -- 2.30.2