* ld-i386/combreloc.s: New test.
authorJakub Jelinek <jakub@redhat.com>
Thu, 10 Oct 2002 07:49:11 +0000 (07:49 +0000)
committerJakub Jelinek <jakub@redhat.com>
Thu, 10 Oct 2002 07:49:11 +0000 (07:49 +0000)
* ld-i386/combreloc.d: New test.
* ld-i386/i386.exp (i386tests): Add it.

ld/testsuite/ChangeLog
ld/testsuite/ld-i386/combreloc.d [new file with mode: 0644]
ld/testsuite/ld-i386/combreloc.s [new file with mode: 0644]
ld/testsuite/ld-i386/i386.exp

index f55976317e9f5c62b4f0b88de569230894a2b3ea..3a681f687ea67043a755ecc04ae6c7523399234e 100644 (file)
@@ -1,3 +1,9 @@
+2002-10-10  Jakub Jelinek  <jakub@redhat.com>
+
+       * ld-i386/combreloc.s: New test.
+       * ld-i386/combreloc.d: New test.
+       * ld-i386/i386.exp (i386tests): Add it.
+
 2002-10-10  Alan Modra  <amodra@bigpond.net.au>
 
        * ld-i386/i386.exp (reloc): Turn off combreloc.
diff --git a/ld/testsuite/ld-i386/combreloc.d b/ld/testsuite/ld-i386/combreloc.d
new file mode 100644 (file)
index 0000000..762f481
--- /dev/null
@@ -0,0 +1,18 @@
+# Test that orphan reloc sections are merged into .rel.dyn with
+# -z combreloc.
+#source: combreloc.s
+#as: --32
+#ld: -shared -melf_i386 -z combreloc
+#readelf: -r
+#target: i?86-*-*
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 4 entries:
+ Offset     Info    Type            Sym.Value  Sym. Name
+[0-9a-f]+  [0-9a-f]+01 R_386_32          [0-9a-f]+   _start
+[0-9a-f]+  [0-9a-f]+01 R_386_32          [0-9a-f]+   _start
+[0-9a-f]+  [0-9a-f]+01 R_386_32          [0-9a-f]+   _start
+[0-9a-f]+  [0-9a-f]+06 R_386_GLOB_DAT    [0-9a-f]+   _start
+
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset     Info    Type            Sym.Value  Sym. Name
+[0-9a-f]+  [0-9a-f]+07 R_386_JUMP_SLOT   [0-9a-f]+   foo
diff --git a/ld/testsuite/ld-i386/combreloc.s b/ld/testsuite/ld-i386/combreloc.s
new file mode 100644 (file)
index 0000000..2a78a7c
--- /dev/null
@@ -0,0 +1,22 @@
+       .text
+       .globl  _start, foo
+       .type   _start,@function
+_start:
+       pushl   %ebp
+       movl    %esp, %ebp
+        pushl  %ebx
+        call   1f
+1:     popl    %ebx
+       addl    $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
+       movl    _start@GOT(%ebx), %eax
+       movl    (%eax), %eax
+       call    foo@PLT
+       movl    (%esp), %ebx
+       leave
+foo:   ret
+       .data
+       .long   _start
+       .section "__libc_subfreeres", "aw", @progbits
+       .long   _start
+       .section "__libc_atexit", "aw", @progbits
+       .long   _start
index 680ced91c542fd00a744f012ee054473b0a281cb..7f572da729a4ef242b00f214bb8ccebbc059e3f0 100644 (file)
@@ -59,6 +59,8 @@ set i386tests {
      {{objdump -drj.text tlsindntpoff.dd}} "tlsindntpoff"}
     {"Reloc section order" "-shared -melf_i386 -z nocombreloc" "--32"
      {reloc.s} {{objdump -hw reloc.d}} "reloc.so"}
+    {"-z combreloc relocation sections" "-shared -melf_i386 -z combreloc"
+     "--32" {combreloc.s} {{readelf -r combreloc.d}} "combreloc.so"}
 }
 
 run_ld_link_tests $i386tests