summaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-11-28 14:15:55 +0000
committerJakub Jelinek <jakub@redhat.com>2002-11-28 14:15:55 +0000
commit3bb102083b6bd60e45f7eef49a7cce1342872e5b (patch)
tree34b03e9642c114d1a1605f96daddfd8d9def37aa /gas
parent2bff0f1b92c51b6fa92656bab7834660ea417a5b (diff)
downloadbinutils-redhat-3bb102083b6bd60e45f7eef49a7cce1342872e5b.tar.gz
* symbols.c (S_SET_THREAD_LOCAL): New function.
* symbols.h (S_SET_THREAD_LOCAL): New prototype. * config/tc-i386.c (md_apply_fix3): Call S_SET_THREAD_LOCAL for TLS relocations. * config/tc-ia64.c (md_apply_fix3): Likewise. * config/tc-alpha.c (md_apply_fix3): Likewise. * ld-i386/tlsnopic.rd: Change NOTYPE to TLS for UND sg* symbols.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog9
-rw-r--r--gas/config/tc-alpha.c4
-rw-r--r--gas/config/tc-i386.c14
-rw-r--r--gas/config/tc-ia64.c15
-rw-r--r--gas/symbols.c19
-rw-r--r--gas/symbols.h1
6 files changed, 59 insertions, 3 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 588c39d7ba..81b352c28d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,14 @@
2002-11-28 Jakub Jelinek <jakub@redhat.com>
+ * symbols.c (S_SET_THREAD_LOCAL): New function.
+ * symbols.h (S_SET_THREAD_LOCAL): New prototype.
+ * config/tc-i386.c (md_apply_fix3): Call S_SET_THREAD_LOCAL
+ for TLS relocations.
+ * config/tc-ia64.c (md_apply_fix3): Likewise.
+ * config/tc-alpha.c (md_apply_fix3): Likewise.
+
+2002-11-28 Jakub Jelinek <jakub@redhat.com>
+
* write.c (subsegs_finish): For SEC_MERGE sections pad last fragment
to entsize.
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index c54594b6e6..e546dcf585 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -1261,6 +1261,8 @@ md_apply_fix3 (fixP, valP, seg)
#ifdef OBJ_ELF
case BFD_RELOC_ALPHA_BRSGP:
+ return;
+
case BFD_RELOC_ALPHA_TLSGD:
case BFD_RELOC_ALPHA_TLSLDM:
case BFD_RELOC_ALPHA_GOTDTPREL16:
@@ -1271,6 +1273,8 @@ md_apply_fix3 (fixP, valP, seg)
case BFD_RELOC_ALPHA_TPREL_HI16:
case BFD_RELOC_ALPHA_TPREL_LO16:
case BFD_RELOC_ALPHA_TPREL16:
+ if (fixP->fx_addsy)
+ S_SET_THREAD_LOCAL (fixP->fx_addsy);
return;
#endif
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index c7af77c778..b17d39f8b8 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4679,17 +4679,27 @@ md_apply_fix3 (fixP, valP, seg)
value = -4;
break;
- case BFD_RELOC_386_GOT32:
case BFD_RELOC_386_TLS_GD:
case BFD_RELOC_386_TLS_LDM:
case BFD_RELOC_386_TLS_IE_32:
case BFD_RELOC_386_TLS_IE:
case BFD_RELOC_386_TLS_GOTIE:
- case BFD_RELOC_X86_64_GOT32:
case BFD_RELOC_X86_64_TLSGD:
case BFD_RELOC_X86_64_TLSLD:
case BFD_RELOC_X86_64_GOTTPOFF:
value = 0; /* Fully resolved at runtime. No addend. */
+ /* Fallthrough */
+ case BFD_RELOC_386_TLS_LE:
+ case BFD_RELOC_386_TLS_LDO_32:
+ case BFD_RELOC_386_TLS_LE_32:
+ case BFD_RELOC_X86_64_DTPOFF32:
+ case BFD_RELOC_X86_64_TPOFF32:
+ S_SET_THREAD_LOCAL (fixP->fx_addsy);
+ break;
+
+ case BFD_RELOC_386_GOT32:
+ case BFD_RELOC_X86_64_GOT32:
+ value = 0; /* Fully resolved at runtime. No addend. */
break;
case BFD_RELOC_VTABLE_INHERIT:
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index cac7d0a493..1c3fba0e2c 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -10413,8 +10413,9 @@ md_apply_fix3 (fix, valP, seg)
}
if (fix->fx_addsy)
{
- if (fix->fx_r_type == (int) BFD_RELOC_UNUSED)
+ switch (fix->fx_r_type)
{
+ case BFD_RELOC_UNUSED:
/* This must be a TAG13 or TAG13b operand. There are no external
relocs defined for them, so we must give an error. */
as_bad_where (fix->fx_file, fix->fx_line,
@@ -10422,6 +10423,18 @@ md_apply_fix3 (fix, valP, seg)
elf64_ia64_operands[fix->tc_fix_data.opnd].desc);
fix->fx_done = 1;
return;
+
+ case BFD_RELOC_IA64_TPREL14:
+ case BFD_RELOC_IA64_TPREL22:
+ case BFD_RELOC_IA64_TPREL64I:
+ case BFD_RELOC_IA64_LTOFF_TPREL22:
+ case BFD_RELOC_IA64_LTOFF_DTPMOD22:
+ case BFD_RELOC_IA64_DTPREL14:
+ case BFD_RELOC_IA64_DTPREL22:
+ case BFD_RELOC_IA64_DTPREL64I:
+ case BFD_RELOC_IA64_LTOFF_DTPREL22:
+ S_SET_THREAD_LOCAL (fix->fx_addsy);
+ break;
}
/* ??? This is a hack copied from tc-i386.c to make PCREL relocs
diff --git a/gas/symbols.c b/gas/symbols.c
index feed359204..ccad71b2cd 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -1951,6 +1951,25 @@ S_SET_WEAK (s)
}
void
+S_SET_THREAD_LOCAL (s)
+ symbolS *s;
+{
+ if (LOCAL_SYMBOL_CHECK (s))
+ s = local_symbol_convert ((struct local_symbol *) s);
+ if (bfd_is_com_section (s->bsym->section)
+ && (s->bsym->flags & BSF_THREAD_LOCAL) != 0)
+ return;
+ s->bsym->flags |= BSF_THREAD_LOCAL;
+ if ((s->bsym->flags & BSF_FUNCTION) != 0)
+ as_bad (_("Accessing function `%s' as thread-local object"),
+ S_GET_NAME (s));
+ else if (! bfd_is_und_section (s->bsym->section)
+ && (s->bsym->section->flags & SEC_THREAD_LOCAL) == 0)
+ as_bad (_("Accessing `%s' as thread-local object"),
+ S_GET_NAME (s));
+}
+
+void
S_SET_NAME (s, name)
symbolS *s;
char *name;
diff --git a/gas/symbols.h b/gas/symbols.h
index 3c63d1b0fd..914a9308f2 100644
--- a/gas/symbols.h
+++ b/gas/symbols.h
@@ -102,6 +102,7 @@ extern void S_SET_EXTERNAL PARAMS ((symbolS *));
extern void S_SET_NAME PARAMS ((symbolS *, char *));
extern void S_CLEAR_EXTERNAL PARAMS ((symbolS *));
extern void S_SET_WEAK PARAMS ((symbolS *));
+extern void S_SET_THREAD_LOCAL PARAMS ((symbolS *));
#endif
#ifndef WORKING_DOT_WORD