This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Fix IA-32 movl foo@indntpoff, %eax transition
- From: Jakub Jelinek <jakub at redhat dot com>
- To: binutils at sources dot redhat dot com
- Cc: roland at redhat dot com
- Date: Tue, 1 Oct 2002 11:00:00 +0200
- Subject: [PATCH] Fix IA-32 movl foo@indntpoff, %eax transition
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Roland found this. Unfortunately, there was movl foo@indntpoff, %edx
and addl foo@indntpoff, %eax in the testsuite for IE->LE, but not
movl foo@indntpoff, %eax.
Ok to commit?
2002-10-01 Jakub Jelinek <jakub@redhat.com>
bfd/
* elf32-i386.c (elf_i386_relocate_section): Fix
movl foo@indntpoff, %eax IE->LE transition.
ld/testsuite/
* ld-i386/i386.exp: Add tlsindntpoff test.
* ld-i386/tlsindntpoff.s: New test.
* ld-i386/tlsindntpoff.dd: New test.
--- bfd/elf32-i386.c.jj 2002-10-01 10:29:06.000000000 +0200
+++ bfd/elf32-i386.c 2002-10-01 10:30:25.000000000 +0200
@@ -2625,7 +2625,7 @@ elf_i386_relocate_section (output_bfd, i
if (val == 0xa1)
{
/* movl foo, %eax. */
- bfd_put_8 (output_bfd, 0xb8, contents + rel->r_offset - 2);
+ bfd_put_8 (output_bfd, 0xb8, contents + rel->r_offset - 1);
}
else if (type == 0x8b)
{
--- ld/testsuite/ld-i386/i386.exp.jj 2002-10-01 10:29:36.000000000 +0200
+++ ld/testsuite/ld-i386/i386.exp 2002-10-01 10:30:42.000000000 +0200
@@ -55,6 +55,8 @@ set i386tests {
{"TLS in debug sections" "-melf_i386"
"--32" {tlsg.s}
{{objdump -sj.debug_foobar tlsg.sd}} "tlsg"}
+ {"TLS @indntpoff with %eax" "-melf_i386" "--32" {tlsindntpoff.s}
+ {{objdump -drj.text tlsindntpoff.dd}} "tlsindntpoff"}
{"Reloc section order" "-shared -melf_i386" "--32" {reloc.s}
{{objdump -hw reloc.d}} "reloc.so"}
}
--- ld/testsuite/ld-i386/tlsindntpoff.s.jj 2002-10-01 10:30:25.000000000 +0200
+++ ld/testsuite/ld-i386/tlsindntpoff.s 2002-10-01 10:37:13.000000000 +0200
@@ -0,0 +1,19 @@
+ /* Force .got aligned to 4K, so it very likely gets at 0x804a100
+ (0x60 bytes .tdata and 0xa0 bytes .dynamic) */
+ .data
+ .balign 4096
+ .section ".tdata", "awT", @progbits
+ .globl foo
+foo: .long 27
+
+ /* Force .text aligned to 4K, so it very likely gets at 0x8049000. */
+ .text
+ .balign 4096
+ .globl _start
+ .type _start,@function
+_start:
+ cmp %ebx, %eax
+ jae 1f
+ movl foo@indntpoff, %eax
+ movl %gs:(%eax), %eax
+1: ret
--- ld/testsuite/ld-i386/tlsindntpoff.dd.jj 2002-10-01 10:38:03.000000000 +0200
+++ ld/testsuite/ld-i386/tlsindntpoff.dd 2002-10-01 10:40:50.000000000 +0200
@@ -0,0 +1,16 @@
+#source: tlsindntpoff.s
+#as: --32
+#ld: -melf_i386
+#objdump: -drj.text
+#target: i?86-*-*
+
+.*: +file format elf32-i386
+
+Disassembly of section .text:
+
+[0-9a-f]+000 <_start>:
+ [0-9a-f]+000: 39 d8[ ]+cmp %ebx,%eax
+ [0-9a-f]+002: 73 08[ ]+jae [0-9a-f]+00c <_start\+0xc>
+ [0-9a-f]+004: b8 fc ff ff ff[ ]+mov \$0xfffffffc,%eax
+ [0-9a-f]+009: 65 8b 00[ ]+mov %gs:\(%eax\),%eax
+ [0-9a-f]+00c: c3[ ]+ret *