1 $DragonFly: src/gnu/usr.bin/binutils215/libbfd/patches/Attic/elf32-i386.c.patch,v 1.1 2006/04/11 12:14:01 joerg Exp $
2 From binutils PR ld/2513.
5 ===================================================================
6 RCS file: /cvs/src/contrib/binutils-2.15/bfd/elf32-i386.c,v
7 retrieving revision 1.1
8 diff -u -r1.1 elf32-i386.c
9 --- elf32-i386.c 18 Dec 2004 20:21:20 -0000 1.1
10 +++ elf32-i386.c 11 Apr 2006 11:37:15 -0000
12 #define GOT_TLS_IE_POS 5
13 #define GOT_TLS_IE_NEG 6
14 #define GOT_TLS_IE_BOTH 7
15 +#define GOT_TLS_MASK 0x0f
16 +#define GOT_TLS_IE_IE 0x10
17 +#define GOT_TLS_IE_GD 0x20
18 +#define GOT_TLS_IE_MASK 0x30
19 unsigned char tls_type;
24 if (ELF32_R_TYPE (rel->r_info) == r_type)
25 tls_type = GOT_TLS_IE_NEG;
27 + && ELF32_R_TYPE (rel->r_info) == R_386_TLS_GD)
28 + /* If this is a GD->IE transition, we may use either
29 + of R_386_TLS_TPOFF and R_386_TLS_TPOFF32. But if
30 + we may have both R_386_TLS_IE and R_386_TLS_GD,
31 + we can't share the same R_386_TLS_TPOFF since
32 + they require different offsets. So we remember
33 + it comes from R_386_TLS_GD. */
34 + tls_type = GOT_TLS_IE | GOT_TLS_IE_GD;
36 - /* If this is a GD->IE transition, we may use either of
37 - R_386_TLS_TPOFF and R_386_TLS_TPOFF32. */
38 tls_type = GOT_TLS_IE;
43 + /* We remember it comes from R_386_TLS_IE. */
44 + tls_type = GOT_TLS_IE_POS | GOT_TLS_IE_IE;
48 tls_type = GOT_TLS_IE_POS; break;
50 @@ -1551,6 +1568,14 @@
53 int tls_type = elf_i386_hash_entry(h)->tls_type;
55 + /* If we have both R_386_TLS_IE and R_386_TLS_GD, GOT_TLS_IE_BOTH
57 + if ((tls_type & GOT_TLS_IE_MASK)
58 + == (GOT_TLS_IE_IE | GOT_TLS_IE_GD))
59 + tls_type = GOT_TLS_IE_BOTH;
61 + tls_type &= GOT_TLS_MASK;
63 /* Make sure this symbol is output as a dynamic symbol.
64 Undefined weak syms won't yet be marked as dynamic. */
65 @@ -2419,6 +2444,13 @@
68 tls_type = elf_i386_hash_entry(h)->tls_type;
69 + /* If we have both R_386_TLS_IE and R_386_TLS_GD,
70 + GOT_TLS_IE_BOTH should be used. */
71 + if ((tls_type & GOT_TLS_IE_MASK)
72 + == (GOT_TLS_IE_IE | GOT_TLS_IE_GD))
73 + tls_type = GOT_TLS_IE_BOTH;
75 + tls_type &= GOT_TLS_MASK;
76 if (!info->shared && h->dynindx == -1 && (tls_type & GOT_TLS_IE))
77 r_type = R_386_TLS_LE_32;