+2008-12-23 Hans-Peter Nilsson <hp@axis.com>
+
+ * lib/ld-lib.exp (run_dump_test): New option ld_after_inputfiles.
+ * ld-cris/libdso-1c.d, ld-cris/expdref2.s, ld-cris/libdso-15b.d,
+ ld-cris/expdyn1w.s, ld-cris/libdso-1d.d, ld-cris/tls-ie-78.d: New
+ tests.
+
2008-12-23 Nick Clifton <nickc@redhat.com>
* ld-i386/i386.exp: Do not run ifunc test.
--- /dev/null
+ .text
+ .global x
+ .type x,@function
+x:
+ move.d expobj2:GOT,$r10
+ move.d expobj2:PLT,$r10
+ move.d expfn2:GOT,$r10
+ move.d expfn2:PLT,$r10
+.Lfe1:
+ .size x,.Lfe1-x
+
--- /dev/null
+ .weak expobj
+ .weak expfn
+ .include "expdyn1.s"
--- /dev/null
+#source: expdref2.s
+#as: --pic --no-underscore --em=criself
+#ld: --shared -m crislinux
+#ld_after_inputfiles: tmpdir/libdso-15.so
+#objdump: -s -T
+
+# A DSO that refers to two symbols in another DSO with
+# GOT/PLT-generating relocs, using weak aliases where the strong
+# 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.
+
+.*: file format elf32-cris
+
+DYNAMIC SYMBOL TABLE:
+#...
+0+ w[ ]+DO \*UND\*[ ]+0+ TST3[ ]+__expobj2
+#...
+0+[ ]+DO \*UND\*[ ]+0+ TST3[ ]+expobj2
+0+[ ]+DF \*UND\*[ ]+0+ TST3[ ]+expfn2
+#...
+Contents of section .rela.dyn:
+ 01d4 fc220000 0a040000 00000000 00230000 .*
+ 01e4 0a050000 00000000 .*
+Contents of section .plt:
+ 01ec fce17e7e 0401307a 08013009 00000000 .*
+ 01fc 00000000 6f0d0c00 00003009 3f7e0000 .*
+ 020c 00002ffe ecffffff 6f0d1000 00003009 .*
+ 021c 3f7e0000 00002ffe ecffffff .*
+Contents of section .text:
+ 0228 6fae0c00 00006fae ccffffff 6fae1000 .*
+ 0238 00006fae d4ffffff .*
+#...
+Contents of section .got:
+ 22f0 40220000 00000000 00000000 00000000 .*
+ 2300 00000000 .*
--- /dev/null
+#source: expdref1.s
+#as: --pic --no-underscore --em=criself -I$srcdir/$subdir
+#ld: --shared -m crislinux
+#ld_after_inputfiles: tmpdir/libdso-1b.so
+#objdump: -s -T
+
+# A DSO linked to another DSO that has two versioned symbols, to which
+# this DSO refers with two relocs each, a GOT and a PLT reference.
+# There was a bug such that GOT markups were lost, resulting in wrong
+# offsets into the GOT, with a tell-tale sign being one or more
+# R_CRIS_NONE relocs. There should be two GOT relocs here, one each
+# for the symbols.
+
+.*: file format elf32-cris
+
+DYNAMIC SYMBOL TABLE:
+#...
+0+[ ]+DF \*UND\* 0+[ ]+TST2[ ]+expobj
+0+[ ]+DF \*UND\* 0+[ ]+TST2[ ]+expfn
+#...
+Contents of section .rela.dyn:
+ 01a4 cc220000 0a030000 00000000 d0220000 .*
+ 01b4 0a040000 00000000 .*
+Contents of section .plt:
+ 01bc fce17e7e 0401307a 08013009 00000000 .*
+ 01cc 00000000 6f0d0c00 00003009 3f7e0000 .*
+ 01dc 00002ffe ecffffff 6f0d1000 00003009 .*
+ 01ec 3f7e0000 00002ffe ecffffff .*
+Contents of section .text:
+ 01f8 6fae0c00 00006fae ccffffff 6fae1000 .*
+ 0208 00006fae d4ffffff .*
+#...
+Contents of section .got:
+ 22c0 10220000 00000000 00000000 00000000 .*
+ 22d0 00000000 .*
--- /dev/null
+#source: expdref1.s
+#source: expdyn1w.s
+#as: --pic --no-underscore --em=criself -I$srcdir/$subdir
+#ld: --shared -m crislinux
+#ld_after_inputfiles: tmpdir/libdso-1b.so
+#objdump: -s -T
+
+# A DSO linked to another DSO that has two versioned symbols, to which
+# this DSO refers with two relocs each, a GOT and a PLT reference.
+# This DSO has weak definitions of those symbols.
+
+.*: file format elf32-cris
+
+DYNAMIC SYMBOL TABLE:
+#...
+0+1f2 w DF .text 0+2 expfn
+0+22a0 w DO .data 0+4 expobj
+#...
+Contents of section .rela.dyn:
+ 0184 98220000 0a020000 00000000 9c220000 .*
+ 0194 0a030000 00000000 .*
+Contents of section .plt:
+ 019c fce17e7e 0401307a 08013009 00000000 .*
+ 01ac 00000000 6f0d0c00 00003009 3f7e0000 .*
+ 01bc 00002ffe ecffffff 6f0d1000 00003009 .*
+ 01cc 3f7e0000 00002ffe ecffffff .*
+Contents of section .text:
+ 01d8 6fae1000 00006fae e0ffffff 6fae0c00 .*
+ 01e8 00006fae c0ffffff 0f050f05 .*
+Contents of section .dynamic:
+#...
+Contents of section .got:
+ 228c f4210000 00000000 00000000 00000000 .*
+ 229c 00000000 .*
+Contents of section .data:
+ 22a0 00000000 .*
--- /dev/null
+#source: start1.s
+#source: tls128.s
+#source: tls-ie-8e.s
+#as: --no-underscore --em=criself
+#ld: -m crislinux
+#ld_after_inputfiles: tmpdir/tls-dso-xz-1.so
+#objdump: -s -h -t -T -R -r -p
+
+# Check that we have proper NPTL/TLS markings and GOT for a
+# R_CRIS_32_IE, for an executable, symbol defined elsewhere.
+
+.*: file format elf32-cris
+
+Program Header:
+#...
+ TLS off .*
+ filesz 0x0+80 memsz 0x0+80 flags r--
+
+Dynamic Section:
+ NEEDED tmpdir/tls-dso-xz-1.so
+#...
+private flags = 0:
+#...
+ 8 .got[ ]+0+10 .*
+ CONTENTS, ALLOC, LOAD, DATA
+SYMBOL TABLE:
+#...
+0+ \*UND\* 0+ x
+#...
+DYNAMIC SYMBOL TABLE:
+0+ D \*UND\* 0+ x
+#...
+DYNAMIC RELOCATION RECORDS
+OFFSET TYPE VALUE
+0+822d4 R_CRIS_32_TPREL x
+
+Contents of section .interp:
+#...
+Contents of section \.text:
+ 801bc 41b20000 6faed422 08000000 .*
+Contents of section \.tdata:
+#...
+Contents of section \.got:
+ 822c8 48220800 00000000 00000000 00000000 .*
# Link assembled files using FLAGS, in the order of the "source"
# directives, when using multiple files.
#
+# ld_after_inputfiles: FLAGS
+# Similar to "ld", but put after all input files.
+#
# objcopy_linked_file: FLAGS
# Run objcopy on the linked file with the specified flags.
# This lets you transform the linked file using objcopy, before the
set run_objcopy 0
set opts(as) {}
set opts(ld) {}
+ set opts(ld_after_inputfiles) {}
set opts(xfail) {}
set opts(target) {}
set opts(notarget) {}
# Add -L$srcdir/$subdir so that the linker command can use
# linker scripts in the source directory.
set cmd "$LD $LDFLAGS -L$srcdir/$subdir \
- $opts(ld) -o $objfile $objfiles"
+ $opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)"
send_log "$cmd\n"
set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]