* elf-bfd.h (struct elf_backend_data): Remove got_symbol_offset.
	* elfxx-target.h (elf_backend_got_symbol_offset): Delete.
	* elflink.c (_bfd_elf_create_got_section): Use zero in place of
	got_symbol_offset.
	* elf-m10300.c (_bfd_mn10300_elf_create_got_section): Likewise.
	* elf32-frv.c (_frv_create_got_section): Likewise.
	* elf32-i370.c (i370_elf_finish_dynamic_sections): Delete ppc code.
	(elf_backend_got_symbol_offset): Don't define.
	* elf64-ppc.c (elf_backend_got_symbol_offset): Don't define.
	* elf32-ppc.c (struct ppc_elf_link_hash_table): Add got_header_size
	and got_gap.
	(ppc_elf_create_got): Tidy.
	(ppc_elf_create_dynamic_sections): Don't set SEC_IN_MEMORY for .plt.
	(ppc_elf_check_relocs): Reduce string comparisons by using elf.hgot.
	(ppc_elf_gc_sweep_hook): Likewise.
	(ppc_elf_relocate_section): Likewise.
	(ppc_elf_finish_dynamic_symbol): Likewise.
	(allocate_got): New function.
	(allocate_dynrelocs): Use allocate_got.
	(ppc_elf_size_dynamic_sections): Likewise.  Delay tlsld_got allocation
	so that local got can refcount it.  Set got_header_size.
	(ppc_elf_relocate_section): Use value of elf.hgot rather than hard-
	coded 4.
	(ppc_elf_finish_dynamic_sections): Likewise.
	(elf_backend_got_symbol_offset): Don't define.
	(elf_backend_got_header_size): Ditto.
ld/testsuite/
	* ld-powerpc/tlsexe32.d: Update for changed got layout.
	* ld-powerpc/tlsexe32.g: Likewise.
	* ld-powerpc/tlsexe32.r: Likewise.
	* ld-powerpc/tlsso32.d: Likewise.
	* ld-powerpc/tlsso32.g: Likewise.
	* ld-powerpc/tlsso32.r: Likewise.
This commit is contained in:
Alan Modra 2005-05-07 02:55:55 +00:00
parent c18bae34de
commit 3b36f7e629
16 changed files with 367 additions and 308 deletions

View File

@ -1,3 +1,32 @@
2005-05-07 Alan Modra <amodra@bigpond.net.au>
* elf-bfd.h (struct elf_backend_data): Remove got_symbol_offset.
* elfxx-target.h (elf_backend_got_symbol_offset): Delete.
* elflink.c (_bfd_elf_create_got_section): Use zero in place of
got_symbol_offset.
* elf-m10300.c (_bfd_mn10300_elf_create_got_section): Likewise.
* elf32-frv.c (_frv_create_got_section): Likewise.
* elf32-i370.c (i370_elf_finish_dynamic_sections): Delete ppc code.
(elf_backend_got_symbol_offset): Don't define.
* elf64-ppc.c (elf_backend_got_symbol_offset): Don't define.
* elf32-ppc.c (struct ppc_elf_link_hash_table): Add got_header_size
and got_gap.
(ppc_elf_create_got): Tidy.
(ppc_elf_create_dynamic_sections): Don't set SEC_IN_MEMORY for .plt.
(ppc_elf_check_relocs): Reduce string comparisons by using elf.hgot.
(ppc_elf_gc_sweep_hook): Likewise.
(ppc_elf_relocate_section): Likewise.
(ppc_elf_finish_dynamic_symbol): Likewise.
(allocate_got): New function.
(allocate_dynrelocs): Use allocate_got.
(ppc_elf_size_dynamic_sections): Likewise. Delay tlsld_got allocation
so that local got can refcount it. Set got_header_size.
(ppc_elf_relocate_section): Use value of elf.hgot rather than hard-
coded 4.
(ppc_elf_finish_dynamic_sections): Likewise.
(elf_backend_got_symbol_offset): Don't define.
(elf_backend_got_header_size): Ditto.
2005-05-05 Steve Ellcey <sje@cup.hp.com>
* configure.in (ACX_HEADER_STRING): New.

View File

@ -977,10 +977,6 @@ struct elf_backend_data
/* An array of target specific special section map. */
const struct bfd_elf_special_section *special_sections;
/* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the
.got section */
bfd_vma got_symbol_offset;
/* The size in bytes of the header for the GOT. This includes the
so-called reserved entries on some systems. */
bfd_vma got_header_size;

View File

@ -620,8 +620,7 @@ _bfd_mn10300_elf_create_got_section (abfd, info)
bh = NULL;
if (!(_bfd_generic_link_add_one_symbol
(info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
bed->got_symbol_offset, (const char *) NULL, FALSE,
bed->collect, &bh)))
0, (const char *) NULL, FALSE, bed->collect, &bh)))
return FALSE;
h = (struct elf_link_hash_entry *) bh;
h->def_regular = 1;
@ -634,7 +633,7 @@ _bfd_mn10300_elf_create_got_section (abfd, info)
elf_hash_table (info)->hgot = h;
/* The first bit of the global offset table is the header. */
s->size += bed->got_header_size + bed->got_symbol_offset;
s->size += bed->got_header_size;
return TRUE;
}
@ -809,7 +808,7 @@ mn10300_elf_check_relocs (abfd, info, sec, relocs)
else
{
/* This is a global offset table entry for a local
symbol. */
symbol. */
if (local_got_offsets == NULL)
{
size_t size;
@ -1186,7 +1185,7 @@ mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd,
bfd_put_32 (input_bfd, value, hit_data);
return bfd_reloc_ok;
case R_MN10300_GOTPC16:
/* Use global offset table as symbol value. */
@ -1207,7 +1206,7 @@ mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd,
value -= bfd_get_section_by_name (dynobj,
".got")->output_section->vma;
value += addend;
bfd_put_32 (input_bfd, value, hit_data);
return bfd_reloc_ok;
@ -1215,7 +1214,7 @@ mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd,
value -= bfd_get_section_by_name (dynobj,
".got")->output_section->vma;
value += addend;
if ((long) value > 0x7fffff || (long) value < -0x800000)
return bfd_reloc_overflow;
@ -1228,7 +1227,7 @@ mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd,
value -= bfd_get_section_by_name (dynobj,
".got")->output_section->vma;
value += addend;
if ((long) value > 0xffff || (long) value < -0x10000)
return bfd_reloc_overflow;
@ -1244,7 +1243,7 @@ mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd,
asection * splt;
splt = bfd_get_section_by_name (dynobj, ".plt");
value = (splt->output_section->vma
+ splt->output_offset
+ h->plt.offset) - value;
@ -1267,7 +1266,7 @@ mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd,
asection * splt;
splt = bfd_get_section_by_name (dynobj, ".plt");
value = (splt->output_section->vma
+ splt->output_offset
+ h->plt.offset) - value;
@ -1291,7 +1290,7 @@ mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd,
asection * sgot;
sgot = bfd_get_section_by_name (dynobj, ".got");
if (h != NULL)
{
bfd_vma off;
@ -1373,7 +1372,7 @@ mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd,
return bfd_reloc_ok;
}
/* Fall through. */
default:
return bfd_reloc_notsupported;
}
@ -2383,7 +2382,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
splt = bfd_get_section_by_name (elf_hash_table (link_info)
->dynobj, ".plt");
value = ((splt->output_section->vma
+ splt->output_offset
+ h->root.plt.offset)
@ -2760,16 +2759,16 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
/* We can not relax 0x6b, 0x7b, 0x8b, 0x9b as no 24bit
equivalent instructions exists. */
if (code != 0x6b && code != 0x7b
if (code != 0x6b && code != 0x7b
&& code != 0x8b && code != 0x9b
&& ((code & 0x0f) == 0x09 || (code & 0x0f) == 0x08
|| (code & 0x0f) == 0x0a || (code & 0x0f) == 0x0b
|| (code & 0x0f) == 0x0e))
{
/* Not safe if the high bit is on as relaxing may
move the value out of high mem and thus not fit
in a signed 8bit value. This is currently over
conservative. */
move the value out of high mem and thus not fit
in a signed 8bit value. This is currently over
conservative. */
if ((value & 0x80) == 0)
{
/* Note that we've changed the relocation contents,
@ -2857,8 +2856,8 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
if (code == 0xfe)
{
/* Get the second opcode. */
code = bfd_get_8 (abfd, contents + irel->r_offset - 2);
/* Get the second opcode. */
code = bfd_get_8 (abfd, contents + irel->r_offset - 2);
/* All the am33 32 -> 24 relaxing possibilities. */
/* We can not relax 0x6b, 0x7b, 0x8b, 0x9b as no 24bit
@ -2872,9 +2871,9 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
|| (code & 0x0f) == 0x0e))
{
/* Not safe if the high bit is on as relaxing may
move the value out of high mem and thus not fit
in a signed 16bit value. This is currently over
conservative. */
move the value out of high mem and thus not fit
in a signed 16bit value. This is currently over
conservative. */
if ((value & 0x8000) == 0)
{
/* Note that we've changed the relocation contents,
@ -3823,8 +3822,8 @@ _bfd_mn10300_elf_merge_private_bfd_data (ibfd, obfd)
&& bfd_get_mach (obfd) < bfd_get_mach (ibfd))
{
if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd),
bfd_get_mach (ibfd)))
return FALSE;
bfd_get_mach (ibfd)))
return FALSE;
}
return TRUE;
@ -4693,11 +4692,11 @@ _bfd_mn10300_elf_reloc_type_class (const Elf_Internal_Rela *rela)
/* So we can set bits in e_flags. */
#define elf_backend_final_write_processing \
_bfd_mn10300_elf_final_write_processing
#define elf_backend_object_p _bfd_mn10300_elf_object_p
_bfd_mn10300_elf_final_write_processing
#define elf_backend_object_p _bfd_mn10300_elf_object_p
#define bfd_elf32_bfd_merge_private_bfd_data \
_bfd_mn10300_elf_merge_private_bfd_data
_bfd_mn10300_elf_merge_private_bfd_data
#define elf_backend_can_gc_sections 1
#define elf_backend_create_dynamic_sections \

View File

@ -112,7 +112,7 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE), /* pcrel_offset */
/* A 16 bit pc-relative relocation. */
HOWTO (R_FRV_LABEL16, /* type */
HOWTO (R_FRV_LABEL16, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
@ -124,10 +124,10 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
TRUE), /* pcrel_offset */
TRUE), /* pcrel_offset */
/* A 24-bit pc-relative relocation. */
HOWTO (R_FRV_LABEL24, /* type */
HOWTO (R_FRV_LABEL24, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
26, /* bitsize */
@ -139,9 +139,9 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0x7e03ffff, /* src_mask */
0x7e03ffff, /* dst_mask */
TRUE), /* pcrel_offset */
TRUE), /* pcrel_offset */
HOWTO (R_FRV_LO16, /* type */
HOWTO (R_FRV_LO16, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
@ -153,9 +153,9 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
HOWTO (R_FRV_HI16, /* type */
HOWTO (R_FRV_HI16, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
@ -167,9 +167,9 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
HOWTO (R_FRV_GPREL12, /* type */
HOWTO (R_FRV_GPREL12, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
12, /* bitsize */
@ -177,13 +177,13 @@ static reloc_howto_type elf32_frv_howto_table [] =
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_FRV_GPREL12", /* name */
"R_FRV_GPREL12", /* name */
FALSE, /* partial_inplace */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_FRV_GPRELU12, /* type */
HOWTO (R_FRV_GPRELU12, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
12, /* bitsize */
@ -191,13 +191,13 @@ static reloc_howto_type elf32_frv_howto_table [] =
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_FRV_GPRELU12", /* name */
"R_FRV_GPRELU12", /* name */
FALSE, /* partial_inplace */
0xfff, /* src_mask */
0x3f03f, /* dst_mask */
FALSE), /* pcrel_offset */
0xfff, /* src_mask */
0x3f03f, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_FRV_GPREL32, /* type */
HOWTO (R_FRV_GPREL32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
@ -207,11 +207,11 @@ static reloc_howto_type elf32_frv_howto_table [] =
bfd_elf_generic_reloc, /* special_function */
"R_FRV_GPREL32", /* name */
FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
HOWTO (R_FRV_GPRELHI, /* type */
HOWTO (R_FRV_GPRELHI, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
@ -221,11 +221,11 @@ static reloc_howto_type elf32_frv_howto_table [] =
bfd_elf_generic_reloc, /* special_function */
"R_FRV_GPRELHI", /* name */
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
HOWTO (R_FRV_GPRELLO, /* type */
HOWTO (R_FRV_GPRELLO, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
@ -235,13 +235,13 @@ static reloc_howto_type elf32_frv_howto_table [] =
bfd_elf_generic_reloc, /* special_function */
"R_FRV_GPRELLO", /* name */
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* A 12-bit signed operand with the GOT offset for the address of
the symbol. */
HOWTO (R_FRV_GOT12, /* type */
HOWTO (R_FRV_GOT12, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
12, /* bitsize */
@ -251,13 +251,13 @@ static reloc_howto_type elf32_frv_howto_table [] =
bfd_elf_generic_reloc, /* special_function */
"R_FRV_GOT12", /* name */
FALSE, /* partial_inplace */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
/* The upper 16 bits of the GOT offset for the address of the
symbol. */
HOWTO (R_FRV_GOTHI, /* type */
HOWTO (R_FRV_GOTHI, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
@ -267,13 +267,13 @@ static reloc_howto_type elf32_frv_howto_table [] =
bfd_elf_generic_reloc, /* special_function */
"R_FRV_GOTHI", /* name */
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* The lower 16 bits of the GOT offset for the address of the
symbol. */
HOWTO (R_FRV_GOTLO, /* type */
HOWTO (R_FRV_GOTLO, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
@ -285,7 +285,7 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* The 32-bit address of the canonical descriptor of a function. */
HOWTO (R_FRV_FUNCDESC, /* type */
@ -314,9 +314,9 @@ static reloc_howto_type elf32_frv_howto_table [] =
bfd_elf_generic_reloc, /* special_function */
"R_FRV_FUNCDESC_GOT12", /* name */
FALSE, /* partial_inplace */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
/* The upper 16 bits of the GOT offset for the address of the
canonical descriptor of a function. */
@ -332,7 +332,7 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* The lower 16 bits of the GOT offset for the address of the
canonical descriptor of a function. */
@ -348,7 +348,7 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* The 64-bit descriptor of a function. */
HOWTO (R_FRV_FUNCDESC_VALUE, /* type */
@ -377,9 +377,9 @@ static reloc_howto_type elf32_frv_howto_table [] =
bfd_elf_generic_reloc, /* special_function */
"R_FRV_FUNCDESC_GOTOFF12", /* name */
FALSE, /* partial_inplace */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
/* The upper 16 bits of the GOT offset for the address of the
canonical descriptor of a function. */
@ -395,7 +395,7 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* The lower 16 bits of the GOT offset for the address of the
canonical descriptor of a function. */
@ -411,11 +411,11 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* A 12-bit signed operand with the GOT offset for the address of
the symbol. */
HOWTO (R_FRV_GOTOFF12, /* type */
HOWTO (R_FRV_GOTOFF12, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
12, /* bitsize */
@ -425,13 +425,13 @@ static reloc_howto_type elf32_frv_howto_table [] =
bfd_elf_generic_reloc, /* special_function */
"R_FRV_GOTOFF12", /* name */
FALSE, /* partial_inplace */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
/* The upper 16 bits of the GOT offset for the address of the
symbol. */
HOWTO (R_FRV_GOTOFFHI, /* type */
HOWTO (R_FRV_GOTOFFHI, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
@ -443,7 +443,7 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* The lower 16 bits of the GOT offset for the address of the
symbol. */
@ -459,7 +459,7 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* A 24-bit pc-relative relocation referencing the TLS PLT entry for
a thread-local symbol. If the symbol number is 0, it refers to
@ -476,7 +476,7 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0x7e03ffff, /* src_mask */
0x7e03ffff, /* dst_mask */
TRUE), /* pcrel_offset */
TRUE), /* pcrel_offset */
/* A 64-bit TLS descriptor for a symbol. This relocation is only
valid as a REL, dynamic relocation. */
@ -496,7 +496,7 @@ static reloc_howto_type elf32_frv_howto_table [] =
/* A 12-bit signed operand with the GOT offset for the TLS
descriptor of the symbol. */
HOWTO (R_FRV_GOTTLSDESC12, /* type */
HOWTO (R_FRV_GOTTLSDESC12, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
12, /* bitsize */
@ -506,13 +506,13 @@ static reloc_howto_type elf32_frv_howto_table [] =
bfd_elf_generic_reloc, /* special_function */
"R_FRV_GOTTLSDESC12", /* name */
FALSE, /* partial_inplace */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
/* The upper 16 bits of the GOT offset for the TLS descriptor of the
symbol. */
HOWTO (R_FRV_GOTTLSDESCHI, /* type */
HOWTO (R_FRV_GOTTLSDESCHI, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
@ -524,7 +524,7 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* The lower 16 bits of the GOT offset for the TLS descriptor of the
symbol. */
@ -540,11 +540,11 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* A 12-bit signed operand with the offset from the module base
address to the thread-local symbol address. */
HOWTO (R_FRV_TLSMOFF12, /* type */
HOWTO (R_FRV_TLSMOFF12, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
12, /* bitsize */
@ -554,13 +554,13 @@ static reloc_howto_type elf32_frv_howto_table [] =
bfd_elf_generic_reloc, /* special_function */
"R_FRV_TLSMOFF12", /* name */
FALSE, /* partial_inplace */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
/* The upper 16 bits of the offset from the module base address to
the thread-local symbol address. */
HOWTO (R_FRV_TLSMOFFHI, /* type */
HOWTO (R_FRV_TLSMOFFHI, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
@ -572,7 +572,7 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* The lower 16 bits of the offset from the module base address to
the thread-local symbol address. */
@ -588,11 +588,11 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* A 12-bit signed operand with the GOT offset for the TLSOFF entry
for a symbol. */
HOWTO (R_FRV_GOTTLSOFF12, /* type */
HOWTO (R_FRV_GOTTLSOFF12, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
12, /* bitsize */
@ -602,13 +602,13 @@ static reloc_howto_type elf32_frv_howto_table [] =
bfd_elf_generic_reloc, /* special_function */
"R_FRV_GOTTLSOFF12", /* name */
FALSE, /* partial_inplace */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
0xfff, /* src_mask */
0xfff, /* dst_mask */
FALSE), /* pcrel_offset */
/* The upper 16 bits of the GOT offset for the TLSOFF entry for a
symbol. */
HOWTO (R_FRV_GOTTLSOFFHI, /* type */
HOWTO (R_FRV_GOTTLSOFFHI, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
@ -620,7 +620,7 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* The lower 16 bits of the GOT offset for the TLSOFF entry for a
symbol. */
@ -636,7 +636,7 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
/* The 32-bit offset from the thread pointer (not the module base
address) to a thread-local symbol. */
@ -707,7 +707,7 @@ static reloc_howto_type elf32_frv_howto_table [] =
/* A 32-bit offset from the module base address to
the thread-local symbol address. */
HOWTO (R_FRV_TLSMOFF, /* type */
HOWTO (R_FRV_TLSMOFF, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
@ -719,40 +719,40 @@ static reloc_howto_type elf32_frv_howto_table [] =
FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
FALSE), /* pcrel_offset */
};
/* GNU extension to record C++ vtable hierarchy. */
static reloc_howto_type elf32_frv_vtinherit_howto =
HOWTO (R_FRV_GNU_VTINHERIT, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"R_FRV_GNU_VTINHERIT", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE); /* pcrel_offset */
HOWTO (R_FRV_GNU_VTINHERIT, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"R_FRV_GNU_VTINHERIT", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE); /* pcrel_offset */
/* GNU extension to record C++ vtable member usage. */
static reloc_howto_type elf32_frv_vtentry_howto =
HOWTO (R_FRV_GNU_VTENTRY, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
_bfd_elf_rel_vtable_reloc_fn, /* special_function */
"R_FRV_GNU_VTENTRY", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE); /* pcrel_offset */
HOWTO (R_FRV_GNU_VTENTRY, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
_bfd_elf_rel_vtable_reloc_fn, /* special_function */
"R_FRV_GNU_VTENTRY", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE); /* pcrel_offset */
/* The following 3 relocations are REL. The only difference to the
entries in the table above are that partial_inplace is TRUE. */
@ -1872,7 +1872,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
->output_offset,
R_FRV_TLSOFF, idx, ad, entry);
}
bfd_put_32 (output_bfd, ad,
frvfdpic_got_section (info)->contents
+ frvfdpic_got_initial_offset (info)
@ -2004,7 +2004,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
{
bfd_byte *plt_code = frvfdpic_plt_section (info)->contents
+ entry->tlsplt_entry;
if (info->executable
&& (entry->symndx != -1
|| FRVFDPIC_SYM_LOCAL (info, entry->d.h)))
@ -2032,7 +2032,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
else
idx = 0;
}
/* *ABS*+addend is special for TLS relocations, use only the
addend for the TLS offset, and take the module id as
0. */
@ -2044,7 +2044,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
TLS offset to the addend. */
else if (sec)
ad += sec->output_section->vma - tls_biased_base (info);
if ((bfd_signed_vma)ad >= -(1 << (16 - 1))
&& (bfd_signed_vma)ad < (1 << (16 - 1)))
{
@ -2974,7 +2974,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
(LOCAL_EXEC_P ((info), (picrel)))
#define RELAX_TLSDESC_INITIAL_EXEC_P(info, picrel) \
(INITIAL_EXEC_P ((info), (picrel)))
#define RELAX_GOTTLSOFF_LOCAL_EXEC_P(info, picrel, value) \
(LOCAL_EXEC_P ((info), (picrel)) \
&& TLSMOFF_IN_RANGE_FOR_SETLOS_P((value), (info)))
@ -2991,7 +2991,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
name, input_bfd, input_section, rel->r_offset);
return FALSE;
}
if (RELAX_GETTLSOFF_LOCAL_EXEC_P (info, picrel,
relocation + rel->r_addend))
{
@ -3128,7 +3128,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
}
break;
case R_FRV_GOTTLSDESCLO:
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
@ -3176,7 +3176,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
}
break;
case R_FRV_TLSDESC_RELAX:
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
@ -3506,12 +3506,12 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
/*
There's nothing to relax in these:
R_FRV_TLSDESC_VALUE
R_FRV_TLSOFF
R_FRV_TLSMOFF12
R_FRV_TLSMOFFHI
R_FRV_TLSMOFFLO
R_FRV_TLSMOFF
R_FRV_TLSDESC_VALUE
R_FRV_TLSOFF
R_FRV_TLSMOFF12
R_FRV_TLSMOFFHI
R_FRV_TLSMOFFLO
R_FRV_TLSMOFF
*/
default:
@ -3921,7 +3921,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
? _frvfdpic_osec_to_segment (output_bfd, sec->output_section)
: tls_segment;
break;
case R_FRV_TLSDESC_VALUE:
case R_FRV_TLSOFF:
/* These shouldn't be present in input object files. */
@ -4304,8 +4304,7 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info)
bh = NULL;
if (!(_bfd_generic_link_add_one_symbol
(info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
bed->got_symbol_offset, (const char *) NULL, FALSE,
bed->collect, &bh)))
0, (const char *) NULL, FALSE, bed->collect, &bh)))
return FALSE;
h = (struct elf_link_hash_entry *) bh;
h->def_regular = 1;
@ -4321,7 +4320,7 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info)
}
/* The first bit of the global offset table is the header. */
s->size += bed->got_header_size + bed->got_symbol_offset;
s->size += bed->got_header_size;
/* This is the machine-specific part. Create and initialize section
data for the got. */
@ -4577,7 +4576,7 @@ _frvfdpic_count_tls_entries (struct frvfdpic_relocs_info *entry,
bfd_boolean subtract)
{
const int l = subtract ? -1 : 1;
/* Allocate space for a GOT entry with the TLS offset of the
symbol. */
if (entry->tlsoff12)
@ -4761,7 +4760,7 @@ _frvfdpic_relax_tls_entries (struct frvfdpic_relocs_info *entry,
_frvfdpic_count_tls_entries (entry, dinfo, TRUE);
changed = TRUE;
}
entry->tlsplt =
entry->tlsoff12 = entry->tlsofflos = entry->tlsoffhilo = 0;
}
@ -5245,7 +5244,7 @@ _frvfdpic_assign_plt_entries (void **entryp, void *info_)
else
size = 16;
}
frvfdpic_plt_section (dinfo->g.info)->size += size;
}
@ -5833,7 +5832,7 @@ elf32_frvfdpic_finish_dynamic_sections (bfd *output_bfd,
&& (hend->type == bfd_link_hash_defined
|| hend->type == bfd_link_hash_defweak))
{
bfd_vma value =
bfd_vma value =
frvfdpic_gotfixup_section (info)->output_section->vma
+ frvfdpic_gotfixup_section (info)->output_offset
+ frvfdpic_gotfixup_section (info)->size
@ -6276,7 +6275,7 @@ elf32_frv_check_relocs (abfd, info, sec, relocs)
case R_FRV_TLSDESC_VALUE:
picrel->relocstlsd++;
goto bad_reloc;
case R_FRV_GOTTLSDESC12:
picrel->tlsdesc12 = 1;
break;
@ -6296,13 +6295,13 @@ elf32_frv_check_relocs (abfd, info, sec, relocs)
picrel->tlsoff12 = 1;
info->flags |= DF_STATIC_TLS;
break;
case R_FRV_GOTTLSOFFHI:
case R_FRV_GOTTLSOFFLO:
picrel->tlsoffhilo = 1;
info->flags |= DF_STATIC_TLS;
break;
case R_FRV_TLSOFF:
picrel->relocstlsoff++;
info->flags |= DF_STATIC_TLS;

View File

@ -699,7 +699,7 @@ i370_elf_size_dynamic_sections (output_bfd, info)
if (s->size == 0)
{
/* Strip this section if we don't need it; see the
comment below. */
comment below. */
strip = TRUE;
}
else
@ -1022,20 +1022,16 @@ i370_elf_finish_dynamic_sections (output_bfd, info)
}
}
/* Add a blrl instruction at _GLOBAL_OFFSET_TABLE_-4 so that a function can
easily find the address of the _GLOBAL_OFFSET_TABLE_. */
/* XXX this is clearly very wrong for the 370 arch */
if (sgot)
{
unsigned char *contents = sgot->contents;
bfd_put_32 (output_bfd, (bfd_vma) 0x4e800021 /* blrl */, contents);
if (sdyn == NULL)
bfd_put_32 (output_bfd, (bfd_vma) 0, contents+4);
bfd_put_32 (output_bfd, (bfd_vma) 0, contents);
else
bfd_put_32 (output_bfd,
sdyn->output_section->vma + sdyn->output_offset,
contents+4);
contents);
elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
}
@ -1082,7 +1078,7 @@ i370_elf_finish_dynamic_sections (output_bfd, info)
}
/* Set the sh_info field of the output .dynsym section to the
index of the first global symbol. */
index of the first global symbol. */
elf_section_data (sdynsym->output_section)->this_hdr.sh_info =
maxdindx + 1;
}
@ -1215,8 +1211,8 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_I370_RELATIVE))
{
/* In these cases, we don't need the relocation
value. We check specially because in some
obscure cases sec->output_section will be NULL. */
value. We check specially because in some
obscure cases sec->output_section will be NULL. */
relocation = 0;
}
else
@ -1259,7 +1255,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
continue;
/* Relocations that may need to be propagated if this is a shared
object. */
object. */
case (int)R_I370_REL31:
/* If these relocations are not to a named symbol, they can be
handled right here, no need to bother the dynamic linker. */
@ -1269,7 +1265,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* fall through */
/* Relocations that always need to be propagated if this is a shared
object. */
object. */
case (int)R_I370_ADDR31:
case (int)R_I370_ADDR16:
if (info->shared
@ -1286,8 +1282,8 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
#endif
/* When generating a shared object, these relocations
are copied into the output file to be resolved at run
time. */
are copied into the output file to be resolved at run
time. */
if (sreloc == NULL)
{
@ -1323,7 +1319,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (skip)
memset (&outrel, 0, sizeof outrel);
/* h->dynindx may be -1 if this symbol was marked to
become local. */
become local. */
else if (h != NULL
&& ((! info->symbolic && h->dynindx != -1)
|| !h->def_regular))
@ -1377,8 +1373,8 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
/* This reloc will be computed at runtime, so there's no
need to do anything now, unless this is a RELATIVE
reloc in an unallocated section. */
need to do anything now, unless this is a RELATIVE
reloc in an unallocated section. */
if (skip == -1
|| (input_section->flags & SEC_ALLOC) != 0
|| ELF32_R_TYPE (outrel.r_info) != R_I370_RELATIVE)
@ -1487,7 +1483,6 @@ i370_elf_post_process_headers (abfd, link_info)
#define elf_info_to_howto i370_elf_info_to_howto
#define elf_backend_plt_not_loaded 1
#define elf_backend_got_symbol_offset 4
#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_reloc_type_lookup i370_elf_reloc_type_lookup

View File

@ -2131,6 +2131,11 @@ struct ppc_elf_link_hash_table
bfd_vma offset;
} tlsld_got;
/* Size of reserved GOT entries. */
unsigned int got_header_size;
/* Non-zero if allocating the header left a gap. */
unsigned int got_gap;
/* Small local sym to section mapping cache. */
struct sym_sec_cache sym_sec;
};
@ -2220,12 +2225,9 @@ ppc_elf_create_got (bfd *abfd, struct bfd_link_info *info)
if (!bfd_set_section_flags (abfd, s, flags))
return FALSE;
htab->relgot = bfd_make_section_with_flags (abfd, ".rela.got",
SEC_ALLOC | SEC_LOAD
| SEC_HAS_CONTENTS
| SEC_IN_MEMORY
| SEC_LINKER_CREATED
| SEC_READONLY);
flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
| SEC_LINKER_CREATED | SEC_READONLY);
htab->relgot = bfd_make_section_with_flags (abfd, ".rela.got", flags);
if (!htab->relgot
|| ! bfd_set_section_alignment (abfd, htab->relgot, 2))
return FALSE;
@ -2257,18 +2259,18 @@ ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
| SEC_LINKER_CREATED);
htab->dynbss = bfd_get_section_by_name (abfd, ".dynbss");
htab->dynsbss = s = bfd_make_section_with_flags (abfd, ".dynsbss",
SEC_ALLOC
| SEC_LINKER_CREATED);
s = bfd_make_section_with_flags (abfd, ".dynsbss",
SEC_ALLOC | SEC_LINKER_CREATED);
htab->dynsbss = s;
if (s == NULL)
return FALSE;
if (! info->shared)
{
htab->relbss = bfd_get_section_by_name (abfd, ".rela.bss");
htab->relsbss = s = bfd_make_section_with_flags (abfd,
".rela.sbss",
flags | SEC_READONLY);
s = bfd_make_section_with_flags (abfd, ".rela.sbss",
flags | SEC_READONLY);
htab->relsbss = s;
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
@ -2279,7 +2281,7 @@ ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
if (s == NULL)
abort ();
flags = SEC_ALLOC | SEC_CODE | SEC_IN_MEMORY | SEC_LINKER_CREATED;
flags = SEC_ALLOC | SEC_CODE | SEC_LINKER_CREATED;
return bfd_set_section_flags (abfd, s, flags);
}
@ -2626,15 +2628,15 @@ ppc_elf_check_relocs (bfd *abfd,
/* If a relocation refers to _GLOBAL_OFFSET_TABLE_, create the .got.
This shows up in particular in an R_PPC_ADDR32 in the eabi
startup code. */
if (h && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
if (h != NULL
&& htab->got == NULL
&& strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
{
if (htab->got == NULL)
{
if (htab->elf.dynobj == NULL)
htab->elf.dynobj = abfd;
if (!ppc_elf_create_got (htab->elf.dynobj, info))
return FALSE;
}
if (htab->elf.dynobj == NULL)
htab->elf.dynobj = abfd;
if (!ppc_elf_create_got (htab->elf.dynobj, info))
return FALSE;
BFD_ASSERT (h == htab->elf.hgot);
}
r_type = ELF32_R_TYPE (rel->r_info);
@ -2860,8 +2862,7 @@ ppc_elf_check_relocs (bfd *abfd,
case R_PPC_REL14_BRTAKEN:
case R_PPC_REL14_BRNTAKEN:
case R_PPC_REL32:
if (h == NULL
|| strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
if (h == NULL || h == htab->elf.hgot)
break;
/* fall through */
@ -3240,8 +3241,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
case R_PPC_REL14_BRTAKEN:
case R_PPC_REL14_BRNTAKEN:
case R_PPC_REL32:
if (h == NULL
|| strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
if (h == NULL || h == htab->elf.hgot)
break;
/* Fall thru */
@ -3648,6 +3648,34 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
return TRUE;
}
/* Allocate NEED contiguous space in .got, and return the offset.
Handles allocation of the got header when crossing 32k. */
static bfd_vma
allocate_got (struct ppc_elf_link_hash_table *htab, unsigned int need)
{
bfd_vma where;
unsigned int max_before_header = 32764;
if (need <= htab->got_gap)
{
where = max_before_header - htab->got_gap;
htab->got_gap -= need;
}
else
{
if (htab->got->size + need > max_before_header
&& htab->got->size <= max_before_header)
{
htab->got_gap = max_before_header - htab->got->size;
htab->got->size = max_before_header + htab->got_header_size;
}
where = htab->got->size;
htab->got->size += need;
}
return where;
}
/* Allocate space in associated reloc sections for dynamic relocs. */
static bfd_boolean
@ -3749,33 +3777,32 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
else
{
bfd_boolean dyn;
eh->elf.got.offset = htab->got->size;
unsigned int need = 0;
if ((eh->tls_mask & TLS_TLS) != 0)
{
if ((eh->tls_mask & TLS_LD) != 0)
htab->got->size += 8;
need += 8;
if ((eh->tls_mask & TLS_GD) != 0)
htab->got->size += 8;
need += 8;
if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0)
htab->got->size += 4;
need += 4;
if ((eh->tls_mask & TLS_DTPREL) != 0)
htab->got->size += 4;
need += 4;
}
else
htab->got->size += 4;
need += 4;
eh->elf.got.offset = allocate_got (htab, need);
dyn = htab->elf.dynamic_sections_created;
if ((info->shared
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, &eh->elf))
&& (ELF_ST_VISIBILITY (eh->elf.other) == STV_DEFAULT
|| eh->elf.root.type != bfd_link_hash_undefweak))
{
/* All the entries we allocated need relocs. */
htab->relgot->size
+= ((htab->got->size - eh->elf.got.offset) / 4
* sizeof (Elf32_External_Rela));
/* Except LD only needs one. */
/* All the entries we allocated need relocs.
Except LD only needs one. */
if ((eh->tls_mask & TLS_LD) != 0)
htab->relgot->size -= sizeof (Elf32_External_Rela);
need -= 4;
htab->relgot->size += need * (sizeof (Elf32_External_Rela) / 4);
}
}
}
@ -3932,15 +3959,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
}
}
if (htab->tlsld_got.refcount > 0)
{
htab->tlsld_got.offset = htab->got->size;
htab->got->size += 8;
if (info->shared)
htab->relgot->size += sizeof (Elf32_External_Rela);
}
else
htab->tlsld_got.offset = (bfd_vma) -1;
htab->got_header_size = 16;
/* Set up .got offsets for local syms, and space for local dynamic
relocs. */
@ -3951,7 +3970,6 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
char *lgot_masks;
bfd_size_type locsymcount;
Elf_Internal_Shdr *symtab_hdr;
asection *srel;
if (!is_ppc_elf_target (ibfd->xvec))
continue;
@ -3993,8 +4011,6 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
lgot_masks = (char *) end_local_got;
s = htab->got;
srel = htab->relgot;
for (; local_got < end_local_got; ++local_got, ++lgot_masks)
if (*local_got > 0)
{
@ -4002,41 +4018,60 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
{
/* If just an LD reloc, we'll just use
htab->tlsld_got.offset. */
if (htab->tlsld_got.offset == (bfd_vma) -1)
{
htab->tlsld_got.offset = s->size;
s->size += 8;
if (info->shared)
srel->size += sizeof (Elf32_External_Rela);
}
htab->tlsld_got.refcount += 1;
*local_got = (bfd_vma) -1;
}
else
{
*local_got = s->size;
unsigned int need = 0;
if ((*lgot_masks & TLS_TLS) != 0)
{
if ((*lgot_masks & TLS_GD) != 0)
s->size += 8;
need += 8;
if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0)
s->size += 4;
need += 4;
if ((*lgot_masks & TLS_DTPREL) != 0)
s->size += 4;
need += 4;
}
else
s->size += 4;
need += 4;
*local_got = allocate_got (htab, need);
if (info->shared)
srel->size += ((s->size - *local_got) / 4
* sizeof (Elf32_External_Rela));
htab->relgot->size += (need
* (sizeof (Elf32_External_Rela) / 4));
}
}
else
*local_got = (bfd_vma) -1;
}
if (htab->tlsld_got.refcount > 0)
{
htab->tlsld_got.offset = allocate_got (htab, 8);
if (info->shared)
htab->relgot->size += sizeof (Elf32_External_Rela);
}
else
htab->tlsld_got.offset = (bfd_vma) -1;
/* Allocate space for global sym dynamic relocs. */
elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info);
if (htab->got != NULL)
{
unsigned int g_o_t = 32768;
/* If we haven't allocated the header, do so now. */
if (htab->got->size <= 32768)
{
g_o_t = htab->got->size;
htab->got->size += htab->got_header_size;
}
g_o_t += 4;
htab->elf.hgot->root.u.def.value = g_o_t;
}
/* We've now determined the sizes of the various dynamic sections.
Allocate memory for them. */
relocs = FALSE;
@ -5273,7 +5308,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
}
}
relocation = htab->got->output_offset + off - 4;
relocation = htab->got->output_offset + off;
relocation -= htab->elf.hgot->root.u.def.value;
/* Addends on got relocations don't make much sense.
x+off@got is actually x@got+off, and since the got is
@ -5347,7 +5383,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
/* If these relocations are not to a named symbol, they can be
handled right here, no need to bother the dynamic linker. */
if (SYMBOL_REFERENCES_LOCAL (info, h)
|| strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
|| h == htab->elf.hgot)
break;
/* fall through */
@ -5952,8 +5988,8 @@ ppc_elf_finish_dynamic_symbol (bfd *output_bfd,
#endif
/* Mark some specially defined symbols as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
|| strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
if (h == htab->elf.hgot
|| strcmp (h->root.root.string, "_DYNAMIC") == 0
|| strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
sym->st_shndx = SHN_ABS;
@ -6035,17 +6071,18 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
/* Add a blrl instruction at _GLOBAL_OFFSET_TABLE_-4 so that a function can
easily find the address of the _GLOBAL_OFFSET_TABLE_. */
if (htab->got)
if (htab->got != NULL)
{
unsigned char *contents = htab->got->contents;
bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, contents);
unsigned char *p = htab->got->contents;
bfd_vma val;
if (sdyn == NULL)
bfd_put_32 (output_bfd, 0, contents + 4);
else
bfd_put_32 (output_bfd,
sdyn->output_section->vma + sdyn->output_offset,
contents + 4);
p += elf_hash_table (info)->hgot->root.u.def.value;
bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, p - 4);
val = 0;
if (sdyn != NULL)
val = sdyn->output_section->vma + sdyn->output_offset;
bfd_put_32 (output_bfd, val, p);
elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 4;
}
@ -6076,10 +6113,8 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
#endif
#define elf_backend_plt_not_loaded 1
#define elf_backend_got_symbol_offset 4
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
#define elf_backend_got_header_size 12
#define elf_backend_rela_normal 1
#define bfd_elf32_mkobject ppc_elf_mkobject

View File

@ -67,7 +67,6 @@ static bfd_vma opd_entry_value
#define elf_backend_want_plt_sym 0
#define elf_backend_plt_alignment 3
#define elf_backend_plt_not_loaded 1
#define elf_backend_got_symbol_offset 0
#define elf_backend_got_header_size 8
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
@ -2709,7 +2708,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
long j;
/* Trim duplicate syms, since we may have merged the normal and
dynamic symbols. Actually, we only care about syms that have
different values, so trim any with the same value. */
different values, so trim any with the same value. */
for (i = 1, j = 1; i < symcount; ++i)
if (syms[i - 1]->value + syms[i - 1]->section->vma
!= syms[i]->value + syms[i]->section->vma)
@ -4769,7 +4768,7 @@ opd_entry_value (asection *opd_sec,
if (!bfd_get_section_contents (opd_bfd, opd_sec, &val, offset, 8))
return (bfd_vma) -1;
if (code_sec != NULL)
{
asection *sec, *likely = NULL;

View File

@ -81,7 +81,7 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
bh = NULL;
if (!(_bfd_generic_link_add_one_symbol
(info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
bed->got_symbol_offset, NULL, FALSE, bed->collect, &bh)))
0, NULL, FALSE, bed->collect, &bh)))
return FALSE;
h = (struct elf_link_hash_entry *) bh;
h->def_regular = 1;
@ -96,7 +96,7 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
}
/* The first bit of the global offset table is the header. */
s->size += bed->got_header_size + bed->got_symbol_offset;
s->size += bed->got_header_size;
return TRUE;
}
@ -920,7 +920,7 @@ _bfd_elf_merge_symbol (bfd *abfd,
if (h->type == STT_TLS)
{
ntbfd = abfd;
ntbfd = abfd;
ntsec = sec;
ntdef = newdef;
tbfd = oldbfd;
@ -3591,7 +3591,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
else if (sec->kept_section)
{
/* Symbols from discarded section are undefined, and have
default visibility. */
default visibility. */
sec = bfd_und_section_ptr;
isym->st_shndx = SHN_UNDEF;
isym->st_other = STV_DEFAULT
@ -7055,7 +7055,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
@ -7663,7 +7663,7 @@ elf_fixup_link_order (bfd *abfd, asection *o)
struct bfd_link_order **sections;
asection *s;
bfd_vma offset;
seen_other = 0;
seen_linkorder = 0;
for (p = o->map_head.link_order; p != NULL; p = p->next)
@ -7695,11 +7695,11 @@ elf_fixup_link_order (bfd *abfd, asection *o)
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
sections = (struct bfd_link_order **)
xmalloc (seen_linkorder * sizeof (struct bfd_link_order *));
seen_linkorder = 0;
for (p = o->map_head.link_order; p != NULL; p = p->next)
{
sections[seen_linkorder++] = p;
@ -9065,7 +9065,7 @@ elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h,
return TRUE;
}
/* Mark sections containing global symbols. This is called through
elf_link_hash_traverse. */
@ -9086,7 +9086,7 @@ elf_mark_used_section (struct elf_link_hash_entry *h,
return TRUE;
}
/* Do mark and sweep of unused sections. */
bfd_boolean
@ -9156,7 +9156,7 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
{
/* _bfd_elf_discard_section_eh_frame knows how to discard
orphaned FDEs so don't mark sections referenced by the
EH frame section. */
EH frame section. */
if (strcmp (o->name, ".eh_frame") == 0)
o->gc_mark = 1;
else if (!_bfd_elf_gc_mark (info, o, gc_mark_hook))
@ -9753,7 +9753,7 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec)
which we are really going to use. */
sec->output_section = bfd_abs_section_ptr;
sec->kept_section = l->sec;
if (flags & SEC_GROUP)
{
asection *first = elf_next_in_group (sec);
@ -9842,7 +9842,7 @@ _bfd_elf_provide_symbol (struct bfd_link_info *info, const char *name,
h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE,
FALSE);
if (h != NULL && (h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak))
|| h->root.type == bfd_link_hash_undefweak))
bfd_elf_set_symbol (h, val);
}

View File

@ -72,9 +72,6 @@
#define bfd_elfNN_get_section_contents_in_window \
_bfd_generic_get_section_contents_in_window
#ifndef elf_backend_got_symbol_offset
#define elf_backend_got_symbol_offset (bfd_vma) 0
#endif
#ifndef elf_backend_can_refcount
#define elf_backend_can_refcount 0
#endif
@ -527,7 +524,7 @@ static const struct elf_backend_data elfNN_bed =
ELF_MACHINE_CODE, /* elf_machine_code */
ELF_MAXPAGESIZE, /* maxpagesize */
ELF_MINPAGESIZE, /* minpagesize */
ELF_DYNAMIC_SEC_FLAGS, /* dynamic_sec_flags */
ELF_DYNAMIC_SEC_FLAGS, /* dynamic_sec_flags */
elf_info_to_howto,
elf_info_to_howto_rel,
elf_backend_sym_is_global,
@ -592,7 +589,6 @@ static const struct elf_backend_data elfNN_bed =
ELF_MACHINE_ALT2,
&elf_backend_size_info,
elf_backend_special_sections,
elf_backend_got_symbol_offset,
elf_backend_got_header_size,
elf_backend_collect,
elf_backend_type_change_ok,

View File

@ -1,12 +1,21 @@
2005-05-07 Alan Modra <amodra@bigpond.net.au>
* ld-powerpc/tlsexe32.d: Update for changed got layout.
* ld-powerpc/tlsexe32.g: Likewise.
* ld-powerpc/tlsexe32.r: Likewise.
* ld-powerpc/tlsso32.d: Likewise.
* ld-powerpc/tlsso32.g: Likewise.
* ld-powerpc/tlsso32.r: Likewise.
2005-05-06 Nick Clifton <nickc@redhat.com>
* Update the address and phone number of the FSF organization in
Update the address and phone number of the FSF organization in
the GPL notices in the following files:
config/default.exp, ld-alpha/alpha.exp, ld-arm/arm-elf.exp,
* config/default.exp, ld-alpha/alpha.exp, ld-arm/arm-elf.exp,
ld-auto-import/auto-import.exp, ld-bootstrap/bootstrap.exp,
ld-cdtest/cdtest.exp, ld-checks/checks.exp, ld-cris/cris.exp,
ld-crx/crx.exp, ld-cygwin/exe-export.exp, ld-d10v/d10v.exp,
ld-discard/discard.exp, ld-elf/elf.exp, ld-elf/exclude.exp,
ld-discard/discard.exp, ld-elf/elf.exp, ld-elf/exclude.exp,
ld-elf/frame.exp, ld-elf/sec64k.exp, ld-elfcomm/elfcomm.exp,
ld-elfvers/vers.exp, ld-elfvsb/elfvsb.exp, ld-elfweak/elfweak.exp,
ld-fastcall/fastcall.exp, ld-frv/fdpic.exp, ld-frv/tls.exp,

View File

@ -9,9 +9,9 @@
Disassembly of section \.text:
.* <_start>:
.*: 80 7f 00 0c lwz r3,12\(r31\)
.*: 80 7f ff f0 lwz r3,-16\(r31\)
.*: 7c 63 12 14 add r3,r3,r2
.*: 38 7f 00 10 addi r3,r31,16
.*: 38 7f ff f4 addi r3,r31,-12
.*: 48 01 01 85 bl .*<__tls_get_addr@plt>
.*: 3c 62 00 00 addis r3,r2,0
.*: 38 63 90 1c addi r3,r3,-28644
@ -39,8 +39,9 @@ Disassembly of section \.text:
.*: a9 49 90 18 lha r10,-28648\(r9\)
Disassembly of section \.got:
.* <_GLOBAL_OFFSET_TABLE_-0x4>:
.*: 4e 80 00 21 blrl
.* <_GLOBAL_OFFSET_TABLE_>:
.*: 01 81 02 d0 00 00 00 00 00 00 00 00 00 00 00 00 .*
.* <_GLOBAL_OFFSET_TABLE_-0x10>:
\.\.\.
.*: 4e 80 00 21 blrl
.* <_GLOBAL_OFFSET_TABLE_>:
.*: 01 81 02 d0 00 00 00 00 00 00 00 00 .*

View File

@ -7,5 +7,5 @@
.*: +file format elf32-powerpc
Contents of section \.got:
.* 4e800021 018102d0 00000000 00000000 .*
.* 00000000 00000000 00000000 .*
.* 00000000 00000000 00000000 4e800021 .*
.* 018102d0 00000000 00000000 .*

View File

@ -52,8 +52,8 @@ Program Headers:
Relocation section '\.rela\.dyn' at offset 0x220 contains 2 entries:
Offset +Info +Type +Sym\. Value +Symbol's Name \+ Addend
01810380 +00000249 R_PPC_TPREL32 +00000000 +gd \+ 0
01810384 +00000444 R_PPC_DTPMOD32 +00000000 +ld \+ 0
01810370 +00000249 R_PPC_TPREL32 +00000000 +gd \+ 0
01810374 +00000444 R_PPC_DTPMOD32 +00000000 +ld \+ 0
Relocation section '\.rela\.plt' at offset 0x238 contains 1 entries:
Offset +Info +Type +Sym\. Value +Symbol's Name \+ Addend
@ -109,7 +109,7 @@ Symbol table '\.symtab' contains 40 entries:
.*: 00000024 +0 TLS +GLOBAL DEFAULT +9 ld1
.*: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
.*: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
.*: 01810374 +0 OBJECT +GLOBAL +HIDDEN +11 _GLOBAL_OFFSET_TABLE_
.*: 01810380 +0 OBJECT +GLOBAL +HIDDEN +11 _GLOBAL_OFFSET_TABLE_
.*: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _end
.*: 0000001c +0 TLS +GLOBAL DEFAULT +9 gd0
.*: 0000002c +0 TLS +GLOBAL DEFAULT +9 ie0

View File

@ -9,30 +9,30 @@
Disassembly of section \.text:
.* <_start>:
.*: 38 7f 00 1c addi r3,r31,28
.*: 38 7f ff e8 addi r3,r31,-24
.*: 48 00 00 01 bl .*
.*: 38 7f 00 0c addi r3,r31,12
.*: 38 7f ff e0 addi r3,r31,-32
.*: 48 00 00 01 bl .*
.*: 38 7f 00 24 addi r3,r31,36
.*: 38 7f ff f0 addi r3,r31,-16
.*: 48 01 01 95 bl .*<__tls_get_addr@plt>
.*: 38 7f 00 0c addi r3,r31,12
.*: 38 7f ff e0 addi r3,r31,-32
.*: 48 01 01 8d bl .*<__tls_get_addr@plt>
.*: 39 23 80 20 addi r9,r3,-32736
.*: 3d 23 00 00 addis r9,r3,0
.*: 81 49 80 24 lwz r10,-32732\(r9\)
.*: 81 3f 00 2c lwz r9,44\(r31\)
.*: 81 3f ff f8 lwz r9,-8\(r31\)
.*: 7d 49 12 2e lhzx r10,r9,r2
.*: 89 42 00 00 lbz r10,0\(r2\)
.*: 3d 22 00 00 addis r9,r2,0
.*: 99 49 00 00 stb r10,0\(r9\)
.*: 38 7e 00 14 addi r3,r30,20
.*: 38 7e ff d8 addi r3,r30,-40
.*: 48 00 00 01 bl .*
.*: 38 7e 00 0c addi r3,r30,12
.*: 38 7e ff e0 addi r3,r30,-32
.*: 48 00 00 01 bl .*
.*: 91 43 80 04 stw r10,-32764\(r3\)
.*: 3d 23 00 00 addis r9,r3,0
.*: 91 49 80 08 stw r10,-32760\(r9\)
.*: 81 3e 00 2c lwz r9,44\(r30\)
.*: 81 3e ff f8 lwz r9,-8\(r30\)
.*: 7d 49 13 2e sthx r10,r9,r2
.*: a1 42 00 00 lhz r10,0\(r2\)
.*: 3d 22 00 00 addis r9,r2,0
@ -40,6 +40,7 @@ Disassembly of section \.text:
Disassembly of section \.got:
.* <\.got>:
\.\.\.
.*: 4e 80 00 21 blrl
.*: 00 01 04 90 .*
\.\.\.

View File

@ -7,7 +7,7 @@
.*: +file format elf32-powerpc
Contents of section \.got:
.* 4e800021 00010490 00000000 00000000 .*
.* 00000000 00000000 00000000 00000000 .*
.* 00000000 00000000 00000000 00000000 .*
.* 00000000 4e800021 00010490 00000000 .*
.* 00000000 .*

View File

@ -55,14 +55,14 @@ Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 18 entries:
0+46a +0+245 R_PPC_TPREL16 +0+10474 +\.tdata \+ 10488
0+46e +0+248 R_PPC_TPREL16_HA +0+10474 +\.tdata \+ 1048c
0+472 +0+246 R_PPC_TPREL16_LO +0+10474 +\.tdata \+ 1048c
0+10540 +0+44 R_PPC_DTPMOD32 +0+
0+10548 +0+44 R_PPC_DTPMOD32 +0+
0+1054c +0+4e R_PPC_DTPREL32 +0+
0+10550 +0+844 R_PPC_DTPMOD32 +0+ +gd \+ 0
0+10554 +0+84e R_PPC_DTPREL32 +0+ +gd \+ 0
0+10558 +0+1544 R_PPC_DTPMOD32 +0+1c +gd0 \+ 0
0+1055c +0+154e R_PPC_DTPREL32 +0+1c +gd0 \+ 0
0+10560 +0+1649 R_PPC_TPREL32 +0+2c +ie0 \+ 0
0+10530 +0+44 R_PPC_DTPMOD32 +0+
0+10534 +0+4e R_PPC_DTPREL32 +0+
0+10538 +0+44 R_PPC_DTPMOD32 +0+
0+10540 +0+844 R_PPC_DTPMOD32 +0+ +gd \+ 0
0+10544 +0+84e R_PPC_DTPREL32 +0+ +gd \+ 0
0+10548 +0+1544 R_PPC_DTPMOD32 +0+1c +gd0 \+ 0
0+1054c +0+154e R_PPC_DTPREL32 +0+1c +gd0 \+ 0
0+10550 +0+1649 R_PPC_TPREL32 +0+2c +ie0 \+ 0
Relocation section '\.rela\.plt' at offset 0x[0-9a-f]+ contains 1 entries:
Offset +Info +Type +Sym\. Value +Symbol's Name \+ Addend
@ -118,7 +118,7 @@ Symbol table '\.symtab' contains 39 entries:
+[0-9]+: 0+10 +0 TLS +LOCAL +DEFAULT +7 ie4
+[0-9]+: 0+14 +0 TLS +LOCAL +DEFAULT +7 le4
+[0-9]+: 0+18 +0 TLS +LOCAL +DEFAULT +7 le5
+[0-9]+: 0+10534 +0 OBJECT +LOCAL +HIDDEN +ABS _GLOBAL_OFFSET_TABLE_
+[0-9]+: 0+10558 +0 OBJECT +LOCAL +HIDDEN +ABS _GLOBAL_OFFSET_TABLE_
+[0-9]+: 0+10490 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
+[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT +UND gd
+[0-9]+: 0+30 +0 TLS +GLOBAL DEFAULT +8 le0