M68K TLS support.

ld/testsuite/
        * ld-m68k/got-multigot-12-13-14-34-35-ok.d: Update.
        * ld-m68k/got-multigot-14-ok.d: Update.
        * ld-m68k/m68k-got.exp: Update.
        * ld-m68k/got-negative-12-13-14-34-ok.d: Update.
        * ld-m68k/got-negative-14-ok.d: Update.
        * ld-m68k/tls-gd-1.d, ld-m68k/tls-gd-2.d: New tests.
        * ld-m68k/tls-gd-ie-1.d, ld-m68k/tls-ie-1.d: New tests.
        * ld-m68k/tls-ld-1.d, ld-m68k/tls-ld-2.d: New tests.
        * ld-m68k/tls-ld-1.s, ld-m68k/tls-ld-2.s, ld-m68k/tls-le-1.s:
        New test sources.
        * ld-m68k/tls-no-1.s, ld-m68k/tls-gd-ie-1.s, ld-m68k/tls-gd-1.s:
        New test sources.
        * ld-m68k/tls-gd-2.s, ld-m68k/tls-ie-1.s: New test sources.
        * ld-m68k/m68k.exp: Run new tests.
        (merge isa-a isa-a:nodiv): Fix.

        gas/testsuite/
        * gas/m68k/tls-gd-3.d, gas/m68k/tls-gd-3.s: New test.
        * gas/m68k/all.exp: Run it.

        gas/
        * config/m68k-parse.h (enum pic_relocation): Add values for TLS
        relocations.
        * config/m68k-parse.y (yylex): Parse TLS relocations.
        * config/tc-m68k.c (m68k_elf_cons): New static function.
        (md_pseudo_table): Use it.
        (get_reloc_code, tc_m68k_fix_adjustable, tc_gen_reloc): Handle TLS
        relocations.
        (md_apply_fix): Fix to set thread local flag.
        (m68k_elf_suffix): New static function; helper for m68k_elf_cons.

        include/elf/
        * m68k.h: Map TLS relocations to numbers.

        bfd/
        * bfd-in2.h: Regenerate.
        * elf32-m68k.c: Handle 2-slot GOT entries.  Rename variables and
        fields from n_entries to n_slots where appropriate, update comments.
        (HOWTO): Add TLS relocations.
        (reloc_map): Map BFD_RELOC_68K_TLS_* to R_68K_TLS_*.
        (enum elf_m68k_got_offset_size): New enum.
        (struct elf_m68k_got_entry.type): Move field to ...
        (struct elf_m68k_got_entry_key): ... here.  Update all uses.
        (elf_m68k_reloc_got_type, elf_m68k_reloc_got_offset_size): New static
        functions.
        (elf_m68k_reloc_got_n_entries, elf_m68k_reloc_tls_p): New static
        functions.
        (struct elf_m68k_got): merge rel_8o_n_entries and rel_8o_16o_n_entries
        fields into n_entries array.  Update comments.
        (elf_m68k_init_got): Simplify, update all uses.
        (elf_m68k_init_got_entry_key): Handle R_68K_TLS_LDM32 reloc, update.
        (ELF_M68K_REL_8O_MAX_N_ENTRIES_IN_GOT): Adjust to handle 2-slot
        GOT entries; update name, update all uses.
        (ELF_M68K_REL_8O_16O_MAX_N_ENTRIES_IN_GOT): Ditto.
        (elf_m68k_get_got_entry): Update.
        (elf_m68k_update_got_entry_type): Rewrite to handle TLS GOT entries,
        simplify.
        (elf_m68k_remove_got_entry_type): Simplify.
        (elf_m68k_add_entry_to_got, elf_m68k_can_merge_gots_1): Update.
        (elf_m68k_can_merge_gots): Update.
        (elf_m68k_merge_gots_1, elf_m68k_merge_gots): Update.
        (struct elf_m68k_finalize_got_offsets_arg): Rewrite to handle 2-slot
        GOT entries, simplify.
        (elf_m68k_finalize_got_offsets_1, elf_m68k_finalize_got_offsets): Same.
        (struct elf_m68k_partition_multi_got_arg): Add slots_relas_diff
        field, remove obsoleted local_n_entries field.
        (elf_m68k_partition_multi_got_2): New static function.
        (elf_m68k_partition_multi_got_1, elf_m68k_partition_multi_got): Use it;
        update.
        (elf_m68k_remove_got_entry_type): Update.
        (elf_m68k_install_rela, dtpoff_base, tpoff): New static functions.
        (elf_m68k_check_relocs): Handle TLS relocations.  Remove unnecessary
        update of sgot->size and srelgot->size.
        (elf_m68k_gc_sweep_hook): Update.
        (elf_m68k_install_rela, dtpoff_base, tpoff): New static functions.
        (elf_m68k_relocate_section, elf_m68k_finish_dynamic_symbol): Handle
        TLS relocations.
        * reloc.c (BFD_RELOC_68K_TLS_*): Declare TLS relocations.
        * libbfd.h (bfd_reloc_code_real_names): Add BFD_RELOC_68K_TLS_*.
This commit is contained in:
Nick Clifton 2009-02-03 14:36:47 +00:00
parent bb0a86e1a7
commit cf869cce62
20 changed files with 1565 additions and 459 deletions

View File

@ -1,3 +1,50 @@
2009-02-03 Maxim Kuvyrkov <maxim@codesourcery.com>
* bfd-in2.h: Regenerate.
* elf32-m68k.c: Handle 2-slot GOT entries. Rename variables and
fields from n_entries to n_slots where appropriate, update comments.
(HOWTO): Add TLS relocations.
(reloc_map): Map BFD_RELOC_68K_TLS_* to R_68K_TLS_*.
(enum elf_m68k_got_offset_size): New enum.
(struct elf_m68k_got_entry.type): Move field to ...
(struct elf_m68k_got_entry_key): ... here. Update all uses.
(elf_m68k_reloc_got_type, elf_m68k_reloc_got_offset_size): New static
functions.
(elf_m68k_reloc_got_n_entries, elf_m68k_reloc_tls_p): New static
functions.
(struct elf_m68k_got): merge rel_8o_n_entries and rel_8o_16o_n_entries
fields into n_entries array. Update comments.
(elf_m68k_init_got): Simplify, update all uses.
(elf_m68k_init_got_entry_key): Handle R_68K_TLS_LDM32 reloc, update.
(ELF_M68K_REL_8O_MAX_N_ENTRIES_IN_GOT): Adjust to handle 2-slot
GOT entries; update name, update all uses.
(ELF_M68K_REL_8O_16O_MAX_N_ENTRIES_IN_GOT): Ditto.
(elf_m68k_get_got_entry): Update.
(elf_m68k_update_got_entry_type): Rewrite to handle TLS GOT entries,
simplify.
(elf_m68k_remove_got_entry_type): Simplify.
(elf_m68k_add_entry_to_got, elf_m68k_can_merge_gots_1): Update.
(elf_m68k_can_merge_gots): Update.
(elf_m68k_merge_gots_1, elf_m68k_merge_gots): Update.
(struct elf_m68k_finalize_got_offsets_arg): Rewrite to handle 2-slot
GOT entries, simplify.
(elf_m68k_finalize_got_offsets_1, elf_m68k_finalize_got_offsets): Same.
(struct elf_m68k_partition_multi_got_arg): Add slots_relas_diff
field, remove obsoleted local_n_entries field.
(elf_m68k_partition_multi_got_2): New static function.
(elf_m68k_partition_multi_got_1, elf_m68k_partition_multi_got): Use it;
update.
(elf_m68k_remove_got_entry_type): Update.
(elf_m68k_install_rela, dtpoff_base, tpoff): New static functions.
(elf_m68k_check_relocs): Handle TLS relocations. Remove unnecessary
update of sgot->size and srelgot->size.
(elf_m68k_gc_sweep_hook): Update.
(elf_m68k_install_rela, dtpoff_base, tpoff): New static functions.
(elf_m68k_relocate_section, elf_m68k_finish_dynamic_symbol): Handle
TLS relocations.
* reloc.c (BFD_RELOC_68K_TLS_*): Declare TLS relocations.
* libbfd.h (bfd_reloc_code_real_names): Add BFD_RELOC_68K_TLS_*.
2009-02-02 DJ Delorie <dj@redhat.com>
* elf32-mep.c (config_names): Regenerate configuration.

View File

@ -2363,6 +2363,21 @@ The 24-bit relocation is used in some Intel 960 configurations. */
BFD_RELOC_68K_GLOB_DAT,
BFD_RELOC_68K_JMP_SLOT,
BFD_RELOC_68K_RELATIVE,
BFD_RELOC_68K_TLS_GD32,
BFD_RELOC_68K_TLS_GD16,
BFD_RELOC_68K_TLS_GD8,
BFD_RELOC_68K_TLS_LDM32,
BFD_RELOC_68K_TLS_LDM16,
BFD_RELOC_68K_TLS_LDM8,
BFD_RELOC_68K_TLS_LDO32,
BFD_RELOC_68K_TLS_LDO16,
BFD_RELOC_68K_TLS_LDO8,
BFD_RELOC_68K_TLS_IE32,
BFD_RELOC_68K_TLS_IE16,
BFD_RELOC_68K_TLS_IE8,
BFD_RELOC_68K_TLS_LE32,
BFD_RELOC_68K_TLS_LE16,
BFD_RELOC_68K_TLS_LE8,
/* Linkage-table relative. */
BFD_RELOC_32_BASEREL,

File diff suppressed because it is too large Load Diff

View File

@ -829,6 +829,21 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_68K_GLOB_DAT",
"BFD_RELOC_68K_JMP_SLOT",
"BFD_RELOC_68K_RELATIVE",
"BFD_RELOC_68K_TLS_GD32",
"BFD_RELOC_68K_TLS_GD16",
"BFD_RELOC_68K_TLS_GD8",
"BFD_RELOC_68K_TLS_LDM32",
"BFD_RELOC_68K_TLS_LDM16",
"BFD_RELOC_68K_TLS_LDM8",
"BFD_RELOC_68K_TLS_LDO32",
"BFD_RELOC_68K_TLS_LDO16",
"BFD_RELOC_68K_TLS_LDO8",
"BFD_RELOC_68K_TLS_IE32",
"BFD_RELOC_68K_TLS_IE16",
"BFD_RELOC_68K_TLS_IE8",
"BFD_RELOC_68K_TLS_LE32",
"BFD_RELOC_68K_TLS_LE16",
"BFD_RELOC_68K_TLS_LE8",
"BFD_RELOC_32_BASEREL",
"BFD_RELOC_16_BASEREL",
"BFD_RELOC_LO16_BASEREL",

View File

@ -1734,6 +1734,36 @@ ENUMX
BFD_RELOC_68K_JMP_SLOT
ENUMX
BFD_RELOC_68K_RELATIVE
ENUMX
BFD_RELOC_68K_TLS_GD32
ENUMX
BFD_RELOC_68K_TLS_GD16
ENUMX
BFD_RELOC_68K_TLS_GD8
ENUMX
BFD_RELOC_68K_TLS_LDM32
ENUMX
BFD_RELOC_68K_TLS_LDM16
ENUMX
BFD_RELOC_68K_TLS_LDM8
ENUMX
BFD_RELOC_68K_TLS_LDO32
ENUMX
BFD_RELOC_68K_TLS_LDO16
ENUMX
BFD_RELOC_68K_TLS_LDO8
ENUMX
BFD_RELOC_68K_TLS_IE32
ENUMX
BFD_RELOC_68K_TLS_IE16
ENUMX
BFD_RELOC_68K_TLS_IE8
ENUMX
BFD_RELOC_68K_TLS_LE32
ENUMX
BFD_RELOC_68K_TLS_LE16
ENUMX
BFD_RELOC_68K_TLS_LE8
ENUMDOC
Relocations used by 68K ELF.

View File

@ -1,3 +1,15 @@
2009-02-03 Maxim Kuvyrkov <maxim@codesourcery.com>
* config/m68k-parse.h (enum pic_relocation): Add values for TLS
relocations.
* config/m68k-parse.y (yylex): Parse TLS relocations.
* config/tc-m68k.c (m68k_elf_cons): New static function.
(md_pseudo_table): Use it.
(get_reloc_code, tc_m68k_fix_adjustable, tc_gen_reloc): Handle TLS
relocations.
(md_apply_fix): Fix to set thread local flag.
(m68k_elf_suffix): New static function; helper for m68k_elf_cons.
2009-02-03 Vince Weaver <vince@csl.cornell.edu>
PR 9779

View File

@ -270,7 +270,12 @@ enum pic_relocation
pic_plt_pcrel, /* @PLTPC */
pic_got_pcrel, /* @GOTPC */
pic_plt_off, /* @PLT */
pic_got_off /* @GOT */
pic_got_off, /* @GOT */
pic_tls_gd, /* @TLSGD */
pic_tls_ldm, /* @TLSLDM */
pic_tls_ldo, /* @TLSLDO */
pic_tls_ie, /* @TLSIE */
pic_tls_le /* @TLSLE */
};
#endif

View File

@ -1010,7 +1010,20 @@ yylex ()
yylval.exp.pic_reloc = pic_none;
cp = s - tail;
if (cp - 6 > str && cp[-6] == '@')
if (cp - 7 > str && cp[-7] == '@')
{
if (strncmp (cp - 7, "@TLSLDM", 7) == 0)
{
yylval.exp.pic_reloc = pic_tls_ldm;
tail += 7;
}
else if (strncmp (cp - 7, "@TLSLDO", 7) == 0)
{
yylval.exp.pic_reloc = pic_tls_ldo;
tail += 7;
}
}
else if (cp - 6 > str && cp[-6] == '@')
{
if (strncmp (cp - 6, "@PLTPC", 6) == 0)
{
@ -1022,6 +1035,21 @@ yylex ()
yylval.exp.pic_reloc = pic_got_pcrel;
tail += 6;
}
else if (strncmp (cp - 6, "@TLSGD", 6) == 0)
{
yylval.exp.pic_reloc = pic_tls_gd;
tail += 6;
}
else if (strncmp (cp - 6, "@TLSIE", 6) == 0)
{
yylval.exp.pic_reloc = pic_tls_ie;
tail += 6;
}
else if (strncmp (cp - 6, "@TLSLE", 6) == 0)
{
yylval.exp.pic_reloc = pic_tls_le;
tail += 6;
}
}
else if (cp - 4 > str && cp[-4] == '@')
{

View File

@ -1,6 +1,6 @@
/* tc-m68k.c -- Assemble for the m68k family
Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@ -38,6 +38,10 @@
#include "obj-coff.h"
#endif
#ifdef OBJ_ELF
static void m68k_elf_cons (int);
#endif
/* This string holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful. The macro
tc_comment_chars points to this. We use this, rather than the
@ -528,14 +532,14 @@ static const struct m68k_cpu m68k_extensions[] =
{m68851, NULL, "68851", -1},
{m68881, NULL, "68881", -1},
{m68881, NULL, "68882", -1},
{cfloat|m68881, NULL, "float", 0},
{mcfhwdiv, NULL, "div", 1},
{mcfusp, NULL, "usp", 1},
{mcfmac, NULL, "mac", 1},
{mcfemac, NULL, "emac", 1},
{0,NULL,NULL, 0}
};
@ -562,7 +566,7 @@ static const struct m68k_cpu m68k_cpus[] =
{m68040, m68040_ctrl, "68ec040", 1},
{m68060, m68060_ctrl, "68060", 0},
{m68060, m68060_ctrl, "68ec060", 1},
{cpu32|m68881, cpu32_ctrl, "cpu32", 0},
{cpu32|m68881, cpu32_ctrl, "68330", 1},
{cpu32|m68881, cpu32_ctrl, "68331", 1},
@ -576,24 +580,24 @@ static const struct m68k_cpu m68k_cpus[] =
{cpu32|m68881, cpu32_ctrl, "68360", 1},
{mcfisa_a|mcfisa_c|mcfusp, mcf51qe_ctrl, "51qe", 0},
{mcfisa_a, mcf_ctrl, "5200", 0},
{mcfisa_a, mcf_ctrl, "5202", 1},
{mcfisa_a, mcf_ctrl, "5204", 1},
{mcfisa_a, mcf5206_ctrl, "5206", 1},
{mcfisa_a|mcfhwdiv|mcfmac, mcf5206_ctrl, "5206e", 0},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, mcf5208_ctrl, "5207", -1},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, mcf5208_ctrl, "5208", 0},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp, mcf5210a_ctrl, "5210a", 0},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp, mcf5210a_ctrl, "5211a", 1},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp, mcf5213_ctrl, "5211", -1},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp, mcf5213_ctrl, "5212", -1},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp, mcf5213_ctrl, "5213", 0},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, mcf5216_ctrl, "5214", -1},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, mcf5216_ctrl, "5216", 0},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, mcf5216_ctrl, "521x", 2},
@ -605,10 +609,10 @@ static const struct m68k_cpu m68k_cpus[] =
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, mcf52235_ctrl, "52233", -1},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, mcf52235_ctrl, "52234", -1},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, mcf52235_ctrl, "52235", 0},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp, mcf5225_ctrl, "5224", -1},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp, mcf5225_ctrl, "5225", 0},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, mcf5235_ctrl, "5232", -1},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, mcf5235_ctrl, "5233", -1},
{mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp, mcf5235_ctrl, "5234", -1},
@ -832,6 +836,7 @@ const pseudo_typeS md_pseudo_table[] =
#endif
#ifdef OBJ_ELF
{"swbeg", s_ignore, 0},
{"long", m68k_elf_cons, 4},
#endif
{"extend", float_cons, 'x'},
{"ldouble", float_cons, 'x'},
@ -1004,6 +1009,66 @@ get_reloc_code (int size, int pcrel, enum pic_relocation pic)
}
break;
case pic_tls_gd:
switch (size)
{
case 1:
return BFD_RELOC_68K_TLS_GD8;
case 2:
return BFD_RELOC_68K_TLS_GD16;
case 4:
return BFD_RELOC_68K_TLS_GD32;
}
break;
case pic_tls_ldm:
switch (size)
{
case 1:
return BFD_RELOC_68K_TLS_LDM8;
case 2:
return BFD_RELOC_68K_TLS_LDM16;
case 4:
return BFD_RELOC_68K_TLS_LDM32;
}
break;
case pic_tls_ldo:
switch (size)
{
case 1:
return BFD_RELOC_68K_TLS_LDO8;
case 2:
return BFD_RELOC_68K_TLS_LDO16;
case 4:
return BFD_RELOC_68K_TLS_LDO32;
}
break;
case pic_tls_ie:
switch (size)
{
case 1:
return BFD_RELOC_68K_TLS_IE8;
case 2:
return BFD_RELOC_68K_TLS_IE16;
case 4:
return BFD_RELOC_68K_TLS_IE32;
}
break;
case pic_tls_le:
switch (size)
{
case 1:
return BFD_RELOC_68K_TLS_LE8;
case 2:
return BFD_RELOC_68K_TLS_LE16;
case 4:
return BFD_RELOC_68K_TLS_LE32;
}
break;
case pic_none:
if (pcrel)
{
@ -1072,6 +1137,21 @@ tc_m68k_fix_adjustable (fixS *fixP)
case BFD_RELOC_8_PLTOFF:
case BFD_RELOC_16_PLTOFF:
case BFD_RELOC_32_PLTOFF:
case BFD_RELOC_68K_TLS_GD32:
case BFD_RELOC_68K_TLS_GD16:
case BFD_RELOC_68K_TLS_GD8:
case BFD_RELOC_68K_TLS_LDM32:
case BFD_RELOC_68K_TLS_LDM16:
case BFD_RELOC_68K_TLS_LDM8:
case BFD_RELOC_68K_TLS_LDO32:
case BFD_RELOC_68K_TLS_LDO16:
case BFD_RELOC_68K_TLS_LDO8:
case BFD_RELOC_68K_TLS_IE32:
case BFD_RELOC_68K_TLS_IE16:
case BFD_RELOC_68K_TLS_IE8:
case BFD_RELOC_68K_TLS_LE32:
case BFD_RELOC_68K_TLS_LE16:
case BFD_RELOC_68K_TLS_LE8:
return 0;
case BFD_RELOC_VTABLE_INHERIT:
@ -1149,6 +1229,21 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
case BFD_RELOC_8_PLTOFF:
case BFD_RELOC_16_PLTOFF:
case BFD_RELOC_32_PLTOFF:
case BFD_RELOC_68K_TLS_GD32:
case BFD_RELOC_68K_TLS_GD16:
case BFD_RELOC_68K_TLS_GD8:
case BFD_RELOC_68K_TLS_LDM32:
case BFD_RELOC_68K_TLS_LDM16:
case BFD_RELOC_68K_TLS_LDM8:
case BFD_RELOC_68K_TLS_LDO32:
case BFD_RELOC_68K_TLS_LDO16:
case BFD_RELOC_68K_TLS_LDO8:
case BFD_RELOC_68K_TLS_IE32:
case BFD_RELOC_68K_TLS_IE16:
case BFD_RELOC_68K_TLS_IE8:
case BFD_RELOC_68K_TLS_LE32:
case BFD_RELOC_68K_TLS_LE16:
case BFD_RELOC_68K_TLS_LE8:
break;
default:
as_bad_where (fixp->fx_file, fixp->fx_line,
@ -4726,6 +4821,31 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
&& !S_IS_DEFINED (fixP->fx_addsy)
&& !S_IS_WEAK (fixP->fx_addsy))
S_SET_WEAK (fixP->fx_addsy);
switch (fixP->fx_r_type)
{
case BFD_RELOC_68K_TLS_GD32:
case BFD_RELOC_68K_TLS_GD16:
case BFD_RELOC_68K_TLS_GD8:
case BFD_RELOC_68K_TLS_LDM32:
case BFD_RELOC_68K_TLS_LDM16:
case BFD_RELOC_68K_TLS_LDM8:
case BFD_RELOC_68K_TLS_LDO32:
case BFD_RELOC_68K_TLS_LDO16:
case BFD_RELOC_68K_TLS_LDO8:
case BFD_RELOC_68K_TLS_IE32:
case BFD_RELOC_68K_TLS_IE16:
case BFD_RELOC_68K_TLS_IE8:
case BFD_RELOC_68K_TLS_LE32:
case BFD_RELOC_68K_TLS_LE16:
case BFD_RELOC_68K_TLS_LE8:
S_SET_THREAD_LOCAL (fixP->fx_addsy);
break;
default:
break;
}
return;
}
#elif defined(OBJ_AOUT)
@ -7776,6 +7896,115 @@ m68k_elf_final_processing (void)
}
elf_elfheader (stdoutput)->e_flags |= flags;
}
/* Parse @TLSLDO and return the desired relocation. */
static bfd_reloc_code_real_type
m68k_elf_suffix (char **str_p, expressionS *exp_p)
{
char ident[20];
char *str = *str_p;
char *str2;
int ch;
int len;
if (*str++ != '@')
return BFD_RELOC_UNUSED;
for (ch = *str, str2 = ident;
(str2 < ident + sizeof (ident) - 1
&& (ISALNUM (ch) || ch == '@'));
ch = *++str)
{
*str2++ = ch;
}
*str2 = '\0';
len = str2 - ident;
if (strncmp (ident, "TLSLDO", 6) == 0
&& len == 6)
{
/* Now check for identifier@suffix+constant. */
if (*str == '-' || *str == '+')
{
char *orig_line = input_line_pointer;
expressionS new_exp;
input_line_pointer = str;
expression (&new_exp);
if (new_exp.X_op == O_constant)
{
exp_p->X_add_number += new_exp.X_add_number;
str = input_line_pointer;
}
if (&input_line_pointer != str_p)
input_line_pointer = orig_line;
}
*str_p = str;
return BFD_RELOC_68K_TLS_LDO32;
}
return BFD_RELOC_UNUSED;
}
/* Handles .long <tls_symbol>+0x8000 debug info.
Clobbers input_line_pointer, checks end-of-line.
Adapted from tc-ppc.c:ppc_elf_cons. */
static void
m68k_elf_cons (int nbytes /* 4=.long */)
{
if (is_it_end_of_statement ())
{
demand_empty_rest_of_line ();
return;
}
do
{
expressionS exp;
bfd_reloc_code_real_type reloc;
expression (&exp);
if (exp.X_op == O_symbol
&& *input_line_pointer == '@'
&& (reloc = m68k_elf_suffix (&input_line_pointer,
&exp)) != BFD_RELOC_UNUSED)
{
reloc_howto_type *reloc_howto;
int size;
reloc_howto = bfd_reloc_type_lookup (stdoutput, reloc);
size = bfd_get_reloc_size (reloc_howto);
if (size > nbytes)
{
as_bad (_("%s relocations do not fit in %d bytes\n"),
reloc_howto->name, nbytes);
}
else
{
char *p;
int offset;
p = frag_more (nbytes);
offset = 0;
if (target_big_endian)
offset = nbytes - size;
fix_new_exp (frag_now, p - frag_now->fr_literal + offset, size,
&exp, 0, reloc);
}
}
else
emit_expr (&exp, (unsigned int) nbytes);
}
while (*input_line_pointer++ == ',');
/* Put terminator back into stream. */
input_line_pointer--;
demand_empty_rest_of_line ();
}
#endif
int

View File

@ -1,3 +1,8 @@
2009-02-03 Maxim Kuvyrkov <maxim@codesourcery.com>
* gas/m68k/tls-gd-3.d, gas/m68k/tls-gd-3.s: New test.
* gas/m68k/all.exp: Run it.
2009-01-29 Mark Mitchell <mark@codesourcery.com>
* gas/arm/copro.s: Avoid using r15 where not permitted.

View File

@ -86,6 +86,10 @@ if { [istarget m68*-*-*] || [istarget fido*-*-*] } then {
pass $testname
}
}
if { [istarget m68k-*-linux*] } then {
run_dump_test tls-gd-3
}
}
if [info exists errorInfo] then {
unset errorInfo

View File

@ -1,3 +1,7 @@
2009-02-03 Maxim Kuvyrkov <maxim@codesourcery.com>
* m68k.h: Map TLS relocations to numbers.
2009-01-15 Andrew Stubbs <ams@codesourcery.com>
Julian Brown <julian@codesourcery.com>

View File

@ -50,6 +50,25 @@ START_RELOC_NUMBERS (elf_m68k_reloc_type)
/* These are GNU extensions to enable C++ vtable garbage collection. */
RELOC_NUMBER (R_68K_GNU_VTINHERIT, 23)
RELOC_NUMBER (R_68K_GNU_VTENTRY, 24)
/* TLS static relocations. */
RELOC_NUMBER (R_68K_TLS_GD32, 25)
RELOC_NUMBER (R_68K_TLS_GD16, 26)
RELOC_NUMBER (R_68K_TLS_GD8, 27)
RELOC_NUMBER (R_68K_TLS_LDM32, 28)
RELOC_NUMBER (R_68K_TLS_LDM16, 29)
RELOC_NUMBER (R_68K_TLS_LDM8, 30)
RELOC_NUMBER (R_68K_TLS_LDO32, 31)
RELOC_NUMBER (R_68K_TLS_LDO16, 32)
RELOC_NUMBER (R_68K_TLS_LDO8, 33)
RELOC_NUMBER (R_68K_TLS_IE32, 34)
RELOC_NUMBER (R_68K_TLS_IE16, 35)
RELOC_NUMBER (R_68K_TLS_IE8, 36)
RELOC_NUMBER (R_68K_TLS_LE32, 37)
RELOC_NUMBER (R_68K_TLS_LE16, 38)
RELOC_NUMBER (R_68K_TLS_LE8, 39)
RELOC_NUMBER (R_68K_TLS_DTPMOD32, 40)
RELOC_NUMBER (R_68K_TLS_DTPREL32, 41)
RELOC_NUMBER (R_68K_TLS_TPREL32, 42)
END_RELOC_NUMBERS (R_68K_max)
/* We use the top 24 bits to encode information about the

View File

@ -1,3 +1,21 @@
2009-02-03 Maxim Kuvyrkov <maxim@codesourcery.com>
* ld-m68k/got-multigot-12-13-14-34-35-ok.d: Update.
* ld-m68k/got-multigot-14-ok.d: Update.
* ld-m68k/m68k-got.exp: Update.
* ld-m68k/got-negative-12-13-14-34-ok.d: Update.
* ld-m68k/got-negative-14-ok.d: Update.
* ld-m68k/tls-gd-1.d, ld-m68k/tls-gd-2.d: New tests.
* ld-m68k/tls-gd-ie-1.d, ld-m68k/tls-ie-1.d: New tests.
* ld-m68k/tls-ld-1.d, ld-m68k/tls-ld-2.d: New tests.
* ld-m68k/tls-ld-1.s, ld-m68k/tls-ld-2.s, ld-m68k/tls-le-1.s:
New test sources.
* ld-m68k/tls-no-1.s, ld-m68k/tls-gd-ie-1.s, ld-m68k/tls-gd-1.s:
New test sources.
* ld-m68k/tls-gd-2.s, ld-m68k/tls-ie-1.s: New test sources.
* ld-m68k/m68k.exp: Run new tests.
(merge isa-a isa-a:nodiv): Fix.
2009-02-01 Jan Kratochvil <jan.kratochvil@redhat.com>
* ld-elf/eh-group2.s: New `.cfi_lsda' referencing `.gcc_except_table'.

View File

@ -10,9 +10,9 @@ Dynamic section at offset .* contains 9 entries:
0x0000000a \(STRSZ\) [0-9]+ \(bytes\)
0x0000000b \(SYMENT\) 16 \(bytes\)
0x00000007 \(RELA\) 0x[0-9a-f]+
0x00000008 \(RELASZ\) 294960 \(bytes\)
0x00000008 \(RELASZ\) 294936 \(bytes\)
0x00000009 \(RELAENT\) 12 \(bytes\)
0x00000000 \(NULL\) 0x0
Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 24580 entries:
Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 24578 entries:
Offset Info Type Sym.Value Sym. Name \+ Addend

View File

@ -10,9 +10,9 @@ Dynamic section at offset .* contains 9 entries:
0x0000000a \(STRSZ\) [0-9]+ \(bytes\)
0x0000000b \(SYMENT\) 16 \(bytes\)
0x00000007 \(RELA\) 0x[0-9a-f]+
0x00000008 \(RELASZ\) 196608 \(bytes\)
0x00000008 \(RELASZ\) 196584 \(bytes\)
0x00000009 \(RELAENT\) 12 \(bytes\)
0x00000000 \(NULL\) 0x0
Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 16384 entries:
Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 16382 entries:
Offset Info Type Sym.Value Sym. Name \+ Addend

View File

@ -10,9 +10,9 @@ Dynamic section at offset .* contains 9 entries:
0x0000000a \(STRSZ\) [0-9]+ \(bytes\)
0x0000000b \(SYMENT\) 16 \(bytes\)
0x00000007 \(RELA\) 0x[0-9a-f]+
0x00000008 \(RELASZ\) 196608 \(bytes\)
0x00000008 \(RELASZ\) 196584 \(bytes\)
0x00000009 \(RELAENT\) 12 \(bytes\)
0x00000000 \(NULL\) 0x0
Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 16384 entries:
Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 16382 entries:
Offset Info Type Sym.Value Sym. Name \+ Addend

View File

@ -10,9 +10,9 @@ Dynamic section at offset .* contains 9 entries:
0x0000000a \(STRSZ\) [0-9]+ \(bytes\)
0x0000000b \(SYMENT\) 16 \(bytes\)
0x00000007 \(RELA\) 0x[0-9a-f]+
0x00000008 \(RELASZ\) 196608 \(bytes\)
0x00000008 \(RELASZ\) 196584 \(bytes\)
0x00000009 \(RELAENT\) 12 \(bytes\)
0x00000000 \(NULL\) 0x0
Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 16384 entries:
Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 16382 entries:
Offset Info Type Sym.Value Sym. Name \+ Addend

View File

@ -26,7 +26,7 @@ if { ![is_elf_format] || ![istarget m68k-*-*] } {
# 1 - 1
# 2 - 8189
# 3 - 8190
# 4 - 16384
# 4 - 16382
# 5 - 16385
proc gen_got_test { testname } {
@ -52,7 +52,7 @@ proc gen_got_test { testname } {
}
"got-14" {
set start 1
set count 16384
set count 16382
set xgot 0
}
"got-15" {
@ -62,7 +62,7 @@ proc gen_got_test { testname } {
}
"got-34" {
set start 8190
set count 16384
set count 16382
set xgot 0
}
"got-35" {
@ -164,7 +164,7 @@ proc got_test { testname } {
}
"got-negative-14-ok" {
puts $ofd "#source: $objdir/tmpdir/got-14.s"
set count 16384
set count 16382
}
"got-negative-15-er" {
puts $ofd "#source: $objdir/tmpdir/got-15.s"
@ -175,7 +175,7 @@ proc got_test { testname } {
puts $ofd "#source: $objdir/tmpdir/got-13.s"
puts $ofd "#source: $objdir/tmpdir/got-14.s"
puts $ofd "#source: $objdir/tmpdir/got-34.s"
set count 16384
set count 16382
}
"got-negative-12-13-14-35-er" {
puts $ofd "#source: $objdir/tmpdir/got-12.s"
@ -186,7 +186,7 @@ proc got_test { testname } {
}
"got-multigot-14-ok" {
puts $ofd "#source: $objdir/tmpdir/got-14.s"
set count 16384
set count 16382
}
"got-multigot-15-er" {
puts $ofd "#source: $objdir/tmpdir/got-15.s"
@ -198,7 +198,7 @@ proc got_test { testname } {
puts $ofd "#source: $objdir/tmpdir/got-14.s"
puts $ofd "#source: $objdir/tmpdir/got-34.s"
puts $ofd "#source: $objdir/tmpdir/got-35.s"
set count 24580
set count 24578
}
"got-xgot-15-ok" {
puts $ofd "#source: $objdir/tmpdir/xgot-15.s"

View File

@ -35,7 +35,7 @@ if { ![is_elf_format] || ![istarget m68k-*-*] } {
set m68k_mergeok_tests {
{"merge isa-a isa-a:nodiv" "-T merge.ld" ""
{isaa.s isaa-nodiv.s} {{objdump -p isaa.d}} "isaa"}
{isaa.s isaa-nodiv.s} {{objdump -p isaa.d}} "isaa-nodiv"}
{"merge isa-a isa-b" "-T merge.ld" ""
{isaa.s isab.s} {{objdump -p isab.d}} "isab"}
{"merge isa-a isa-aplus" "-T merge.ld" ""
@ -66,3 +66,12 @@ foreach { id sources } { a { plt1.s } b { plt1-empty.s plt1.s } } {
plt1-${id}-${arch}.so]]
}
}
if { [istarget m68k-*-linux*] } then {
run_dump_test "tls-gd-1"
run_dump_test "tls-gd-2"
run_dump_test "tls-gd-ie-1"
run_dump_test "tls-ie-1"
run_dump_test "tls-ld-1"
run_dump_test "tls-ld-2"
}