From: Jakub Jelinek Date: Thu, 29 Jun 2006 12:34:37 +0000 (+0000) Subject: PR ld/2513 X-Git-Tag: newlib-csl-sourcerygxx-3_4_4-25~196 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ebcfb3c00f9dbe8ff32866d851a50f4d1b18ac56;p=platform%2Fupstream%2Fbinutils.git PR ld/2513 * elf32-i386.c (GOT_TLS_MASK, GOT_TLS_IE_IE, GOT_TLS_IE_GD, GOT_TLS_IE_MASK, elf_i386_check_relocs, allocate_dynrelocs): Revert 2006-04-08 changes. (elf_i386_relocate_section): Likewise. For GD->IE transition change subl into addl whenever tls_type is GOT_TLS_IE_POS. * ld-i386/tlsbin.dd: Fix expected output. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 61d2d40..0367406 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2006-06-29 Jakub Jelinek + + PR ld/2513 + * elf32-i386.c (GOT_TLS_MASK, GOT_TLS_IE_IE, GOT_TLS_IE_GD, + GOT_TLS_IE_MASK, elf_i386_check_relocs, allocate_dynrelocs): Revert + 2006-04-08 changes. + (elf_i386_relocate_section): Likewise. For GD->IE transition + change subl into addl whenever tls_type is GOT_TLS_IE_POS. + 2006-06-23 Alan Modra PR ld/2754 diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 4e9d492..bb2ee15 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -582,10 +582,6 @@ struct elf_i386_link_hash_entry #define GOT_TLS_IE_NEG 6 #define GOT_TLS_IE_BOTH 7 #define GOT_TLS_GDESC 8 -#define GOT_TLS_MASK 0x0f -#define GOT_TLS_IE_IE 0x10 -#define GOT_TLS_IE_GD 0x20 -#define GOT_TLS_IE_MASK 0x30 #define GOT_TLS_GD_BOTH_P(type) \ ((type) == (GOT_TLS_GD | GOT_TLS_GDESC)) #define GOT_TLS_GD_P(type) \ @@ -1014,25 +1010,12 @@ elf_i386_check_relocs (bfd *abfd, case R_386_TLS_IE_32: if (ELF32_R_TYPE (rel->r_info) == r_type) tls_type = GOT_TLS_IE_NEG; - else if (h - && ELF32_R_TYPE (rel->r_info) == R_386_TLS_GD) - /* If this is a GD->IE transition, we may use either - of R_386_TLS_TPOFF and R_386_TLS_TPOFF32. But if - we may have both R_386_TLS_IE and R_386_TLS_GD, - we can't share the same R_386_TLS_TPOFF since - they require different offsets. So we remember - it comes from R_386_TLS_GD. */ - tls_type = GOT_TLS_IE | GOT_TLS_IE_GD; else + /* If this is a GD->IE transition, we may use either of + R_386_TLS_TPOFF and R_386_TLS_TPOFF32. */ tls_type = GOT_TLS_IE; break; case R_386_TLS_IE: - if (h) - { - /* We remember it comes from R_386_TLS_IE. */ - tls_type = GOT_TLS_IE_POS | GOT_TLS_IE_IE; - break; - } case R_386_TLS_GOTIE: tls_type = GOT_TLS_IE_POS; break; } @@ -1072,8 +1055,7 @@ elf_i386_check_relocs (bfd *abfd, tls_type |= old_tls_type; /* If a TLS symbol is accessed using IE at least once, there is no point to use dynamic model for it. */ - else if (old_tls_type != tls_type - && old_tls_type != GOT_UNKNOWN + else if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN && (! GOT_TLS_GD_ANY_P (old_tls_type) || (tls_type & GOT_TLS_IE) == 0)) { @@ -1703,14 +1685,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) asection *s; bfd_boolean dyn; int tls_type = elf_i386_hash_entry(h)->tls_type; - - /* If we have both R_386_TLS_IE and R_386_TLS_GD, GOT_TLS_IE_BOTH - should be used. */ - if ((tls_type & GOT_TLS_IE_MASK) - == (GOT_TLS_IE_IE | GOT_TLS_IE_GD)) - tls_type = GOT_TLS_IE_BOTH; - else - tls_type &= GOT_TLS_MASK; /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ @@ -2714,13 +2688,6 @@ elf_i386_relocate_section (bfd *output_bfd, else if (h != NULL) { tls_type = elf_i386_hash_entry(h)->tls_type; - /* If we have both R_386_TLS_IE and R_386_TLS_GD, - GOT_TLS_IE_BOTH should be used. */ - if ((tls_type & GOT_TLS_IE_MASK) - == (GOT_TLS_IE_IE | GOT_TLS_IE_GD)) - tls_type = GOT_TLS_IE_BOTH; - else - tls_type &= GOT_TLS_MASK; if (!info->shared && h->dynindx == -1 && (tls_type & GOT_TLS_IE)) r_type = R_386_TLS_LE_32; } @@ -3175,12 +3142,8 @@ elf_i386_relocate_section (bfd *output_bfd, subl $foo@gottpoff(%reg), %eax into: addl $foo@gotntpoff(%reg), %eax. */ - if (r_type == R_386_TLS_GOTIE) - { - contents[roff + 6] = 0x03; - if (tls_type == GOT_TLS_IE_BOTH) - off += 4; - } + if (tls_type == GOT_TLS_IE_POS) + contents[roff + 6] = 0x03; bfd_put_32 (output_bfd, htab->sgot->output_section->vma + htab->sgot->output_offset + off diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index f65b95e..3d17ec6 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-06-29 Jakub Jelinek + + PR ld/2513 + * ld-i386/tlsbin.dd: Fix expected output. + 2006-06-21 Alan Modra * ld-elf/tls_common.exp: Match 32-bit output. diff --git a/ld/testsuite/ld-i386/tlsbin.dd b/ld/testsuite/ld-i386/tlsbin.dd index 08a1f31..44af0f6 100644 --- a/ld/testsuite/ld-i386/tlsbin.dd +++ b/ld/testsuite/ld-i386/tlsbin.dd @@ -50,7 +50,7 @@ Disassembly of section .text: # GD -> IE because variable is not defined in executable where # the variable is referenced through @gotntpoff too 8049035: 65 a1 00 00 00 00[ ]+mov %gs:0x0,%eax - 804903b: 2b 83 dc ff ff ff[ ]+sub 0xffffffdc\(%ebx\),%eax + 804903b: 03 83 dc ff ff ff[ ]+add 0xffffffdc\(%ebx\),%eax # ->R_386_TLS_TPOFF sG3 8049041: 90[ ]+nop * 8049042: 90[ ]+nop *