bfd/
authorJakub Jelinek <jakub@redhat.com>
Tue, 1 Oct 2002 10:43:37 +0000 (10:43 +0000)
committerJakub Jelinek <jakub@redhat.com>
Tue, 1 Oct 2002 10:43:37 +0000 (10:43 +0000)
* 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/ChangeLog
bfd/elf32-i386.c
ld/testsuite/ChangeLog
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-i386/tlsindntpoff.dd [new file with mode: 0644]
ld/testsuite/ld-i386/tlsindntpoff.s [new file with mode: 0644]

index a005887256629057e9b24d7ccc89cb33d5038ebb..90d90d258fbcea1fe323111a00719e0b86bffacb 100644 (file)
@@ -1,3 +1,8 @@
+2002-10-01  Jakub Jelinek  <jakub@redhat.com>
+
+       * elf32-i386.c (elf_i386_relocate_section): Fix
+       movl foo@indntpoff, %eax IE->LE transition.
+
 2002-10-01  Jakub Jelinek  <jakub@redhat.com>
 
        * elf64-x86-64.c (elf64_x86_64_relocate_section): Change TLSGD
index 6bd277e6368bea4821a05f1fb58e8e3e156068a5..87e1e76646407ad02ea3f63715917f00d43f5530 100644 (file)
@@ -2625,7 +2625,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
                  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)
                    {
index 1e91d598dd10c69a4cb369c3cb91eb9c38cfd4b3..d9b35f6eed1441b4eb85b8da31ef3674ea54cca6 100644 (file)
@@ -1,3 +1,9 @@
+2002-10-01  Jakub Jelinek  <jakub@redhat.com>
+
+       * ld-i386/i386.exp: Add tlsindntpoff test.
+       * ld-i386/tlsindntpoff.s: New test.
+       * ld-i386/tlsindntpoff.dd: New test.
+
 2002-10-01  Jakub Jelinek  <jakub@redhat.com>
 
        * ld-x86-64/tlspic1.s: Change TLSGD sequences.
index 795efc218dbdafd92d89e92ad32ce40f066fcbad..846847e2b493153431a8515a9c02706840818939 100644 (file)
@@ -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"}
 }
diff --git a/ld/testsuite/ld-i386/tlsindntpoff.dd b/ld/testsuite/ld-i386/tlsindntpoff.dd
new file mode 100644 (file)
index 0000000..db20de1
--- /dev/null
@@ -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 *
diff --git a/ld/testsuite/ld-i386/tlsindntpoff.s b/ld/testsuite/ld-i386/tlsindntpoff.s
new file mode 100644 (file)
index 0000000..4bc93f6
--- /dev/null
@@ -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