This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
ppc64 sym@tocbase testcase
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: binutils at sources dot redhat dot com
- Cc: Alan Modra <amodra at bigpond dot net dot au>
- Date: Wed, 28 Sep 2005 01:46:18 -0300
- Subject: ppc64 sym@tocbase testcase
Alan Modra's patch that introduced symbol@tocbase, at
<URL:http://sources.redhat.com/ml/binutils/2003-06/msg00633.html>, did
not contain a testcase, and it took me a while to figure out how to
trigger the bug, for reasons I'm too embarrassed to describe.
Ok, ok :-), it was because I had saved a copy of the ld-new wrapper
script as ld-broken, instead of the actual ld binary in .libs, but
even then, both used the same libbfd.so. Doh!
Anyhow, I thought I'd contribute the testcase I came up with that
fails without Alan's patch, and works with it. Ok to install?
Index: ld/testsuite/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* symtocbase-1.s, symtocbase-2.s, symtocbase.d: New test.
* powerpc.exp: Run it.
Index: ld/testsuite/ld-powerpc/powerpc.exp
===================================================================
--- ld/testsuite/ld-powerpc/powerpc.exp.orig 2005-09-28 01:15:41.000000000 -0300
+++ ld/testsuite/ld-powerpc/powerpc.exp 2005-09-28 01:26:53.000000000 -0300
@@ -102,6 +102,8 @@
{{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
{objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}}
"tlstoc.so"}
+ {"sym@tocbase" "-shared -melf64ppc" "-a64" {symtocbase-1.s symtocbase-2.s}
+ {{objdump -dj.data symtocbase.d}} "symtocbase.so"}
}
Index: ld/testsuite/ld-powerpc/symtocbase-1.s
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ ld/testsuite/ld-powerpc/symtocbase-1.s 2005-09-28 01:26:53.000000000 -0300
@@ -0,0 +1,18 @@
+.section .toc,"aw",@progbits
+ .align 15
+ .globl x
+x: .quad .x,.x@tocbase,0
+.LCi: .quad i
+ .space 48 * 1024
+.data
+ .globl i
+i: .long 0
+.L1bases:
+ .quad .TOC.@tocbase
+ .quad .x@tocbase
+ .quad .y@tocbase
+.text
+ .globl .x
+.x:
+ ld 9,.LCi@toc(2)
+ blr
Index: ld/testsuite/ld-powerpc/symtocbase-2.s
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ ld/testsuite/ld-powerpc/symtocbase-2.s 2005-09-28 01:26:53.000000000 -0300
@@ -0,0 +1,16 @@
+.section .toc,"aw",@progbits
+ .align 15
+ .globl y
+y: .quad .y,.y@tocbase,0
+.LCi: .quad i
+ .space 48 * 1024
+.data
+.L2bases:
+ .quad .TOC.@tocbase
+ .quad .x@tocbase
+ .quad .y@tocbase
+.text
+ .globl .y
+.y:
+ ld 9,.LCi@toc(2)
+ blr
Index: ld/testsuite/ld-powerpc/symtocbase.d
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ ld/testsuite/ld-powerpc/symtocbase.d 2005-09-28 01:26:53.000000000 -0300
@@ -0,0 +1,24 @@
+#source: symtocbase-1.s
+#source: symtocbase-2.s
+#as: -a64
+#ld: -shared -melf64ppc
+#objdump: -dj.data
+#target: powerpc64*-*-*
+
+.*: file format elf64-powerpc
+
+Disassembly of section \.data:
+
+.* <i>:
+ \.\.\.
+.*: 00 02 00 00 \.long 0x20000
+.*: 00 00 00 00 \.long 0x0
+.*: 00 02 00 00 \.long 0x20000
+.*: 00 00 00 00 \.long 0x0
+.*: 00 03 00 00 \.long 0x30000
+.*: 00 00 00 00 \.long 0x0
+.*: 00 03 00 00 \.long 0x30000
+.*: 00 00 00 00 \.long 0x0
+.*: 00 02 00 00 \.long 0x20000
+.*: 00 00 00 00 \.long 0x0
+.*: 00 03 00 00 \.long 0x30000
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}