bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add do_multi_toc. (has_small_toc_reloc): Define. (ppc64_elf_check_relocs): Set the above flags. (ppc64_elf_edit_opd): Delete obfd param. (ppc64_elf_tls_optimize): Likewise. (ppc64_elf_edit_toc): Likewise. (ppc64_elf_tls_setup): Likewise. Add no_multi_toc param. * elf64-ppc.h: Update prototypes. ld/ * emultempl/ppc64elf.em (ppc_before_allocation): Update for changed function parameters.
This commit is contained in:
parent
5c8a75eb63
commit
33c0ec9de7
5 changed files with 56 additions and 20 deletions
|
@ -1,3 +1,14 @@
|
|||
2010-02-09 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* elf64-ppc.c (struct ppc_link_hash_table): Add do_multi_toc.
|
||||
(has_small_toc_reloc): Define.
|
||||
(ppc64_elf_check_relocs): Set the above flags.
|
||||
(ppc64_elf_edit_opd): Delete obfd param.
|
||||
(ppc64_elf_tls_optimize): Likewise.
|
||||
(ppc64_elf_edit_toc): Likewise.
|
||||
(ppc64_elf_tls_setup): Likewise. Add no_multi_toc param.
|
||||
* elf64-ppc.h: Update prototypes.
|
||||
|
||||
2010-02-08 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* section.c (struct bfd_section): Delete has_tls_reloc,
|
||||
|
|
|
@ -3781,6 +3781,7 @@ struct ppc_link_hash_table
|
|||
unsigned int no_tls_get_addr_opt:1;
|
||||
|
||||
/* Support for multiple toc sections. */
|
||||
unsigned int do_multi_toc:1;
|
||||
unsigned int multi_toc_needed:1;
|
||||
unsigned int second_toc_pass:1;
|
||||
|
||||
|
@ -3809,6 +3810,10 @@ struct ppc_link_hash_table
|
|||
/* Nonzero if this section has any toc or got relocs. */
|
||||
#define has_toc_reloc sec_flg2
|
||||
|
||||
/* Nonzero if this section has small toc/got relocs, ie. that expect
|
||||
the reloc to be in the range -32768 to 32767. */
|
||||
#define has_small_toc_reloc sec_flg3
|
||||
|
||||
/* Nonzero if this section has a call to another section that uses
|
||||
the toc or got. */
|
||||
#define makes_toc_func_call sec_flg4
|
||||
|
@ -5010,6 +5015,17 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
|||
case R_PPC64_GOT16_LO_DS:
|
||||
/* This symbol requires a global offset table entry. */
|
||||
sec->has_toc_reloc = 1;
|
||||
if (r_type == R_PPC64_GOT_TLSLD16
|
||||
|| r_type == R_PPC64_GOT_TLSGD16
|
||||
|| r_type == R_PPC64_GOT_TPREL16_DS
|
||||
|| r_type == R_PPC64_GOT_DTPREL16_DS
|
||||
|| r_type == R_PPC64_GOT16
|
||||
|| r_type == R_PPC64_GOT16_DS)
|
||||
{
|
||||
htab->do_multi_toc = 1;
|
||||
sec->has_small_toc_reloc = 1;
|
||||
}
|
||||
|
||||
if (ppc64_elf_tdata (abfd)->got == NULL
|
||||
&& !create_got_section (abfd, info))
|
||||
return FALSE;
|
||||
|
@ -5106,10 +5122,12 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
|||
break;
|
||||
|
||||
case R_PPC64_TOC16:
|
||||
case R_PPC64_TOC16_DS:
|
||||
htab->do_multi_toc = 1;
|
||||
sec->has_small_toc_reloc = 1;
|
||||
case R_PPC64_TOC16_LO:
|
||||
case R_PPC64_TOC16_HI:
|
||||
case R_PPC64_TOC16_HA:
|
||||
case R_PPC64_TOC16_DS:
|
||||
case R_PPC64_TOC16_LO_DS:
|
||||
sec->has_toc_reloc = 1;
|
||||
break;
|
||||
|
@ -6883,8 +6901,7 @@ dec_dynrel_count (bfd_vma r_info,
|
|||
applications. */
|
||||
|
||||
bfd_boolean
|
||||
ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info,
|
||||
bfd_boolean non_overlapping)
|
||||
ppc64_elf_edit_opd (struct bfd_link_info *info, bfd_boolean non_overlapping)
|
||||
{
|
||||
bfd *ibfd;
|
||||
bfd_boolean some_edited = FALSE;
|
||||
|
@ -7054,7 +7071,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info,
|
|||
new_contents = NULL;
|
||||
amt = sec->size * sizeof (long) / 8;
|
||||
opd = &ppc64_elf_section_data (sec)->u.opd;
|
||||
opd->adjust = bfd_zalloc (obfd, amt);
|
||||
opd->adjust = bfd_zalloc (sec->owner, amt);
|
||||
if (opd->adjust == NULL)
|
||||
return FALSE;
|
||||
ppc64_elf_section_data (sec)->sec_type = sec_opd;
|
||||
|
@ -7285,9 +7302,9 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info,
|
|||
/* Set htab->tls_get_addr and call the generic ELF tls_setup function. */
|
||||
|
||||
asection *
|
||||
ppc64_elf_tls_setup (bfd *obfd,
|
||||
struct bfd_link_info *info,
|
||||
int no_tls_get_addr_opt)
|
||||
ppc64_elf_tls_setup (struct bfd_link_info *info,
|
||||
int no_tls_get_addr_opt,
|
||||
int *no_multi_toc)
|
||||
{
|
||||
struct ppc_link_hash_table *htab;
|
||||
|
||||
|
@ -7295,6 +7312,11 @@ ppc64_elf_tls_setup (bfd *obfd,
|
|||
if (htab == NULL)
|
||||
return NULL;
|
||||
|
||||
if (*no_multi_toc)
|
||||
htab->do_multi_toc = 0;
|
||||
else if (!htab->do_multi_toc)
|
||||
*no_multi_toc = 1;
|
||||
|
||||
htab->tls_get_addr = ((struct ppc_link_hash_entry *)
|
||||
elf_link_hash_lookup (&htab->elf, ".__tls_get_addr",
|
||||
FALSE, FALSE, TRUE));
|
||||
|
@ -7375,7 +7397,7 @@ ppc64_elf_tls_setup (bfd *obfd,
|
|||
no_tls_get_addr_opt = TRUE;
|
||||
}
|
||||
htab->no_tls_get_addr_opt = no_tls_get_addr_opt;
|
||||
return _bfd_elf_tls_setup (obfd, info);
|
||||
return _bfd_elf_tls_setup (info->output_bfd, info);
|
||||
}
|
||||
|
||||
/* Return TRUE iff REL is a branch reloc with a global symbol matching
|
||||
|
@ -7412,7 +7434,7 @@ branch_reloc_hash_match (const bfd *ibfd,
|
|||
dynamic relocations. */
|
||||
|
||||
bfd_boolean
|
||||
ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
|
||||
ppc64_elf_tls_optimize (struct bfd_link_info *info)
|
||||
{
|
||||
bfd *ibfd;
|
||||
asection *sec;
|
||||
|
@ -7852,7 +7874,7 @@ adjust_toc_syms (struct elf_link_hash_entry *h, void *inf)
|
|||
unused .toc entries. */
|
||||
|
||||
bfd_boolean
|
||||
ppc64_elf_edit_toc (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
|
||||
ppc64_elf_edit_toc (struct bfd_link_info *info)
|
||||
{
|
||||
bfd *ibfd;
|
||||
struct adjust_toc_info toc_inf;
|
||||
|
|
|
@ -22,13 +22,13 @@
|
|||
void ppc64_elf_init_stub_bfd
|
||||
(bfd *, struct bfd_link_info *);
|
||||
bfd_boolean ppc64_elf_edit_opd
|
||||
(bfd *, struct bfd_link_info *, bfd_boolean);
|
||||
(struct bfd_link_info *, bfd_boolean);
|
||||
asection *ppc64_elf_tls_setup
|
||||
(bfd *, struct bfd_link_info *, int);
|
||||
(struct bfd_link_info *, int, int *);
|
||||
bfd_boolean ppc64_elf_tls_optimize
|
||||
(bfd *, struct bfd_link_info *);
|
||||
(struct bfd_link_info *);
|
||||
bfd_boolean ppc64_elf_edit_toc
|
||||
(bfd *, struct bfd_link_info *);
|
||||
(struct bfd_link_info *);
|
||||
bfd_vma ppc64_elf_toc
|
||||
(bfd *);
|
||||
int ppc64_elf_setup_section_lists
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2010-02-09 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* emultempl/ppc64elf.em (ppc_before_allocation): Update for changed
|
||||
function parameters.
|
||||
|
||||
2010-02-05 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* configure.in (ALL_LIBGUAS): Add bg.
|
||||
|
|
|
@ -103,12 +103,10 @@ ppc_before_allocation (void)
|
|||
if (stub_file != NULL)
|
||||
{
|
||||
if (!no_opd_opt
|
||||
&& !ppc64_elf_edit_opd (link_info.output_bfd, &link_info,
|
||||
non_overlapping_opd))
|
||||
&& !ppc64_elf_edit_opd (&link_info, non_overlapping_opd))
|
||||
einfo ("%X%P: can not edit %s %E\n", "opd");
|
||||
|
||||
if (ppc64_elf_tls_setup (link_info.output_bfd, &link_info,
|
||||
no_tls_get_addr_opt)
|
||||
if (ppc64_elf_tls_setup (&link_info, no_tls_get_addr_opt, &no_multi_toc)
|
||||
&& !no_tls_opt)
|
||||
{
|
||||
/* Size the sections. This is premature, but we want to know the
|
||||
|
@ -117,7 +115,7 @@ ppc_before_allocation (void)
|
|||
expld.dataseg.phase = exp_dataseg_none;
|
||||
one_lang_size_sections_pass (NULL, TRUE);
|
||||
|
||||
if (!ppc64_elf_tls_optimize (link_info.output_bfd, &link_info))
|
||||
if (!ppc64_elf_tls_optimize (&link_info))
|
||||
einfo ("%X%P: TLS problem %E\n");
|
||||
|
||||
/* We must not cache anything from the preliminary sizing. */
|
||||
|
@ -126,7 +124,7 @@ ppc_before_allocation (void)
|
|||
|
||||
if (!no_toc_opt
|
||||
&& !link_info.relocatable
|
||||
&& !ppc64_elf_edit_toc (link_info.output_bfd, &link_info))
|
||||
&& !ppc64_elf_edit_toc (&link_info))
|
||||
einfo ("%X%P: can not edit %s %E\n", "toc");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue