aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-07-18 10:58:01 +0930
committerAlan Modra <amodra@gmail.com>2019-07-18 22:17:30 +0930
commitb00a0a86c40c681cf4b22a3630f85188ac849721 (patch)
tree8c92d1b0358e489088a266c5e5bf9f55d4877d66 /bfd
parent0b1474281c659919d9c63ccfd6891b9e9ed0fc9c (diff)
downloadgdb-b00a0a86c40c681cf4b22a3630f85188ac849721.zip
gdb-b00a0a86c40c681cf4b22a3630f85188ac849721.tar.gz
gdb-b00a0a86c40c681cf4b22a3630f85188ac849721.tar.bz2
[PowerPC] Rename TLS_TPRELGD to TLS_GDIE
Choose a better name, that reflects why the flag is set (GD to IE optimisation) rather than what the flag produces (TPREL64 reloc on a single GOT entry replacing a tls_index pair). * elf32-ppc.c (TLS_GDIE): Rename from TLS_TPRELGD throughout file. Correct comment. * elf64-ppc.c (TLS_GDIE): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-ppc.c22
-rw-r--r--bfd/elf64-ppc.c24
3 files changed, 27 insertions, 25 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index bbef105..b913d18 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2019-07-18 Alan Modra <amodra@gmail.com>
+ * elf32-ppc.c (TLS_GDIE): Rename from TLS_TPRELGD throughout file.
+ Correct comment.
+ * elf64-ppc.c (TLS_GDIE): Likewise.
+
+2019-07-18 Alan Modra <amodra@gmail.com>
+
* elf64-ppc.c (ppc64_elf_tls_optimize): Correct test for allowed
range of tp-relative offsets.
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 33ab4e0..8dfeca3 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2111,9 +2111,7 @@ struct ppc_elf_link_hash_entry
of the other TLS bits are set. tls_optimize clears bits when
optimizing to indicate the corresponding GOT entry type is not
needed. If set, TLS_TLS is never cleared. tls_optimize may also
- set TLS_TPRELGD when a GD reloc turns into a TPREL one. We use a
- separate flag rather than setting TPREL just for convenience in
- distinguishing the two cases.
+ set TLS_GDIE when a GD reloc turns into an IE one.
These flags are also kept for local symbols. */
#define TLS_TLS 1 /* Any TLS reloc. */
#define TLS_GD 2 /* GD reloc. */
@@ -2121,7 +2119,7 @@ struct ppc_elf_link_hash_entry
#define TLS_TPREL 8 /* TPREL reloc, => IE. */
#define TLS_DTPREL 16 /* DTPREL reloc, => LD. */
#define TLS_MARK 32 /* __tls_get_addr call marked. */
-#define TLS_TPRELGD 64 /* TPREL reloc resulting from GD->IE. */
+#define TLS_GDIE 64 /* GOT TPREL reloc resulting from GD->IE. */
unsigned char tls_mask;
/* The above field is also used to mark function symbols. In which
@@ -4525,7 +4523,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
tls_set = 0;
else
/* GD -> IE */
- tls_set = TLS_TLS | TLS_TPRELGD;
+ tls_set = TLS_TLS | TLS_GDIE;
tls_clear = TLS_GD;
break;
@@ -5051,7 +5049,7 @@ got_entries_needed (int tls_mask)
need = 0;
if ((tls_mask & TLS_GD) != 0)
need += 8;
- if ((tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0)
+ if ((tls_mask & (TLS_TPREL | TLS_GDIE)) != 0)
need += 4;
if ((tls_mask & TLS_DTPREL) != 0)
need += 4;
@@ -5072,7 +5070,7 @@ got_relocs_needed (int tls_mask, unsigned int need, bfd_boolean known)
condition as that for IE, but ld.so needs to differentiate
LD and GD entries. */
if (known && (tls_mask & TLS_TLS) != 0
- && (tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0)
+ && (tls_mask & (TLS_TPREL | TLS_GDIE)) != 0)
need -= 4;
return need * sizeof (Elf32_External_Rela) / 4;
}
@@ -7213,7 +7211,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
case R_PPC_GOT_TLSGD16_HI:
case R_PPC_GOT_TLSGD16_HA:
- tls_gd = TLS_TPRELGD;
+ tls_gd = TLS_GDIE;
if ((tls_mask & TLS_TLS) != 0 && (tls_mask & TLS_GD) == 0)
goto tls_gdld_hi;
break;
@@ -7238,7 +7236,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
case R_PPC_GOT_TLSGD16:
case R_PPC_GOT_TLSGD16_LO:
- tls_gd = TLS_TPRELGD;
+ tls_gd = TLS_GDIE;
if ((tls_mask & TLS_TLS) != 0 && (tls_mask & TLS_GD) == 0)
goto tls_ldgd_opt;
break;
@@ -7340,7 +7338,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
break;
}
- if ((tls_mask & TLS_TPRELGD) != 0)
+ if ((tls_mask & TLS_GDIE) != 0)
{
/* IE */
r_type = R_PPC_NONE;
@@ -7798,7 +7796,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
{
unsigned int tls_m = ((tls_mask & TLS_TLS) != 0
? tls_mask & (TLS_LD | TLS_GD | TLS_DTPREL
- | TLS_TPREL | TLS_TPRELGD)
+ | TLS_TPREL | TLS_GDIE)
: 0);
if (offp == &htab->tlsld_got.offset)
@@ -7828,7 +7826,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
tls_ty = TLS_TLS | TLS_DTPREL;
tls_m &= ~TLS_DTPREL;
}
- else if ((tls_m & (TLS_TPREL | TLS_TPRELGD)) != 0)
+ else if ((tls_m & (TLS_TPREL | TLS_GDIE)) != 0)
{
tls_ty = TLS_TLS | TLS_TPREL;
tls_m = 0;
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 9d3ba36..9c32c69 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -3039,9 +3039,7 @@ struct ppc_link_hash_entry
of the other TLS bits are set. tls_optimize clears bits when
optimizing to indicate the corresponding GOT entry type is not
needed. If set, TLS_TLS is never cleared. tls_optimize may also
- set TLS_TPRELGD when a GD reloc turns into a TPREL one. We use a
- separate flag rather than setting TPREL just for convenience in
- distinguishing the two cases.
+ set TLS_GDIE when a GD reloc turns into an IE one.
These flags are also kept for local symbols. */
#define TLS_TLS 1 /* Any TLS reloc. */
#define TLS_GD 2 /* GD reloc. */
@@ -3049,7 +3047,7 @@ struct ppc_link_hash_entry
#define TLS_TPREL 8 /* TPREL reloc, => IE. */
#define TLS_DTPREL 16 /* DTPREL reloc, => LD. */
#define TLS_MARK 32 /* __tls_get_addr call marked. */
-#define TLS_TPRELGD 64 /* TPREL reloc resulting from GD->IE. */
+#define TLS_GDIE 64 /* GOT TPREL reloc resulting from GD->IE. */
#define TLS_EXPLICIT 128 /* Marks TOC section TLS relocs. */
unsigned char tls_mask;
@@ -7797,7 +7795,7 @@ ppc64_elf_tls_optimize (struct bfd_link_info *info)
tls_set = 0;
else
/* GD -> IE */
- tls_set = TLS_TLS | TLS_TPRELGD;
+ tls_set = TLS_TLS | TLS_GDIE;
tls_clear = TLS_GD;
tls_type = TLS_TLS | TLS_GD;
break;
@@ -7924,7 +7922,7 @@ ppc64_elf_tls_optimize (struct bfd_link_info *info)
tls_set = TLS_EXPLICIT | TLS_GD;
else
/* GD -> IE */
- tls_set = TLS_EXPLICIT | TLS_GD | TLS_TPRELGD;
+ tls_set = TLS_EXPLICIT | TLS_GD | TLS_GDIE;
tls_clear = TLS_GD;
}
else
@@ -9239,7 +9237,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
eh = (struct ppc_link_hash_entry *) h;
/* Run through the TLS GD got entries first if we're changing them
to TPREL. */
- if ((eh->tls_mask & (TLS_TLS | TLS_TPRELGD)) == (TLS_TLS | TLS_TPRELGD))
+ if ((eh->tls_mask & (TLS_TLS | TLS_GDIE)) == (TLS_TLS | TLS_GDIE))
for (gent = h->got.glist; gent != NULL; gent = gent->next)
if (gent->got.refcount > 0
&& (gent->tls_type & TLS_GD) != 0)
@@ -14387,7 +14385,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
doing a GD->IE transition. */
if (retval == 2)
{
- tls_gd = TLS_TPRELGD;
+ tls_gd = TLS_GDIE;
if ((tls_mask & TLS_TLS) != 0
&& (tls_mask & TLS_GD) == 0)
goto tls_ldgd_opt;
@@ -14469,7 +14467,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
case R_PPC64_GOT_TLSGD16_HI:
case R_PPC64_GOT_TLSGD16_HA:
- tls_gd = TLS_TPRELGD;
+ tls_gd = TLS_GDIE;
if ((tls_mask & TLS_TLS) != 0 && (tls_mask & TLS_GD) == 0)
goto tls_gdld_hi;
break;
@@ -14494,7 +14492,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
case R_PPC64_GOT_TLSGD16:
case R_PPC64_GOT_TLSGD16_LO:
- tls_gd = TLS_TPRELGD;
+ tls_gd = TLS_GDIE;
if ((tls_mask & TLS_TLS) != 0 && (tls_mask & TLS_GD) == 0)
goto tls_ldgd_opt;
break;
@@ -14621,7 +14619,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
if (ELF64_R_TYPE (rel[1].r_info) == R_PPC64_PLTCALL)
bfd_put_32 (output_bfd, NOP, contents + offset + 4);
- if ((tls_mask & TLS_TPRELGD) != 0)
+ if ((tls_mask & TLS_GDIE) != 0)
{
/* IE */
r_type = R_PPC64_NONE;
@@ -14644,7 +14642,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
BFD_ASSERT (offset == rel[1].r_offset);
rel[1].r_info = ELF64_R_INFO (STN_UNDEF, R_PPC64_NONE);
bfd_put_32 (input_bfd, insn2, contents + offset);
- if ((tls_mask & TLS_TPRELGD) == 0 && toc_symndx != 0)
+ if ((tls_mask & TLS_GDIE) == 0 && toc_symndx != 0)
goto again;
}
break;
@@ -14705,7 +14703,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
if ((tls_mask & TLS_GD) == 0)
{
rel[1].r_info = ELF64_R_INFO (r_symndx, R_PPC64_NONE);
- if ((tls_mask & TLS_TPRELGD) != 0)
+ if ((tls_mask & TLS_GDIE) != 0)
r_type = R_PPC64_TPREL64;
else
{