2002-01-16 05:52:38 +00:00
|
|
|
# This shell script emits a C file. -*- C -*-
|
2015-01-01 14:15:26 +00:00
|
|
|
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
2002-01-16 05:52:38 +00:00
|
|
|
#
|
2007-07-06 14:09:45 +00:00
|
|
|
# This file is part of the GNU Binutils.
|
2002-01-16 05:52:38 +00:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-07-06 14:09:45 +00:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
2002-01-16 05:52:38 +00:00
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
2007-07-06 14:09:45 +00:00
|
|
|
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
# MA 02110-1301, USA.
|
2002-01-16 05:52:38 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# This file is sourced from elf32.em, and defines extra powerpc64-elf
|
|
|
|
# specific routines.
|
|
|
|
#
|
2007-07-19 19:56:10 +00:00
|
|
|
fragment <<EOF
|
2002-01-16 05:52:38 +00:00
|
|
|
|
2002-05-01 02:34:54 +00:00
|
|
|
#include "ldctor.h"
|
2002-05-02 09:48:15 +00:00
|
|
|
#include "libbfd.h"
|
2004-01-09 05:36:30 +00:00
|
|
|
#include "elf-bfd.h"
|
2002-01-16 05:52:38 +00:00
|
|
|
#include "elf64-ppc.h"
|
2012-05-26 11:13:20 +00:00
|
|
|
#include "ldlex.h"
|
2014-07-01 10:02:25 +00:00
|
|
|
#include "elf/ppc64.h"
|
2002-01-16 05:52:38 +00:00
|
|
|
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
static asection *ppc_add_stub_section (const char *, asection *);
|
|
|
|
static void ppc_layout_sections_again (void);
|
|
|
|
|
|
|
|
static struct ppc64_elf_params params = { NULL,
|
|
|
|
&ppc_add_stub_section,
|
|
|
|
&ppc_layout_sections_again,
|
|
|
|
1, 0, 0,
|
|
|
|
${DEFAULT_PLT_STATIC_CHAIN-0}, -1, 0,
|
2015-01-27 13:10:05 +00:00
|
|
|
0, -1, -1, 0};
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
|
2002-05-01 02:34:54 +00:00
|
|
|
/* Fake input file for stubs. */
|
|
|
|
static lang_input_statement_type *stub_file;
|
|
|
|
|
2005-03-29 11:07:38 +00:00
|
|
|
/* Whether we need to call ppc_layout_sections_again. */
|
|
|
|
static int need_laying_out = 0;
|
|
|
|
|
2002-05-22 09:04:48 +00:00
|
|
|
/* Whether to add ".foo" entries for each "foo" in a version script. */
|
|
|
|
static int dotsyms = 1;
|
|
|
|
|
2003-02-09 04:36:44 +00:00
|
|
|
/* Whether to run tls optimization. */
|
2004-11-04 11:55:13 +00:00
|
|
|
static int no_tls_opt = 0;
|
|
|
|
|
|
|
|
/* Whether to run opd optimization. */
|
|
|
|
static int no_opd_opt = 0;
|
|
|
|
|
|
|
|
/* Whether to run toc optimization. */
|
|
|
|
static int no_toc_opt = 0;
|
2003-02-09 04:36:44 +00:00
|
|
|
|
2010-03-15 02:03:00 +00:00
|
|
|
/* Whether to sort input toc and got sections. */
|
|
|
|
static int no_toc_sort = 0;
|
|
|
|
|
2015-02-02 11:18:46 +00:00
|
|
|
/* Input .toc sections will be placed in this output section. */
|
|
|
|
static const char *toc_section_name = ".got";
|
2003-06-08 14:07:34 +00:00
|
|
|
static asection *toc_section = 0;
|
|
|
|
|
2002-05-01 02:34:54 +00:00
|
|
|
/* This is called before the input files are opened. We create a new
|
|
|
|
fake input file to hold the stub sections. */
|
|
|
|
|
|
|
|
static void
|
2003-06-20 05:33:26 +00:00
|
|
|
ppc_create_output_section_statements (void)
|
2002-05-01 02:34:54 +00:00
|
|
|
{
|
2008-02-15 09:03:02 +00:00
|
|
|
if (!(bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
|
* elf-bfd.h (emum elf_object_id): Rename to elf_target_id. Add
entries for other architectures.
(struct elf_link_hash_table): Add hash_table_id field.
(elf_hash_table_id): New accessor macro.
* elflink.c (_bfd_elf_link_hash_table_init): Add target_id
parameter.
* elf-m10300.c (elf32_mn10300_hash_table): Check table id before
returning cast pointer.
(elf32_mn10300_link_hash_table_create): Identify new table as
containing MN10300 extensions.
(mn10300_elf_relax_section): Check pointer returned by
elf32_mn10300_hash_table.
* elf32-arm.c: Likewise, except using ARM extensions.
* elf32-avr.c: Likewise, except using AVR extensions.
* elf32-bfin.c: Likewise, except using BFIN extensions.
* elf32-cris.c: Likewise, except using CRIS extensions.
* elf32-frv.c: Likewise, except using FRV extensions.
* elf32-hppa.c: Likewise, except using HPPA32 extensions.
* elf32-i386.c: Likewise, except using I386 extensions.
* elf32-lm32.c: Likewise, except using LM32 extensions.
* elf32-m32r.c: Likewise, except using M32RM extensions.
* elf32-m68hc11.c: Likewise, except using M68HC11 extensions.
* elf32-m68hc1x.c: Likewise, except using M68HC11 extensions.
* elf32-m68hc1x.h: Likewise, except using M68HC11 extensions.
* elf32-m68k.c: Likewise, except using M68K extensions.
* elf32-microblaze.c: Likewise, except using MICROBLAZE extensions.
* elf32-ppc.c: Likewise, except using PPC32 extensions.
* elf32-s390.c: Likewise, except using S390 extensions.
* elf32-sh.c: Likewise, except using SH extensions.
* elf32-spu.c: Likewise, except using SPU extensions.
* elf32-xtensa.c: Likewise, except using XTENSA extensions.
* elf64-alpha.c: Likewise, except using ALPHA extensions.
* elf64-hppa.c: Likewise, except using HPPA64 extensions.
* elf64-ppc.c: Likewise, except using PPC64 extensions.
* elf64-s390.c: Likewise, except using S390 extensions.
* elf64-x86-64.c: Likewise, except using X86_64 extensions.
* elfxx-ia64.c: Likewise, except using IA64 extensions.
* elfxx-mips.c: Likewise, except using MIPS extensions.
* elfxx-sparc.c: Likewise, except using SPARC extensions.
* elfxx-sparc.h: Likewise, except using SPARC extensions.
* elf32-cr16.c (struct elf32_cr16_link_hash_table): Delete
redundant structure.
(elf32_cr16_hash_table): Delete unused macro.
(elf32_cr16_link_hash_traverse): Delete unused macro.
* elf32-score.c: Likewise.
* elf32-score7.c: Likewise.
* elf32-vax.c: Likewise.
* elf64-sh64.c: Likewise.
* emultempl/alphaelf.em: Update value expected from elf_object_id.
* emultempl/hppaelf.em: Likewise.
* emultempl/mipself.em: Likewise.
* emultempl/ppc32elf.em: Likewise.
* emultempl/ppc64elf.em: Likewise.
2010-02-04 09:16:43 +00:00
|
|
|
&& elf_object_id (link_info.output_bfd) == PPC64_ELF_DATA))
|
2003-02-17 22:49:24 +00:00
|
|
|
return;
|
|
|
|
|
2004-03-22 22:58:04 +00:00
|
|
|
link_info.wrap_char = '.';
|
|
|
|
|
2002-05-01 02:34:54 +00:00
|
|
|
stub_file = lang_add_input_file ("linker stubs",
|
|
|
|
lang_input_file_is_fake_enum,
|
|
|
|
NULL);
|
2008-02-15 03:35:53 +00:00
|
|
|
stub_file->the_bfd = bfd_create ("linker stubs", link_info.output_bfd);
|
2002-05-01 02:34:54 +00:00
|
|
|
if (stub_file->the_bfd == NULL
|
|
|
|
|| !bfd_set_arch_mach (stub_file->the_bfd,
|
2008-02-15 03:35:53 +00:00
|
|
|
bfd_get_arch (link_info.output_bfd),
|
|
|
|
bfd_get_mach (link_info.output_bfd)))
|
2002-05-01 02:34:54 +00:00
|
|
|
{
|
2011-10-09 03:41:16 +00:00
|
|
|
einfo ("%F%P: can not create BFD: %E\n");
|
2002-05-01 02:34:54 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-02-10 09:15:08 +00:00
|
|
|
stub_file->the_bfd->flags |= BFD_LINKER_CREATED;
|
2002-05-01 02:34:54 +00:00
|
|
|
ldlang_add_file (stub_file);
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
params.stub_bfd = stub_file->the_bfd;
|
2014-02-19 03:53:12 +00:00
|
|
|
if (params.save_restore_funcs < 0)
|
|
|
|
params.save_restore_funcs = !link_info.relocatable;
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
if (!ppc64_elf_init_stub_bfd (&link_info, ¶ms))
|
2013-04-22 03:11:40 +00:00
|
|
|
einfo ("%F%P: can not init BFD: %E\n");
|
2002-05-01 02:34:54 +00:00
|
|
|
}
|
|
|
|
|
2015-01-27 13:10:05 +00:00
|
|
|
/* Called after opening files but before mapping sections. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
ppc_after_open (void)
|
|
|
|
{
|
|
|
|
if (stub_file != NULL && link_info.relro && params.object_in_toc)
|
|
|
|
{
|
|
|
|
/* We have a .toc section that might be written to at run time.
|
|
|
|
Don't put .toc into the .got output section. */
|
|
|
|
lang_output_section_statement_type *got;
|
|
|
|
|
|
|
|
got = lang_output_section_find (".got");
|
|
|
|
if (got != NULL)
|
|
|
|
{
|
|
|
|
lang_statement_union_type *s;
|
|
|
|
for (s = got->children.head; s != NULL; s = s->header.next)
|
|
|
|
if (s->header.type == lang_wild_statement_enum
|
|
|
|
&& s->wild_statement.filename == NULL)
|
|
|
|
{
|
|
|
|
struct wildcard_list **i = &s->wild_statement.section_list;
|
|
|
|
while (*i != NULL)
|
|
|
|
if (strcmp ((*i)->spec.name, ".toc") == 0)
|
|
|
|
*i = (*i)->next;
|
|
|
|
else
|
|
|
|
i = &(*i)->next;
|
|
|
|
}
|
2015-02-02 11:18:46 +00:00
|
|
|
/* Instead, .toc input sections will be mapped to the
|
|
|
|
read/write .toc output section. If user scripts don't
|
|
|
|
provide one then we'll lose toc sorting and multi-toc. */
|
|
|
|
toc_section_name = ".toc";
|
2015-01-27 13:10:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
gld${EMULATION_NAME}_after_open ();
|
|
|
|
}
|
|
|
|
|
2010-03-15 02:03:00 +00:00
|
|
|
/* Move the input section statement at *U which happens to be on LIST
|
|
|
|
to be just before *TO. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
move_input_section (lang_statement_list_type *list,
|
|
|
|
lang_statement_union_type **u,
|
|
|
|
lang_statement_union_type **to)
|
|
|
|
{
|
|
|
|
lang_statement_union_type *s = *u;
|
|
|
|
asection *i = s->input_section.section;
|
|
|
|
asection *p, *n;
|
|
|
|
|
|
|
|
/* Snip the input section from the statement list. If it was the
|
|
|
|
last statement, fix the list tail pointer. */
|
|
|
|
*u = s->header.next;
|
|
|
|
if (*u == NULL)
|
|
|
|
list->tail = u;
|
|
|
|
/* Add it back in the new position. */
|
|
|
|
s->header.next = *to;
|
|
|
|
*to = s;
|
|
|
|
if (list->tail == to)
|
|
|
|
list->tail = &s->header.next;
|
|
|
|
|
|
|
|
/* Trim I off the bfd map_head/map_tail doubly linked lists. */
|
|
|
|
n = i->map_head.s;
|
|
|
|
p = i->map_tail.s;
|
|
|
|
(p != NULL ? p : i->output_section)->map_head.s = n;
|
|
|
|
(n != NULL ? n : i->output_section)->map_tail.s = p;
|
|
|
|
|
|
|
|
/* Add I back on in its new position. */
|
|
|
|
if (s->header.next->header.type == lang_input_section_enum)
|
|
|
|
{
|
|
|
|
n = s->header.next->input_section.section;
|
|
|
|
p = n->map_tail.s;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* If the next statement is not an input section statement then
|
|
|
|
TO must point at the previous input section statement
|
|
|
|
header.next field. */
|
|
|
|
lang_input_section_type *prev = (lang_input_section_type *)
|
|
|
|
((char *) to - offsetof (lang_statement_union_type, header.next));
|
|
|
|
|
|
|
|
ASSERT (prev->header.type == lang_input_section_enum);
|
|
|
|
p = prev->section;
|
|
|
|
n = p->map_head.s;
|
|
|
|
}
|
|
|
|
i->map_head.s = n;
|
|
|
|
i->map_tail.s = p;
|
|
|
|
(p != NULL ? p : i->output_section)->map_head.s = i;
|
|
|
|
(n != NULL ? n : i->output_section)->map_tail.s = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Sort input section statements in the linker script tree rooted at
|
|
|
|
LIST so that those whose owning bfd happens to have a section
|
|
|
|
called .init or .fini are placed first. Place any TOC sections
|
|
|
|
referenced by small TOC relocs next, with TOC sections referenced
|
|
|
|
only by bigtoc relocs last. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
sort_toc_sections (lang_statement_list_type *list,
|
|
|
|
lang_statement_union_type **ini,
|
|
|
|
lang_statement_union_type **small)
|
|
|
|
{
|
|
|
|
lang_statement_union_type *s, **u;
|
|
|
|
asection *i;
|
|
|
|
|
|
|
|
u = &list->head;
|
|
|
|
while ((s = *u) != NULL)
|
|
|
|
{
|
|
|
|
switch (s->header.type)
|
|
|
|
{
|
|
|
|
case lang_wild_statement_enum:
|
|
|
|
sort_toc_sections (&s->wild_statement.children, ini, small);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case lang_group_statement_enum:
|
|
|
|
sort_toc_sections (&s->group_statement.children, ini, small);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case lang_input_section_enum:
|
|
|
|
i = s->input_section.section;
|
|
|
|
/* Leave the stub_file .got where it is. We put the .got
|
|
|
|
header there. */
|
|
|
|
if (i->owner == stub_file->the_bfd)
|
|
|
|
break;
|
|
|
|
if (bfd_get_section_by_name (i->owner, ".init") != NULL
|
|
|
|
|| bfd_get_section_by_name (i->owner, ".fini") != NULL)
|
|
|
|
{
|
|
|
|
if (ini != NULL && *ini != s)
|
|
|
|
{
|
|
|
|
move_input_section (list, u, ini);
|
|
|
|
if (small == ini)
|
|
|
|
small = &s->header.next;
|
|
|
|
ini = &s->header.next;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (small == ini)
|
|
|
|
small = &s->header.next;
|
|
|
|
ini = &s->header.next;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (ini == NULL)
|
|
|
|
ini = u;
|
|
|
|
|
|
|
|
if (ppc64_elf_has_small_toc_reloc (i))
|
|
|
|
{
|
|
|
|
if (small != NULL && *small != s)
|
|
|
|
{
|
|
|
|
move_input_section (list, u, small);
|
|
|
|
small = &s->header.next;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
small = &s->header.next;
|
|
|
|
}
|
|
|
|
else if (small == NULL)
|
|
|
|
small = u;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
u = &s->header.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-25 05:20:57 +00:00
|
|
|
static void
|
|
|
|
prelim_size_sections (void)
|
|
|
|
{
|
|
|
|
if (expld.phase != lang_mark_phase_enum)
|
|
|
|
{
|
|
|
|
expld.phase = lang_mark_phase_enum;
|
|
|
|
expld.dataseg.phase = exp_dataseg_none;
|
|
|
|
one_lang_size_sections_pass (NULL, FALSE);
|
|
|
|
/* We must not cache anything from the preliminary sizing. */
|
|
|
|
lang_reset_memory_regions ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-12 07:56:38 +00:00
|
|
|
static void
|
2003-06-20 05:33:26 +00:00
|
|
|
ppc_before_allocation (void)
|
2002-11-12 07:56:38 +00:00
|
|
|
{
|
2003-02-17 22:49:24 +00:00
|
|
|
if (stub_file != NULL)
|
2003-02-04 14:51:35 +00:00
|
|
|
{
|
2008-01-15 07:25:49 +00:00
|
|
|
if (!no_opd_opt
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
&& !ppc64_elf_edit_opd (&link_info))
|
2011-10-09 03:41:16 +00:00
|
|
|
einfo ("%X%P: can not edit %s: %E\n", "opd");
|
2003-02-09 04:36:44 +00:00
|
|
|
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
if (ppc64_elf_tls_setup (&link_info)
|
2008-02-15 03:35:53 +00:00
|
|
|
&& !no_tls_opt)
|
2003-02-17 22:49:24 +00:00
|
|
|
{
|
|
|
|
/* Size the sections. This is premature, but we want to know the
|
|
|
|
TLS segment layout so that certain optimizations can be done. */
|
2010-06-25 05:20:57 +00:00
|
|
|
prelim_size_sections ();
|
2003-02-17 22:49:24 +00:00
|
|
|
|
2010-02-08 13:50:17 +00:00
|
|
|
if (!ppc64_elf_tls_optimize (&link_info))
|
2005-02-16 02:20:13 +00:00
|
|
|
einfo ("%X%P: TLS problem %E\n");
|
2003-02-17 22:49:24 +00:00
|
|
|
}
|
2004-11-04 11:55:13 +00:00
|
|
|
|
|
|
|
if (!no_toc_opt
|
2010-06-25 05:20:57 +00:00
|
|
|
&& !link_info.relocatable)
|
|
|
|
{
|
|
|
|
prelim_size_sections ();
|
|
|
|
|
|
|
|
if (!ppc64_elf_edit_toc (&link_info))
|
2011-10-09 03:41:16 +00:00
|
|
|
einfo ("%X%P: can not edit %s: %E\n", "toc");
|
2010-06-25 05:20:57 +00:00
|
|
|
}
|
2010-03-15 02:03:00 +00:00
|
|
|
|
|
|
|
if (!no_toc_sort)
|
|
|
|
{
|
|
|
|
lang_output_section_statement_type *toc_os;
|
|
|
|
|
2015-02-02 11:18:46 +00:00
|
|
|
toc_os = lang_output_section_find (toc_section_name);
|
2010-03-15 02:03:00 +00:00
|
|
|
if (toc_os != NULL)
|
|
|
|
sort_toc_sections (&toc_os->children, NULL, NULL);
|
|
|
|
}
|
2003-02-04 14:51:35 +00:00
|
|
|
}
|
|
|
|
|
2002-11-12 07:56:38 +00:00
|
|
|
gld${EMULATION_NAME}_before_allocation ();
|
|
|
|
}
|
|
|
|
|
2002-05-01 02:34:54 +00:00
|
|
|
struct hook_stub_info
|
|
|
|
{
|
|
|
|
lang_statement_list_type add;
|
|
|
|
asection *input_section;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Traverse the linker tree to find the spot where the stub goes. */
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
static bfd_boolean
|
2003-06-20 05:33:26 +00:00
|
|
|
hook_in_stub (struct hook_stub_info *info, lang_statement_union_type **lp)
|
2002-05-01 02:34:54 +00:00
|
|
|
{
|
|
|
|
lang_statement_union_type *l;
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean ret;
|
2002-05-01 02:34:54 +00:00
|
|
|
|
|
|
|
for (; (l = *lp) != NULL; lp = &l->header.next)
|
|
|
|
{
|
|
|
|
switch (l->header.type)
|
|
|
|
{
|
|
|
|
case lang_constructors_statement_enum:
|
|
|
|
ret = hook_in_stub (info, &constructor_list.head);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case lang_output_section_statement_enum:
|
|
|
|
ret = hook_in_stub (info,
|
|
|
|
&l->output_section_statement.children.head);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case lang_wild_statement_enum:
|
|
|
|
ret = hook_in_stub (info, &l->wild_statement.children.head);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case lang_group_statement_enum:
|
|
|
|
ret = hook_in_stub (info, &l->group_statement.children.head);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case lang_input_section_enum:
|
|
|
|
if (l->input_section.section == info->input_section)
|
|
|
|
{
|
|
|
|
/* We've found our section. Insert the stub immediately
|
|
|
|
before its associated input section. */
|
|
|
|
*lp = info->add.head;
|
|
|
|
*(info->add.tail) = l;
|
2002-11-30 08:39:46 +00:00
|
|
|
return TRUE;
|
2002-05-01 02:34:54 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case lang_data_statement_enum:
|
|
|
|
case lang_reloc_statement_enum:
|
|
|
|
case lang_object_symbols_statement_enum:
|
|
|
|
case lang_output_statement_enum:
|
|
|
|
case lang_target_statement_enum:
|
|
|
|
case lang_input_statement_enum:
|
|
|
|
case lang_assignment_statement_enum:
|
|
|
|
case lang_padding_statement_enum:
|
|
|
|
case lang_address_statement_enum:
|
|
|
|
case lang_fill_statement_enum:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
FAIL ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
2002-05-01 02:34:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Call-back for ppc64_elf_size_stubs. */
|
|
|
|
|
|
|
|
/* Create a new stub section, and arrange for it to be linked
|
|
|
|
immediately before INPUT_SECTION. */
|
|
|
|
|
|
|
|
static asection *
|
2003-06-20 05:33:26 +00:00
|
|
|
ppc_add_stub_section (const char *stub_sec_name, asection *input_section)
|
2002-05-01 02:34:54 +00:00
|
|
|
{
|
|
|
|
asection *stub_sec;
|
|
|
|
flagword flags;
|
|
|
|
asection *output_section;
|
|
|
|
lang_output_section_statement_type *os;
|
|
|
|
struct hook_stub_info info;
|
|
|
|
|
|
|
|
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
|
2007-02-13 01:53:03 +00:00
|
|
|
| SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_KEEP);
|
2008-07-07 00:46:51 +00:00
|
|
|
stub_sec = bfd_make_section_anyway_with_flags (stub_file->the_bfd,
|
|
|
|
stub_sec_name, flags);
|
2011-10-10 09:05:41 +00:00
|
|
|
if (stub_sec == NULL
|
2012-01-11 09:28:45 +00:00
|
|
|
|| !bfd_set_section_alignment (stub_file->the_bfd, stub_sec,
|
2014-11-24 02:11:33 +00:00
|
|
|
(params.plt_stub_align > 5
|
|
|
|
? params.plt_stub_align
|
|
|
|
: 5)))
|
2002-05-01 02:34:54 +00:00
|
|
|
goto err_ret;
|
|
|
|
|
|
|
|
output_section = input_section->output_section;
|
2014-01-20 03:46:16 +00:00
|
|
|
os = lang_output_section_get (output_section);
|
2002-05-01 02:34:54 +00:00
|
|
|
|
|
|
|
info.input_section = input_section;
|
|
|
|
lang_list_init (&info.add);
|
Add support for PowerPC VLE.
2012-05-14 Catherine Moore <clm@codesourcery.com>
* NEWS: Mention PowerPC VLE port.
2012-05-14 James Lemke <jwlemke@codesourcery.com>
Catherine Moore <clm@codesourcery.com>
bfd/
* bfd.c (bfd_lookup_section_flags): Add section parm.
* ecoff.c (bfd_debug_section): Remove flag_info initializer.
* elf-bfd.h (bfd_elf_section_data): Move in section_flag_info.
(bfd_elf_lookup_section_flags): Add section parm.
* elf32-ppc.c (is_ppc_vle): New function.
(ppc_elf_modify_segment_map): New function.
(elf_backend_modify_segment_map): Define.
(has_vle_insns): New define.
* elf32-ppc.h (ppc_elf_modify_segment_map): Declare.
* elflink.c (bfd_elf_lookup_section_flags): Add return value & parm.
Move in logic to omit / include a section.
* libbfd-in.h (bfd_link_info): Add section parm.
(bfd_generic_lookup_section_flags): Likewise.
* reloc.c (bfd_generic_lookup_section_flags): Likewise.
* section.c (bfd_section): Move out section_flag_info.
(BFD_FAKE_SECTION): Remove flag_info initializer.
* targets.c (_bfd_lookup_section_flags): Add section parm.
2012-05-14 Catherine Moore <clm@codesourcery.com>
bfd/
* archures.c (bfd_mach_ppc_vle): New.
* bfd-in2.h: Regenerated.
* cpu-powerpc.c (bfd_powerpc_archs): New entry for vle.
* elf32-ppc.c (split16_format_type): New enumeration.
(ppc_elf_vle_split16): New function.
(HOWTO): Add entries for R_PPC_VLE relocations.
(ppc_elf_reloc_type_lookup): Handle PPC_VLE relocations.
(ppc_elf_section_flags): New function.
(ppc_elf_lookup_section_flags): New function.
(ppc_elf_section_processing): New function.
(ppc_elf_check_relocs): Handle PPC_VLE relocations.
(ppc_elf_relocation_section): Likewise.
(elf_backend_lookup_section_flags_hook): Define.
(elf_backend_section_flags): Define.
(elf_backend_section_processing): Define.
* elf32-ppc.h (ppc_elf_section_processing): Declare.
* libbfd.h: Regenerated.
* reloc.c (BFD_RELOC_PPC_VLE_REL8, BFD_RELOC_PPC_VLE_REL15,
BFD_RELOC_PPC_VLE_REL24, BFD_RELOC_PPC_VLE_LO16A,
BFD_RELOC_PPC_VLE_LO16D, BFD_RELOC_PPC_VLE_HI16A,
BFD_RELOC_PPC_VLE_HI16D, BFD_RELOC_PPC_VLE_HA16A,
BFD_RELOC_PPC_VLE_HA16D, BFD_RELOC_PPC_VLE_SDA21,
BFD_RELOC_PPC_VLE_SDA21_LO, BFD_RELOC_PPC_VLE_SDAREL_LO16A,
BFD_RELOC_PPC_VLE_SDAREL_LO16D, BFD_RELOC_PPC_VLE_SDAREL_HI16A,
BFD_RELOC_PPC_VLE_SDAREL_HI16D, BFD_RELOC_PPC_VLE_SDAREL_HA16A,
BFD_RELOC_PPC_VLE_SDAREL_HA16D): New bfd relocations.
2012-05-14 James Lemke <jwlemke@codesourcery.com>
gas/
* config/tc-ppc.c (insn_validate): New func of existing code to call..
(ppc_setup_opcodes): ..from 2 places here.
Revise for second (VLE) opcode table.
Add #ifdef'd code to print opcode tables.
2012-05-14 James Lemke <jwlemke@codesourcery.com>
gas/
* config/tc-ppc.c (ppc_setup_opcodes): Allow out-of-order
for the VLE conditional branches.
2012-05-14 Catherine Moore <clm@codesourcery.com>
Maciej W. Rozycki <macro@codesourcery.com>
Rhonda Wittels <rhonda@codesourcery.com>
gas/
* config/tc-ppc.c (PPC_VLE_SPLIT16A): New macro.
(PPC_VLE_SPLIT16D): New macro.
(PPC_VLE_LO16A): New macro.
(PPC_VLE_LO16D): New macro.
(PPC_VLE_HI16A): New macro.
(PPC_VLE_HI16D): New macro.
(PPC_VLE_HA16A): New macro.
(PPC_VLE_HA16D): New macro.
(PPC_APUINFO_VLE): New definition.
(md_chars_to_number): New function.
(md_parse_option): Check for combinations of little
endian and -mvle.
(md_show_usage): Document -mvle.
(ppc_arch): Recognize VLE.
(ppc_mach): Recognize bfd_mach_ppc_vle.
(ppc_setup_opcodes): Print the opcode table if
* config/tc-ppc.h (ppc_frag_check): Declare.
* doc/c-ppc.texi: Document -mvle.
* NEWS: Mention PowerPC VLE port.
2012-05-14 Catherine Moore <clm@codesourcery.com>
gas/
* config/tc-ppc.h (ppc_dw2_line_min_insn_length): Declare.
(DWARF2_LINE_MIN_INSN_LENGTH): Redefine.
* config/tc-ppc.c (ppc_dw2_line_min_insn_length): New.
* dwarf2dbg.c (scale_addr_delta): Handle values of 1
for DWARF2_LINE_MIN_INSN_LENGTH.
2012-05-14 Catherine Moore <clm@codesourcery.com>
Maciej W. Rozycki <macro@codesourcery.com>
Rhonda Wittels <rhonda@codesourcery.com>
gas/testsuite/
* gas/ppc/ppc.exp: Run new tests.
* gas/ppc/vle-reloc.d: New test.
* gas/ppc/vle-reloc.s: New test.
* gas/ppc/vle-simple-1.d: New test.
* gas/ppc/vle-simple-1.s: New test.
* gas/ppc/vle-simple-2.d: New test.
* gas/ppc/vle-simple-2.s: New test.
* gas/ppc/vle-simple-3.d: New test.
* gas/ppc/vle-simple-3.s: New test.
* gas/ppc/vle-simple-4.d: New test.
* gas/ppc/vle-simple-4.s: New test.
* gas/ppc/vle-simple-5.d: New test.
* gas/ppc/vle-simple-5.s: New test.
* gas/ppc/vle-simple-6.d: New test.
* gas/ppc/vle-simple-6.s: New test.
* gas/ppc/vle.d: New test.
* gas/ppc/vle.s: New test.
2012-05-14 James Lemke <jwlemke@codesourcery.com>
include/elf/
* ppc.h (SEC_PPC_VLE): Remove.
2012-05-14 Catherine Moore <clm@codesourcery.com>
James Lemke <jwlemke@codesourcery.com>
include/elf/
* ppc.h (R_PPC_VLE_REL8): New reloction.
(R_PPC_VLE_REL15): Likewise.
(R_PPC_VLE_REL24): Likewise.
(R_PPC_VLE_LO16A): Likewise.
(R_PPC_VLE_LO16D): Likewise.
(R_PPC_VLE_HI16A): Likewise.
(R_PPC_VLE_HI16D): Likewise.
(R_PPC_VLE_HA16A): Likewise.
(R_PPC_VLE_HA16D): Likewise.
(R_PPC_VLE_SDA21): Likewise.
(R_PPC_VLE_SDA21_LO): Likewise.
(R_PPC_VLE_SDAREL_LO16A): Likewise.
(R_PPC_VLE_SDAREL_LO16D): Likewise.
(R_PPC_VLE_SDAREL_HI16A): Likewise.
(R_PPC_VLE_SDAREL_HI16D): Likewise.
(R_PPC_VLE_SDAREL_HA16A): Likewise.
(R_PPC_VLE_SDAREL_HA16D): Likewise.
(SEC_PPC_VLE): Remove.
(PF_PPC_VLE): New program header flag.
(SHF_PPC_VLE): New section header flag.
(vle_opcodes, vle_num_opcodes): New.
(VLE_OP): New macro.
(VLE_OP_TO_SEG): New macro.
2012-05-14 Catherine Moore <clm@codesourcery.com>
Maciej W. Rozycki <macro@codesourcery.com>
Rhonda Wittels <rhonda@codesourcery.com>
include/opcode/
* ppc.h (PPC_OPCODE_VLE): New definition.
(PPC_OP_SA): New macro.
(PPC_OP_SE_VLE): New macro.
(PPC_OP): Use a variable shift amount.
(powerpc_operand): Update comments.
(PPC_OPSHIFT_INV): New macro.
(PPC_OPERAND_CR): Replace with...
(PPC_OPERAND_CR_BIT): ...this and
(PPC_OPERAND_CR_REG): ...this.
2012-05-14 James Lemke <jwlemke@codesourcery.com>
ld/
* ldlang.c (walk_wild_consider_section): Don't copy section_flag_list.
Pass it to callback.
(walk_wild_section_general): Pass section_flag_list to callback.
(lang_add_section): Add sflag_list parm.
Move out logic to keep / omit a section & call bfd_lookup_section_flags.
(output_section_callback_fast): Add sflag_list parm.
Add new parm to lang_add_section calls.
(output_section_callback): Likewise.
(check_section_callback): Add sflag_list parm.
(lang_place_orphans): Add new parm to lang_add_section calls.
(gc_section_callback): Add sflag_list parm.
(find_relro_section_callback): Likewise.
* ldlang.h (callback_t): Add flag_info parm.
(lang_add_section): Add sflag_list parm.
* emultempl/armelf.em (elf32_arm_add_stub_section):
Add lang_add_section parm.
* emultempl/beos.em (gld*_place_orphan): Likewise.
* emultempl/elf32.em (gld*_place_orphan): Likewise.
* emultempl/hppaelf.em (hppaelf_add_stub_section): Likewise.
* emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Likewise.
* emultempl/mipself.em (mips_add_stub_section): Likewise.
* emultempl/mmo.em (mmo_place_orphan): Likewise.
* emultempl/pe.em (gld_*_place_orphan): Likewise.
* emultempl/pep.em (gld_*_place_orphan): Likewise.
* emultempl/ppc64elf.em (ppc_add_stub_section): Likewise.
* emultempl/spuelf.em (spu_place_special_section): Likewise.
* emultempl/vms.em (vms_place_orphan): Likewise.
2012-05-14 James Lemke <jwlemke@codesourcery.com>
ld/testsuite/
* ld-powerpc/powerpc.exp: Create ppceabitests.
* ld-powerpc/vle-multiseg.s: New.
* ld-powerpc/vle-multiseg-1.d: New.
* ld-powerpc/vle-multiseg-1.ld: New.
* ld-powerpc/vle-multiseg-2.d: New.
* ld-powerpc/vle-multiseg-2.ld: New.
* ld-powerpc/vle-multiseg-3.d: New.
* ld-powerpc/vle-multiseg-3.ld: New.
* ld-powerpc/vle-multiseg-4.d: New.
* ld-powerpc/vle-multiseg-4.ld: New.
* ld-powerpc/vle-multiseg-5.d: New.
* ld-powerpc/vle-multiseg-5.ld: New.
* ld-powerpc/vle-multiseg-6.d: New.
* ld-powerpc/vle-multiseg-6.ld: New.
* ld-powerpc/vle-multiseg-6a.s: New.
* ld-powerpc/vle-multiseg-6b.s: New.
* ld-powerpc/vle-multiseg-6c.s: New.
* ld-powerpc/vle-multiseg-6d.s: New.
* ld-powerpc/powerpc.exp: Run new tests.
2012-05-14 Catherine Moore <clm@codesourcery.com>
ld/
* NEWS: Mention PowerPC VLE port.
2012-05-14 Catherine Moore <clm@codesourcery.com>
ld/testsuite/
* ld-powerpc/apuinfo.rd: Update for VLE.
* ld-powerpc/vle-reloc-1.d: New.
* ld-powerpc/vle-reloc-1.s: New.
* ld-powerpc/vle-reloc-2.d: New.
* ld-powerpc/vle-reloc-2.s: New.
* ld-powerpc/vle-reloc-3.d: New.
* ld-powerpc/vle-reloc-3.s: New.
* ld-powerpc/vle-reloc-def-1.s: New.
* ld-powerpc/vle-reloc-def-2.s: New.
* ld-powerpc/vle-reloc-def-3.s: New.
2012-05-14 James Lemke <jwlemke@codesourcery.com>
opcodes/
* ppc-dis.c (get_powerpc_dialect): Use is_ppc_vle.
(PPC_OPCD_SEGS, VLE_OPCD_SEGS): New defines.
(vle_opcd_indices): New array.
(lookup_vle): New function.
(disassemble_init_powerpc): Revise for second (VLE) opcode table.
(print_insn_powerpc): Likewise.
* ppc-opc.c: Likewise.
2012-05-14 Catherine Moore <clm@codesourcery.com>
Maciej W. Rozycki <macro@codesourcery.com>
Rhonda Wittels <rhonda@codesourcery.com>
Nathan Froyd <froydnj@codesourcery.com>
opcodes/
* ppc-opc.c (insert_arx, extract_arx): New functions.
(insert_ary, extract_ary): New functions.
(insert_li20, extract_li20): New functions.
(insert_rx, extract_rx): New functions.
(insert_ry, extract_ry): New functions.
(insert_sci8, extract_sci8): New functions.
(insert_sci8n, extract_sci8n): New functions.
(insert_sd4h, extract_sd4h): New functions.
(insert_sd4w, extract_sd4w): New functions.
(insert_vlesi, extract_vlesi): New functions.
(insert_vlensi, extract_vlensi): New functions.
(insert_vleui, extract_vleui): New functions.
(insert_vleil, extract_vleil): New functions.
(BI_MASK, BB_MASK, BT): Use PPC_OPERAND_CR_BIT.
(BI16, BI32, BO32, B8): New.
(B15, B24, CRD32, CRS): New.
(CRD, OBF, BFA, CR, CRFS): Use PPC_OPERAND_CR_REG.
(DB, IMM20, RD, Rx, ARX, RY, RZ): New.
(ARY, SCLSCI8, SCLSCI8N, SE_SD, SE_SDH): New.
(SH6_MASK): Use PPC_OPSHIFT_INV.
(SI8, UI5, OIMM5, UI7, BO16): New.
(VLESIMM, VLENSIMM, VLEUIMM, VLEUIMML): New.
(XT6, XA6, XB6, XB6S, XC6): Use PPC_OPSHIFT_INV.
(ALLOW8_SPRG): New.
(insert_sprg, extract_sprg): Check ALLOW8_SPRG.
(OPVUP, OPVUP_MASK OPVUP): New
(BD8, BD8_MASK, BD8IO, BD8IO_MASK): New.
(EBD8IO, EBD8IO1_MASK, EBD8IO2_MASK, EBD8IO3_MASK): New.
(BD15, BD15_MASK, EBD15, EBD15_MASK, EBD15BI, EBD15BI_MASK): New.
(BD24,BD24_MASK, C_LK, C_LK_MASK, C, C_MASK): New.
(IA16, IA16_MASK, I16A, I16A_MASK, I16L, I16L_MASK): New.
(IM7, IM7_MASK, LI20, LI20_MASK, SCI8, SCI8_MASK): New.
(SCI8BF, SCI8BF_MASK, SD4, SD4_MASK): New.
(SE_IM5, SE_IM5_MASK): New.
(SE_R, SE_R_MASK, SE_RR, SE_RR_MASK): New.
(EX, EX_MASK, BO16F, BO16T, BO32F, BO32T): New.
(BO32DNZ, BO32DZ): New.
(NO371, PPCSPE, PPCISEL, PPCEFS, MULHW): Include PPC_OPCODE_VLE.
(PPCVLE): New.
(powerpc_opcodes): Add new VLE instructions. Update existing
instruction to include PPCVLE if supported.
* ppc-dis.c (ppc_opts): Add vle entry.
(get_powerpc_dialect): New function.
(powerpc_init_dialect): VLE support.
(print_insn_big_powerpc): Call get_powerpc_dialect.
(print_insn_little_powerpc): Likewise.
(operand_value_powerpc): Handle negative shift counts.
(print_insn_powerpc): Handle 2-byte instruction lengths.
2012-05-14 19:45:30 +00:00
|
|
|
lang_add_section (&info.add, stub_sec, NULL, os);
|
2002-05-01 02:34:54 +00:00
|
|
|
|
|
|
|
if (info.add.head == NULL)
|
|
|
|
goto err_ret;
|
|
|
|
|
|
|
|
if (hook_in_stub (&info, &os->children.head))
|
|
|
|
return stub_sec;
|
|
|
|
|
|
|
|
err_ret:
|
|
|
|
einfo ("%X%P: can not make stub section: %E\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Another call-back for ppc64_elf_size_stubs. */
|
|
|
|
|
|
|
|
static void
|
2003-06-20 05:33:26 +00:00
|
|
|
ppc_layout_sections_again (void)
|
2002-05-01 02:34:54 +00:00
|
|
|
{
|
|
|
|
/* If we have changed sizes of the stub sections, then we need
|
|
|
|
to recalculate all the section offsets. This may mean we need to
|
|
|
|
add even more stubs. */
|
2006-06-20 02:22:16 +00:00
|
|
|
gld${EMULATION_NAME}_map_segments (TRUE);
|
2002-01-16 05:52:38 +00:00
|
|
|
|
2003-06-25 06:40:27 +00:00
|
|
|
if (!link_info.relocatable)
|
2013-07-01 03:45:05 +00:00
|
|
|
ppc64_elf_set_toc (&link_info, link_info.output_bfd);
|
2009-08-10 07:50:56 +00:00
|
|
|
|
|
|
|
need_laying_out = -1;
|
2002-01-16 05:52:38 +00:00
|
|
|
}
|
|
|
|
|
2002-05-01 02:34:54 +00:00
|
|
|
|
2003-06-08 14:07:34 +00:00
|
|
|
static void
|
2003-06-20 05:33:26 +00:00
|
|
|
build_toc_list (lang_statement_union_type *statement)
|
2003-06-08 14:07:34 +00:00
|
|
|
{
|
2005-11-17 00:10:05 +00:00
|
|
|
if (statement->header.type == lang_input_section_enum)
|
|
|
|
{
|
|
|
|
asection *i = statement->input_section.section;
|
|
|
|
|
PR ld/13991
bfd/
* bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as
_bfd_generic_link_just_syms.
* bfd/elflink.c (_bfd_elf_link_just_syms): Delete.
* bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type.
* bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section.
* bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS,
SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME,
SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE.
* bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c,
* bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c,
* bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c,
* bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c,
* bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c,
* bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c,
* bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c,
* bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c,
* bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c,
* bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c,
* bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c,
* bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c,
* bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c,
* bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c,
* bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c,
* bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c,
* bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c,
* bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c,
* bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c,
* bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c,
* bfd/reloc.c: Update all references.
* bfd/bfd-in2.h: Regenerate.
ld/
* ld/ldlang.c (size_input_section): Use sec_info_type rather than
usrdata->flags.just_syms.
* ld/ldwrite.c (build_link_order): Likewise.
* ld/emultempl/hppaelf.em (build_section_lists): Likewise.
* ld/emultempl/ppc64elf.em (build_toc_list): Likewise.
* ld/emultempl/armelf.em (build_section_lists): Likewise.
(after_allocation): Update for renamed sec_info_type value.
* ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-24 05:12:40 +00:00
|
|
|
if (i->sec_info_type != SEC_INFO_TYPE_JUST_SYMS
|
2005-11-17 00:10:05 +00:00
|
|
|
&& (i->flags & SEC_EXCLUDE) == 0
|
|
|
|
&& i->output_section == toc_section)
|
2010-02-03 12:03:35 +00:00
|
|
|
{
|
|
|
|
if (!ppc64_elf_next_toc_section (&link_info, i))
|
|
|
|
einfo ("%X%P: linker script separates .got and .toc\n");
|
|
|
|
}
|
2005-11-17 00:10:05 +00:00
|
|
|
}
|
2003-06-08 14:07:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-01 02:34:54 +00:00
|
|
|
static void
|
2003-06-20 05:33:26 +00:00
|
|
|
build_section_lists (lang_statement_union_type *statement)
|
2002-05-01 02:34:54 +00:00
|
|
|
{
|
2005-11-17 00:10:05 +00:00
|
|
|
if (statement->header.type == lang_input_section_enum)
|
2002-05-01 02:34:54 +00:00
|
|
|
{
|
2005-11-17 00:10:05 +00:00
|
|
|
asection *i = statement->input_section.section;
|
|
|
|
|
2012-03-05 22:43:40 +00:00
|
|
|
if (!((lang_input_statement_type *) i->owner->usrdata)->flags.just_syms
|
2005-11-17 00:10:05 +00:00
|
|
|
&& (i->flags & SEC_EXCLUDE) == 0
|
|
|
|
&& i->output_section != NULL
|
2008-02-15 03:35:53 +00:00
|
|
|
&& i->output_section->owner == link_info.output_bfd)
|
2005-11-17 00:10:05 +00:00
|
|
|
{
|
|
|
|
if (!ppc64_elf_next_input_section (&link_info, i))
|
|
|
|
einfo ("%X%P: can not size stub section: %E\n");
|
|
|
|
}
|
2002-05-01 02:34:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-22 09:04:48 +00:00
|
|
|
|
2009-08-10 07:50:56 +00:00
|
|
|
/* Call the back-end function to set TOC base after we have placed all
|
|
|
|
the sections. */
|
2002-01-16 05:52:38 +00:00
|
|
|
static void
|
2009-08-10 07:50:56 +00:00
|
|
|
gld${EMULATION_NAME}_after_allocation (void)
|
2002-01-16 05:52:38 +00:00
|
|
|
{
|
2014-08-18 00:03:35 +00:00
|
|
|
int ret;
|
|
|
|
|
2002-11-12 07:56:38 +00:00
|
|
|
/* If generating a relocatable output file, then we don't have any
|
|
|
|
stubs. */
|
2003-06-25 06:40:27 +00:00
|
|
|
if (stub_file != NULL && !link_info.relocatable)
|
2002-01-16 05:52:38 +00:00
|
|
|
{
|
2014-08-18 00:03:35 +00:00
|
|
|
ret = ppc64_elf_setup_section_lists (&link_info);
|
2005-02-16 02:20:13 +00:00
|
|
|
if (ret < 0)
|
|
|
|
einfo ("%X%P: can not size stub section: %E\n");
|
2014-08-21 23:37:35 +00:00
|
|
|
else
|
2002-05-01 02:34:54 +00:00
|
|
|
{
|
2010-02-03 12:03:35 +00:00
|
|
|
ppc64_elf_start_multitoc_partition (&link_info);
|
|
|
|
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
if (!params.no_multi_toc)
|
2010-02-03 12:03:35 +00:00
|
|
|
{
|
|
|
|
toc_section = bfd_get_section_by_name (link_info.output_bfd,
|
2015-02-02 11:18:46 +00:00
|
|
|
toc_section_name);
|
2010-02-03 12:03:35 +00:00
|
|
|
if (toc_section != NULL)
|
|
|
|
lang_for_each_statement (build_toc_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ppc64_elf_layout_multitoc (&link_info)
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
&& !params.no_multi_toc
|
2010-02-03 12:03:35 +00:00
|
|
|
&& toc_section != NULL)
|
2003-06-08 14:07:34 +00:00
|
|
|
lang_for_each_statement (build_toc_list);
|
|
|
|
|
2010-02-03 12:03:35 +00:00
|
|
|
ppc64_elf_finish_multitoc_partition (&link_info);
|
2003-06-08 14:07:34 +00:00
|
|
|
|
2002-11-12 07:56:38 +00:00
|
|
|
lang_for_each_statement (build_section_lists);
|
2002-05-01 02:34:54 +00:00
|
|
|
|
2010-03-14 07:05:36 +00:00
|
|
|
if (!ppc64_elf_check_init_fini (&link_info))
|
|
|
|
einfo ("%P: .init/.fini fragments use differing TOC pointers\n");
|
|
|
|
|
2002-11-12 07:56:38 +00:00
|
|
|
/* Call into the BFD backend to do the real work. */
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
if (!ppc64_elf_size_stubs (&link_info))
|
2005-02-16 02:20:13 +00:00
|
|
|
einfo ("%X%P: can not size stub section: %E\n");
|
2002-01-16 05:52:38 +00:00
|
|
|
}
|
2002-05-01 02:34:54 +00:00
|
|
|
}
|
2002-01-16 05:52:38 +00:00
|
|
|
|
2014-08-21 23:37:35 +00:00
|
|
|
/* We can't parse and merge .eh_frame until the glink .eh_frame has
|
|
|
|
been generated. Otherwise the glink .eh_frame CIE won't be
|
|
|
|
merged with other CIEs, and worse, the glink .eh_frame FDEs won't
|
|
|
|
be listed in .eh_frame_hdr. */
|
|
|
|
ret = bfd_elf_discard_info (link_info.output_bfd, &link_info);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
einfo ("%X%P: .eh_frame/.stab edit: %E\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (ret > 0)
|
|
|
|
need_laying_out = 1;
|
|
|
|
|
2006-06-20 02:22:16 +00:00
|
|
|
if (need_laying_out != -1)
|
2009-08-10 07:50:56 +00:00
|
|
|
{
|
|
|
|
gld${EMULATION_NAME}_map_segments (need_laying_out);
|
|
|
|
|
|
|
|
if (!link_info.relocatable)
|
2013-07-01 03:45:05 +00:00
|
|
|
ppc64_elf_set_toc (&link_info, link_info.output_bfd);
|
2009-08-10 07:50:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Final emulation specific call. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gld${EMULATION_NAME}_finish (void)
|
|
|
|
{
|
2014-07-01 10:02:25 +00:00
|
|
|
char *msg = NULL;
|
|
|
|
char *line, *endline;
|
|
|
|
|
2009-08-10 07:50:56 +00:00
|
|
|
/* e_entry on PowerPC64 points to the function descriptor for
|
|
|
|
_start. If _start is missing, default to the first function
|
|
|
|
descriptor in the .opd section. */
|
2014-10-15 23:08:09 +00:00
|
|
|
if (stub_file != NULL
|
|
|
|
&& (elf_elfheader (link_info.output_bfd)->e_flags & EF_PPC64_ABI) == 1)
|
2014-07-01 10:02:25 +00:00
|
|
|
entry_section = ".opd";
|
|
|
|
|
|
|
|
if (params.emit_stub_syms < 0)
|
|
|
|
params.emit_stub_syms = 1;
|
|
|
|
if (stub_file != NULL
|
|
|
|
&& !link_info.relocatable
|
|
|
|
&& !ppc64_elf_build_stubs (&link_info, config.stats ? &msg : NULL))
|
|
|
|
einfo ("%X%P: can not build stubs: %E\n");
|
|
|
|
|
|
|
|
fflush (stdout);
|
|
|
|
for (line = msg; line != NULL; line = endline)
|
2002-05-01 02:34:54 +00:00
|
|
|
{
|
2014-07-01 10:02:25 +00:00
|
|
|
endline = strchr (line, '\n');
|
|
|
|
if (endline != NULL)
|
|
|
|
*endline++ = '\0';
|
|
|
|
fprintf (stderr, "%s: %s\n", program_name, line);
|
2002-05-01 02:34:54 +00:00
|
|
|
}
|
2014-07-01 10:02:25 +00:00
|
|
|
fflush (stderr);
|
|
|
|
if (msg != NULL)
|
|
|
|
free (msg);
|
2004-08-10 11:23:03 +00:00
|
|
|
|
|
|
|
ppc64_elf_restore_symbols (&link_info);
|
2005-08-04 01:19:10 +00:00
|
|
|
finish_default ();
|
2002-05-01 02:34:54 +00:00
|
|
|
}
|
2002-01-16 05:52:38 +00:00
|
|
|
|
2002-02-05 07:07:21 +00:00
|
|
|
|
2002-05-22 09:04:48 +00:00
|
|
|
/* Add a pattern matching ".foo" for every "foo" in a version script.
|
|
|
|
|
|
|
|
The reason for doing this is that many shared library version
|
|
|
|
scripts export a selected set of functions or data symbols, forcing
|
|
|
|
others local. eg.
|
|
|
|
|
|
|
|
. VERS_1 {
|
|
|
|
. global:
|
|
|
|
. this; that; some; thing;
|
|
|
|
. local:
|
|
|
|
. *;
|
|
|
|
. };
|
|
|
|
|
|
|
|
To make the above work for PowerPC64, we need to export ".this",
|
|
|
|
".that" and so on, otherwise only the function descriptor syms are
|
|
|
|
exported. Lack of an exported function code sym may cause a
|
|
|
|
definition to be pulled in from a static library. */
|
|
|
|
|
2003-06-20 05:33:26 +00:00
|
|
|
static struct bfd_elf_version_expr *
|
|
|
|
gld${EMULATION_NAME}_new_vers_pattern (struct bfd_elf_version_expr *entry)
|
2002-05-22 09:04:48 +00:00
|
|
|
{
|
|
|
|
struct bfd_elf_version_expr *dot_entry;
|
|
|
|
unsigned int len;
|
|
|
|
char *dot_pat;
|
|
|
|
|
2007-05-14 08:53:23 +00:00
|
|
|
if (!dotsyms
|
2008-11-26 01:04:17 +00:00
|
|
|
|| entry->pattern[0] == '.'
|
|
|
|
|| (!entry->literal && entry->pattern[0] == '*'))
|
2002-05-22 09:04:48 +00:00
|
|
|
return entry;
|
|
|
|
|
2003-06-20 05:33:26 +00:00
|
|
|
dot_entry = xmalloc (sizeof *dot_entry);
|
2003-10-22 06:58:17 +00:00
|
|
|
*dot_entry = *entry;
|
2002-05-22 09:04:48 +00:00
|
|
|
dot_entry->next = entry;
|
2008-11-26 01:04:17 +00:00
|
|
|
len = strlen (entry->pattern) + 2;
|
|
|
|
dot_pat = xmalloc (len);
|
|
|
|
dot_pat[0] = '.';
|
|
|
|
memcpy (dot_pat + 1, entry->pattern, len - 1);
|
|
|
|
dot_entry->pattern = dot_pat;
|
2010-10-28 08:38:45 +00:00
|
|
|
dot_entry->script = 1;
|
2002-05-22 09:04:48 +00:00
|
|
|
return dot_entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-01 02:34:54 +00:00
|
|
|
/* Avoid processing the fake stub_file in vercheck, stat_needed and
|
|
|
|
check_needed routines. */
|
2002-01-16 05:52:38 +00:00
|
|
|
|
2003-06-20 05:33:26 +00:00
|
|
|
static void (*real_func) (lang_input_statement_type *);
|
2002-01-16 05:52:38 +00:00
|
|
|
|
2003-06-20 05:33:26 +00:00
|
|
|
static void ppc_for_each_input_file_wrapper (lang_input_statement_type *l)
|
2002-05-01 02:34:54 +00:00
|
|
|
{
|
|
|
|
if (l != stub_file)
|
|
|
|
(*real_func) (l);
|
2002-01-16 05:52:38 +00:00
|
|
|
}
|
2002-05-01 02:34:54 +00:00
|
|
|
|
|
|
|
static void
|
2003-06-20 05:33:26 +00:00
|
|
|
ppc_lang_for_each_input_file (void (*func) (lang_input_statement_type *))
|
2002-05-01 02:34:54 +00:00
|
|
|
{
|
|
|
|
real_func = func;
|
|
|
|
lang_for_each_input_file (&ppc_for_each_input_file_wrapper);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define lang_for_each_input_file ppc_lang_for_each_input_file
|
|
|
|
|
2002-01-16 05:52:38 +00:00
|
|
|
EOF
|
|
|
|
|
2007-03-26 11:10:44 +00:00
|
|
|
if grep -q 'ld_elf32_spu_emulation' ldemul-list.h; then
|
2007-07-19 19:56:10 +00:00
|
|
|
fragment <<EOF
|
2007-03-26 11:10:44 +00:00
|
|
|
/* Special handling for embedded SPU executables. */
|
|
|
|
extern bfd_boolean embedded_spu_file (lang_input_statement_type *, const char *);
|
|
|
|
static bfd_boolean gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *);
|
|
|
|
|
|
|
|
static bfd_boolean
|
|
|
|
ppc64_recognized_file (lang_input_statement_type *entry)
|
|
|
|
{
|
|
|
|
if (embedded_spu_file (entry, "-m64"))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
return gld${EMULATION_NAME}_load_symbols (entry);
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
LDEMUL_RECOGNIZED_FILE=ppc64_recognized_file
|
|
|
|
fi
|
|
|
|
|
2002-05-01 02:34:54 +00:00
|
|
|
# Define some shell vars to insert bits of code into the standard elf
|
|
|
|
# parse_args and list_options functions.
|
|
|
|
#
|
2011-07-26 01:57:18 +00:00
|
|
|
PARSE_AND_LIST_PROLOGUE=${PARSE_AND_LIST_PROLOGUE}'
|
|
|
|
#define OPTION_STUBGROUP_SIZE 321
|
bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add plt_static_chain.
(build_plt_stub): Add plt_static_chain param, don't load r11 if false.
(build_tls_get_addr_stub): Likewise.
(ppc_build_one_stub): Update calls to above.
(ppc_size_one_stub): Adjust stub size.
(ppc64_elf_size_stubs): Add plt_static_chain param, save to htab.
* elf64-ppc.h (ppc64_elf_size_stubs): Update prototype.
ld/
* emultempl/ppc64elf.em (plt_static_chain): New var.
(gld${EMULATION_NAME}_after_allocation): Pass to ppc64_elf_size_stubs.
(PARSE_AND_LIST_PROLOGUE, PARSE_AND_LIST_LONGOPTS,
PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Handle
--plt-static-chain and --no-plt-static-chain.
ld/testsuite/
* ld-powerpc/tlsexe.d, * ld-powerpc/tlsexe.g. *ld-powerpc/tlsexe.r,
* ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g,
* ld-powerpc/tlsexetoc.r, * ld-powerpc/tlsso.d,
* ld-powerpc/tlstocso.d: Update for plt stub change.
2011-07-14 03:28:22 +00:00
|
|
|
#define OPTION_PLT_STATIC_CHAIN (OPTION_STUBGROUP_SIZE + 1)
|
|
|
|
#define OPTION_NO_PLT_STATIC_CHAIN (OPTION_PLT_STATIC_CHAIN + 1)
|
2012-01-11 09:28:45 +00:00
|
|
|
#define OPTION_PLT_THREAD_SAFE (OPTION_NO_PLT_STATIC_CHAIN + 1)
|
|
|
|
#define OPTION_NO_PLT_THREAD_SAFE (OPTION_PLT_THREAD_SAFE + 1)
|
|
|
|
#define OPTION_PLT_ALIGN (OPTION_NO_PLT_THREAD_SAFE + 1)
|
|
|
|
#define OPTION_NO_PLT_ALIGN (OPTION_PLT_ALIGN + 1)
|
|
|
|
#define OPTION_STUBSYMS (OPTION_NO_PLT_ALIGN + 1)
|
2009-10-02 15:00:30 +00:00
|
|
|
#define OPTION_NO_STUBSYMS (OPTION_STUBSYMS + 1)
|
2014-02-19 03:53:12 +00:00
|
|
|
#define OPTION_SAVRES (OPTION_NO_STUBSYMS + 1)
|
|
|
|
#define OPTION_NO_SAVRES (OPTION_SAVRES + 1)
|
|
|
|
#define OPTION_DOTSYMS (OPTION_NO_SAVRES + 1)
|
2002-05-22 09:04:48 +00:00
|
|
|
#define OPTION_NO_DOTSYMS (OPTION_DOTSYMS + 1)
|
2003-02-09 04:36:44 +00:00
|
|
|
#define OPTION_NO_TLS_OPT (OPTION_NO_DOTSYMS + 1)
|
include/elf/
* ppc.h (DT_PPC_TLSOPT): Define.
* ppc64.h (DT_PPC64_TLSOPT): Define.
bfd/
* elf32-ppc.c (TLS_GET_ADDR_GLINK_SIZE): Define.
(ADD_3_12_2, BEQLR, CMPWI_11_0, LWZ_11_3, LWZ_12_3): Define.
(MR_0_3, MR_3_0): Define.
(struct ppc_elf_link_hash_table): Add no_tls_get_addr_opt.
(ppc_elf_select_plt_layout): Save emit_stub_syms param earlier.
(ppc_elf_tls_setup): Add no_tls_get_addr_opt param and save to hash
table. Check for presense of __tls_get_addr_opt
(allocate_dynrelocs): Increase glink entry size for __tls_get_addr.
(ppc_elf_size_dynamic_sections): Add DT_PPC_TLS_OPT tag.
(write_glink_stub): Add param p.
(ppc_elf_relocate_section): Adjust write_glink_stub call.
(ppc_elf_finish_dynamic_symbol): Emit special glink call stub for
__tls_get_addr.
* elf32-ppc.h (ppc_elf_tls_setup): Update prototype.
* elf64-ppc.c (struct ppc_link_hash_table): Add no_tls_get_addr_opt.
(ppc64_elf_tls_setup): Add no_tls_get_addr_opt param and save to hash
table. Check for presense of __tls_get_addr_opt.
(ppc64_elf_size_dynamic_sections): Add DT_PPC64_TLS_OPT tag.
(LD_R11_0R3, LD_R12_0R3, MR_R0_R3, CMPDI_R11_0, ADD_R3_R12_R13,
BEQLR, MR_R3_R0, MFLR_R11, STD_R11_0R1, BCTRL, LD_R11_0R1,
LD_R2_0R1, MTLR_R11): Define.
(build_tls_get_addr_stub): New function.
(ppc_build_one_stub): Call it.
(ppc_size_one_stub): Add extra size for __tls_get_addr stub.
(ppc64_elf_relocate_section): Don't change nop to ld 2,40(1) for
__tls_get_addr plt call.
* elf64-ppc.h (ppc64_elf_tls_setup): Update prototype.
binutils/
* readelf.c (get_ppc_dynamic_type): Add TLSOPT.
(get_ppc64_dynamic_type): Likewise.
ld/
* emultempl/ppc32elf.em (no_tls_get_addr_opt): New var.
(ppc_before_allocation): Pass to ppc_elf_tls_setup.
(OPTION_NO_TLS_GET_ADDR_OPT): Define. Redefine other options in
terms of previous option.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add
--no-tls-get-addr-optimize.
(PARSE_AND_LIST_ARGS_CASES): Handle it.
* emultempl/ppc64elf.em (no_tls_get_addr_opt): New var.
(ppc_before_allocation): Pass to ppc64_elf_tls_setup.
(OPTION_NO_TLS_GET_ADDR_OPT): Define.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add
--no-tls-get-addr-optimize.
(PARSE_AND_LIST_ARGS_CASES): Handle it.
ld/testsuite/
* ld-powerpc/tlslib.s: Delete dot-symbol entry syms. Add
__tls_get_addr_opt.
* ld-powerpc/tlslib32.s: Add __tls_get_addr_opt.
* ld-powerpc/oldtlslib.s: New file, old-abi version of tlslib.s.
* ld-powerpc/powerpc.exp: Build old-abi library and use it in
two new link tests.
* ld-powerpc/tlsexe.d: Update for new __tls_get_addr stub.
* ld-powerpc/tlsexe.g, * ld-powerpc/tlsexe.r, *ld-powerpc/tlsexe32.d,
* ld-powerpc/tlsexe32.g, * ld-powerpc/tlsexe32.r,
* ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g,
* ld-powerpc/tlsexetoc.r: Likewise.
2009-09-21 11:51:02 +00:00
|
|
|
#define OPTION_NO_TLS_GET_ADDR_OPT (OPTION_NO_TLS_OPT + 1)
|
|
|
|
#define OPTION_NO_OPD_OPT (OPTION_NO_TLS_GET_ADDR_OPT + 1)
|
2004-11-04 11:55:13 +00:00
|
|
|
#define OPTION_NO_TOC_OPT (OPTION_NO_OPD_OPT + 1)
|
2005-01-06 09:03:56 +00:00
|
|
|
#define OPTION_NO_MULTI_TOC (OPTION_NO_TOC_OPT + 1)
|
2010-03-15 02:03:00 +00:00
|
|
|
#define OPTION_NO_TOC_SORT (OPTION_NO_MULTI_TOC + 1)
|
|
|
|
#define OPTION_NON_OVERLAPPING_OPD (OPTION_NO_TOC_SORT + 1)
|
2002-05-01 02:34:54 +00:00
|
|
|
'
|
|
|
|
|
2011-07-26 01:57:18 +00:00
|
|
|
PARSE_AND_LIST_LONGOPTS=${PARSE_AND_LIST_LONGOPTS}'
|
2002-05-01 02:34:54 +00:00
|
|
|
{ "stub-group-size", required_argument, NULL, OPTION_STUBGROUP_SIZE },
|
bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add plt_static_chain.
(build_plt_stub): Add plt_static_chain param, don't load r11 if false.
(build_tls_get_addr_stub): Likewise.
(ppc_build_one_stub): Update calls to above.
(ppc_size_one_stub): Adjust stub size.
(ppc64_elf_size_stubs): Add plt_static_chain param, save to htab.
* elf64-ppc.h (ppc64_elf_size_stubs): Update prototype.
ld/
* emultempl/ppc64elf.em (plt_static_chain): New var.
(gld${EMULATION_NAME}_after_allocation): Pass to ppc64_elf_size_stubs.
(PARSE_AND_LIST_PROLOGUE, PARSE_AND_LIST_LONGOPTS,
PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Handle
--plt-static-chain and --no-plt-static-chain.
ld/testsuite/
* ld-powerpc/tlsexe.d, * ld-powerpc/tlsexe.g. *ld-powerpc/tlsexe.r,
* ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g,
* ld-powerpc/tlsexetoc.r, * ld-powerpc/tlsso.d,
* ld-powerpc/tlstocso.d: Update for plt stub change.
2011-07-14 03:28:22 +00:00
|
|
|
{ "plt-static-chain", no_argument, NULL, OPTION_PLT_STATIC_CHAIN },
|
|
|
|
{ "no-plt-static-chain", no_argument, NULL, OPTION_NO_PLT_STATIC_CHAIN },
|
2012-01-11 09:28:45 +00:00
|
|
|
{ "plt-thread-safe", no_argument, NULL, OPTION_PLT_THREAD_SAFE },
|
|
|
|
{ "no-plt-thread-safe", no_argument, NULL, OPTION_NO_PLT_THREAD_SAFE },
|
|
|
|
{ "plt-align", optional_argument, NULL, OPTION_PLT_ALIGN },
|
|
|
|
{ "no-plt-align", no_argument, NULL, OPTION_NO_PLT_ALIGN },
|
2003-06-08 14:07:34 +00:00
|
|
|
{ "emit-stub-syms", no_argument, NULL, OPTION_STUBSYMS },
|
2009-10-02 15:00:30 +00:00
|
|
|
{ "no-emit-stub-syms", no_argument, NULL, OPTION_NO_STUBSYMS },
|
2002-05-22 09:04:48 +00:00
|
|
|
{ "dotsyms", no_argument, NULL, OPTION_DOTSYMS },
|
|
|
|
{ "no-dotsyms", no_argument, NULL, OPTION_NO_DOTSYMS },
|
2014-02-19 03:53:12 +00:00
|
|
|
{ "save-restore-funcs", no_argument, NULL, OPTION_SAVRES },
|
|
|
|
{ "no-save-restore-funcs", no_argument, NULL, OPTION_NO_SAVRES },
|
2003-02-09 04:36:44 +00:00
|
|
|
{ "no-tls-optimize", no_argument, NULL, OPTION_NO_TLS_OPT },
|
include/elf/
* ppc.h (DT_PPC_TLSOPT): Define.
* ppc64.h (DT_PPC64_TLSOPT): Define.
bfd/
* elf32-ppc.c (TLS_GET_ADDR_GLINK_SIZE): Define.
(ADD_3_12_2, BEQLR, CMPWI_11_0, LWZ_11_3, LWZ_12_3): Define.
(MR_0_3, MR_3_0): Define.
(struct ppc_elf_link_hash_table): Add no_tls_get_addr_opt.
(ppc_elf_select_plt_layout): Save emit_stub_syms param earlier.
(ppc_elf_tls_setup): Add no_tls_get_addr_opt param and save to hash
table. Check for presense of __tls_get_addr_opt
(allocate_dynrelocs): Increase glink entry size for __tls_get_addr.
(ppc_elf_size_dynamic_sections): Add DT_PPC_TLS_OPT tag.
(write_glink_stub): Add param p.
(ppc_elf_relocate_section): Adjust write_glink_stub call.
(ppc_elf_finish_dynamic_symbol): Emit special glink call stub for
__tls_get_addr.
* elf32-ppc.h (ppc_elf_tls_setup): Update prototype.
* elf64-ppc.c (struct ppc_link_hash_table): Add no_tls_get_addr_opt.
(ppc64_elf_tls_setup): Add no_tls_get_addr_opt param and save to hash
table. Check for presense of __tls_get_addr_opt.
(ppc64_elf_size_dynamic_sections): Add DT_PPC64_TLS_OPT tag.
(LD_R11_0R3, LD_R12_0R3, MR_R0_R3, CMPDI_R11_0, ADD_R3_R12_R13,
BEQLR, MR_R3_R0, MFLR_R11, STD_R11_0R1, BCTRL, LD_R11_0R1,
LD_R2_0R1, MTLR_R11): Define.
(build_tls_get_addr_stub): New function.
(ppc_build_one_stub): Call it.
(ppc_size_one_stub): Add extra size for __tls_get_addr stub.
(ppc64_elf_relocate_section): Don't change nop to ld 2,40(1) for
__tls_get_addr plt call.
* elf64-ppc.h (ppc64_elf_tls_setup): Update prototype.
binutils/
* readelf.c (get_ppc_dynamic_type): Add TLSOPT.
(get_ppc64_dynamic_type): Likewise.
ld/
* emultempl/ppc32elf.em (no_tls_get_addr_opt): New var.
(ppc_before_allocation): Pass to ppc_elf_tls_setup.
(OPTION_NO_TLS_GET_ADDR_OPT): Define. Redefine other options in
terms of previous option.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add
--no-tls-get-addr-optimize.
(PARSE_AND_LIST_ARGS_CASES): Handle it.
* emultempl/ppc64elf.em (no_tls_get_addr_opt): New var.
(ppc_before_allocation): Pass to ppc64_elf_tls_setup.
(OPTION_NO_TLS_GET_ADDR_OPT): Define.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add
--no-tls-get-addr-optimize.
(PARSE_AND_LIST_ARGS_CASES): Handle it.
ld/testsuite/
* ld-powerpc/tlslib.s: Delete dot-symbol entry syms. Add
__tls_get_addr_opt.
* ld-powerpc/tlslib32.s: Add __tls_get_addr_opt.
* ld-powerpc/oldtlslib.s: New file, old-abi version of tlslib.s.
* ld-powerpc/powerpc.exp: Build old-abi library and use it in
two new link tests.
* ld-powerpc/tlsexe.d: Update for new __tls_get_addr stub.
* ld-powerpc/tlsexe.g, * ld-powerpc/tlsexe.r, *ld-powerpc/tlsexe32.d,
* ld-powerpc/tlsexe32.g, * ld-powerpc/tlsexe32.r,
* ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g,
* ld-powerpc/tlsexetoc.r: Likewise.
2009-09-21 11:51:02 +00:00
|
|
|
{ "no-tls-get-addr-optimize", no_argument, NULL, OPTION_NO_TLS_GET_ADDR_OPT },
|
2004-11-04 11:55:13 +00:00
|
|
|
{ "no-opd-optimize", no_argument, NULL, OPTION_NO_OPD_OPT },
|
|
|
|
{ "no-toc-optimize", no_argument, NULL, OPTION_NO_TOC_OPT },
|
2005-01-06 09:03:56 +00:00
|
|
|
{ "no-multi-toc", no_argument, NULL, OPTION_NO_MULTI_TOC },
|
2010-03-15 02:03:00 +00:00
|
|
|
{ "no-toc-sort", no_argument, NULL, OPTION_NO_TOC_SORT },
|
2004-08-19 07:47:25 +00:00
|
|
|
{ "non-overlapping-opd", no_argument, NULL, OPTION_NON_OVERLAPPING_OPD },
|
2002-05-01 02:34:54 +00:00
|
|
|
'
|
|
|
|
|
2011-07-26 01:57:18 +00:00
|
|
|
PARSE_AND_LIST_OPTIONS=${PARSE_AND_LIST_OPTIONS}'
|
2002-05-01 02:34:54 +00:00
|
|
|
fprintf (file, _("\
|
2007-08-17 13:50:48 +00:00
|
|
|
--stub-group-size=N Maximum size of a group of input sections that\n\
|
|
|
|
can be handled by one stub section. A negative\n\
|
|
|
|
value locates all stubs before their branches\n\
|
|
|
|
(with a group size of -N), while a positive\n\
|
|
|
|
value allows two groups of input sections, one\n\
|
|
|
|
before, and one after each stub section.\n\
|
|
|
|
Values of +/-1 indicate the linker should\n\
|
|
|
|
choose suitable defaults.\n"
|
2002-05-01 02:34:54 +00:00
|
|
|
));
|
2002-05-22 09:04:48 +00:00
|
|
|
fprintf (file, _("\
|
2012-01-11 09:28:45 +00:00
|
|
|
--plt-static-chain PLT call stubs should load r11.${DEFAULT_PLT_STATIC_CHAIN- (default)}\n"
|
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
|
|
|
--no-plt-static-chain PLT call stubs should not load r11.${DEFAULT_PLT_STATIC_CHAIN+ (default)}\n"
|
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
|
|
|
--plt-thread-safe PLT call stubs with load-load barrier.\n"
|
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
|
|
|
--no-plt-thread-safe PLT call stubs without barrier.\n"
|
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
|
|
|
--plt-align [=<align>] Align PLT call stubs to fit cache lines.\n"
|
bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add plt_static_chain.
(build_plt_stub): Add plt_static_chain param, don't load r11 if false.
(build_tls_get_addr_stub): Likewise.
(ppc_build_one_stub): Update calls to above.
(ppc_size_one_stub): Adjust stub size.
(ppc64_elf_size_stubs): Add plt_static_chain param, save to htab.
* elf64-ppc.h (ppc64_elf_size_stubs): Update prototype.
ld/
* emultempl/ppc64elf.em (plt_static_chain): New var.
(gld${EMULATION_NAME}_after_allocation): Pass to ppc64_elf_size_stubs.
(PARSE_AND_LIST_PROLOGUE, PARSE_AND_LIST_LONGOPTS,
PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Handle
--plt-static-chain and --no-plt-static-chain.
ld/testsuite/
* ld-powerpc/tlsexe.d, * ld-powerpc/tlsexe.g. *ld-powerpc/tlsexe.r,
* ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g,
* ld-powerpc/tlsexetoc.r, * ld-powerpc/tlsso.d,
* ld-powerpc/tlstocso.d: Update for plt stub change.
2011-07-14 03:28:22 +00:00
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
2012-01-11 09:28:45 +00:00
|
|
|
--no-plt-align Dont'\''t align individual PLT call stubs.\n"
|
bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add plt_static_chain.
(build_plt_stub): Add plt_static_chain param, don't load r11 if false.
(build_tls_get_addr_stub): Likewise.
(ppc_build_one_stub): Update calls to above.
(ppc_size_one_stub): Adjust stub size.
(ppc64_elf_size_stubs): Add plt_static_chain param, save to htab.
* elf64-ppc.h (ppc64_elf_size_stubs): Update prototype.
ld/
* emultempl/ppc64elf.em (plt_static_chain): New var.
(gld${EMULATION_NAME}_after_allocation): Pass to ppc64_elf_size_stubs.
(PARSE_AND_LIST_PROLOGUE, PARSE_AND_LIST_LONGOPTS,
PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Handle
--plt-static-chain and --no-plt-static-chain.
ld/testsuite/
* ld-powerpc/tlsexe.d, * ld-powerpc/tlsexe.g. *ld-powerpc/tlsexe.r,
* ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g,
* ld-powerpc/tlsexetoc.r, * ld-powerpc/tlsso.d,
* ld-powerpc/tlstocso.d: Update for plt stub change.
2011-07-14 03:28:22 +00:00
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
2007-08-17 13:50:48 +00:00
|
|
|
--emit-stub-syms Label linker stubs with a symbol.\n"
|
2003-06-08 14:07:34 +00:00
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
2009-10-02 15:00:30 +00:00
|
|
|
--no-emit-stub-syms Don'\''t label linker stubs with a symbol.\n"
|
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
2007-08-17 13:50:48 +00:00
|
|
|
--dotsyms For every version pattern \"foo\" in a version\n\
|
|
|
|
script, add \".foo\" so that function code\n\
|
|
|
|
symbols are treated the same as function\n\
|
|
|
|
descriptor symbols. Defaults to on.\n"
|
2002-05-22 09:04:48 +00:00
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
2007-08-17 13:50:48 +00:00
|
|
|
--no-dotsyms Don'\''t do anything special in version scripts.\n"
|
2002-05-22 09:04:48 +00:00
|
|
|
));
|
2003-02-09 04:36:44 +00:00
|
|
|
fprintf (file, _("\
|
2014-02-19 03:53:12 +00:00
|
|
|
--save-restore-funcs Provide register save and restore routines used\n\
|
|
|
|
by gcc -Os code. Defaults to on for normal\n\
|
|
|
|
final link, off for ld -r.\n"
|
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
|
|
|
--no-save-restore-funcs Don'\''t provide these routines.\n"
|
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
2007-08-17 13:50:48 +00:00
|
|
|
--no-tls-optimize Don'\''t try to optimize TLS accesses.\n"
|
2003-02-09 04:36:44 +00:00
|
|
|
));
|
2004-08-19 07:47:25 +00:00
|
|
|
fprintf (file, _("\
|
include/elf/
* ppc.h (DT_PPC_TLSOPT): Define.
* ppc64.h (DT_PPC64_TLSOPT): Define.
bfd/
* elf32-ppc.c (TLS_GET_ADDR_GLINK_SIZE): Define.
(ADD_3_12_2, BEQLR, CMPWI_11_0, LWZ_11_3, LWZ_12_3): Define.
(MR_0_3, MR_3_0): Define.
(struct ppc_elf_link_hash_table): Add no_tls_get_addr_opt.
(ppc_elf_select_plt_layout): Save emit_stub_syms param earlier.
(ppc_elf_tls_setup): Add no_tls_get_addr_opt param and save to hash
table. Check for presense of __tls_get_addr_opt
(allocate_dynrelocs): Increase glink entry size for __tls_get_addr.
(ppc_elf_size_dynamic_sections): Add DT_PPC_TLS_OPT tag.
(write_glink_stub): Add param p.
(ppc_elf_relocate_section): Adjust write_glink_stub call.
(ppc_elf_finish_dynamic_symbol): Emit special glink call stub for
__tls_get_addr.
* elf32-ppc.h (ppc_elf_tls_setup): Update prototype.
* elf64-ppc.c (struct ppc_link_hash_table): Add no_tls_get_addr_opt.
(ppc64_elf_tls_setup): Add no_tls_get_addr_opt param and save to hash
table. Check for presense of __tls_get_addr_opt.
(ppc64_elf_size_dynamic_sections): Add DT_PPC64_TLS_OPT tag.
(LD_R11_0R3, LD_R12_0R3, MR_R0_R3, CMPDI_R11_0, ADD_R3_R12_R13,
BEQLR, MR_R3_R0, MFLR_R11, STD_R11_0R1, BCTRL, LD_R11_0R1,
LD_R2_0R1, MTLR_R11): Define.
(build_tls_get_addr_stub): New function.
(ppc_build_one_stub): Call it.
(ppc_size_one_stub): Add extra size for __tls_get_addr stub.
(ppc64_elf_relocate_section): Don't change nop to ld 2,40(1) for
__tls_get_addr plt call.
* elf64-ppc.h (ppc64_elf_tls_setup): Update prototype.
binutils/
* readelf.c (get_ppc_dynamic_type): Add TLSOPT.
(get_ppc64_dynamic_type): Likewise.
ld/
* emultempl/ppc32elf.em (no_tls_get_addr_opt): New var.
(ppc_before_allocation): Pass to ppc_elf_tls_setup.
(OPTION_NO_TLS_GET_ADDR_OPT): Define. Redefine other options in
terms of previous option.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add
--no-tls-get-addr-optimize.
(PARSE_AND_LIST_ARGS_CASES): Handle it.
* emultempl/ppc64elf.em (no_tls_get_addr_opt): New var.
(ppc_before_allocation): Pass to ppc64_elf_tls_setup.
(OPTION_NO_TLS_GET_ADDR_OPT): Define.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add
--no-tls-get-addr-optimize.
(PARSE_AND_LIST_ARGS_CASES): Handle it.
ld/testsuite/
* ld-powerpc/tlslib.s: Delete dot-symbol entry syms. Add
__tls_get_addr_opt.
* ld-powerpc/tlslib32.s: Add __tls_get_addr_opt.
* ld-powerpc/oldtlslib.s: New file, old-abi version of tlslib.s.
* ld-powerpc/powerpc.exp: Build old-abi library and use it in
two new link tests.
* ld-powerpc/tlsexe.d: Update for new __tls_get_addr stub.
* ld-powerpc/tlsexe.g, * ld-powerpc/tlsexe.r, *ld-powerpc/tlsexe32.d,
* ld-powerpc/tlsexe32.g, * ld-powerpc/tlsexe32.r,
* ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g,
* ld-powerpc/tlsexetoc.r: Likewise.
2009-09-21 11:51:02 +00:00
|
|
|
--no-tls-get-addr-optimize Don'\''t use a special __tls_get_addr call.\n"
|
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
2007-08-17 13:50:48 +00:00
|
|
|
--no-opd-optimize Don'\''t optimize the OPD section.\n"
|
2004-11-04 11:55:13 +00:00
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
2007-08-17 13:50:48 +00:00
|
|
|
--no-toc-optimize Don'\''t optimize the TOC section.\n"
|
2004-11-04 11:55:13 +00:00
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
2007-08-17 13:50:48 +00:00
|
|
|
--no-multi-toc Disallow automatic multiple toc sections.\n"
|
2005-01-06 09:03:56 +00:00
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
2010-03-15 02:03:00 +00:00
|
|
|
--no-toc-sort Don'\''t sort TOC and GOT sections.\n"
|
|
|
|
));
|
|
|
|
fprintf (file, _("\
|
2007-08-17 13:50:48 +00:00
|
|
|
--non-overlapping-opd Canonicalize .opd, so that there are no\n\
|
|
|
|
overlapping .opd entries.\n"
|
2004-08-19 07:47:25 +00:00
|
|
|
));
|
2002-05-01 02:34:54 +00:00
|
|
|
'
|
|
|
|
|
2011-07-26 01:57:18 +00:00
|
|
|
PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LIST_ARGS_CASES}'
|
2002-05-01 02:34:54 +00:00
|
|
|
case OPTION_STUBGROUP_SIZE:
|
|
|
|
{
|
|
|
|
const char *end;
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
params.group_size = bfd_scan_vma (optarg, &end, 0);
|
2002-05-01 02:34:54 +00:00
|
|
|
if (*end)
|
|
|
|
einfo (_("%P%F: invalid number `%s'\''\n"), optarg);
|
|
|
|
}
|
|
|
|
break;
|
2002-05-22 09:04:48 +00:00
|
|
|
|
bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add plt_static_chain.
(build_plt_stub): Add plt_static_chain param, don't load r11 if false.
(build_tls_get_addr_stub): Likewise.
(ppc_build_one_stub): Update calls to above.
(ppc_size_one_stub): Adjust stub size.
(ppc64_elf_size_stubs): Add plt_static_chain param, save to htab.
* elf64-ppc.h (ppc64_elf_size_stubs): Update prototype.
ld/
* emultempl/ppc64elf.em (plt_static_chain): New var.
(gld${EMULATION_NAME}_after_allocation): Pass to ppc64_elf_size_stubs.
(PARSE_AND_LIST_PROLOGUE, PARSE_AND_LIST_LONGOPTS,
PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Handle
--plt-static-chain and --no-plt-static-chain.
ld/testsuite/
* ld-powerpc/tlsexe.d, * ld-powerpc/tlsexe.g. *ld-powerpc/tlsexe.r,
* ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g,
* ld-powerpc/tlsexetoc.r, * ld-powerpc/tlsso.d,
* ld-powerpc/tlstocso.d: Update for plt stub change.
2011-07-14 03:28:22 +00:00
|
|
|
case OPTION_PLT_STATIC_CHAIN:
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
params.plt_static_chain = 1;
|
bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add plt_static_chain.
(build_plt_stub): Add plt_static_chain param, don't load r11 if false.
(build_tls_get_addr_stub): Likewise.
(ppc_build_one_stub): Update calls to above.
(ppc_size_one_stub): Adjust stub size.
(ppc64_elf_size_stubs): Add plt_static_chain param, save to htab.
* elf64-ppc.h (ppc64_elf_size_stubs): Update prototype.
ld/
* emultempl/ppc64elf.em (plt_static_chain): New var.
(gld${EMULATION_NAME}_after_allocation): Pass to ppc64_elf_size_stubs.
(PARSE_AND_LIST_PROLOGUE, PARSE_AND_LIST_LONGOPTS,
PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Handle
--plt-static-chain and --no-plt-static-chain.
ld/testsuite/
* ld-powerpc/tlsexe.d, * ld-powerpc/tlsexe.g. *ld-powerpc/tlsexe.r,
* ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g,
* ld-powerpc/tlsexetoc.r, * ld-powerpc/tlsso.d,
* ld-powerpc/tlstocso.d: Update for plt stub change.
2011-07-14 03:28:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OPTION_NO_PLT_STATIC_CHAIN:
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
params.plt_static_chain = 0;
|
bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add plt_static_chain.
(build_plt_stub): Add plt_static_chain param, don't load r11 if false.
(build_tls_get_addr_stub): Likewise.
(ppc_build_one_stub): Update calls to above.
(ppc_size_one_stub): Adjust stub size.
(ppc64_elf_size_stubs): Add plt_static_chain param, save to htab.
* elf64-ppc.h (ppc64_elf_size_stubs): Update prototype.
ld/
* emultempl/ppc64elf.em (plt_static_chain): New var.
(gld${EMULATION_NAME}_after_allocation): Pass to ppc64_elf_size_stubs.
(PARSE_AND_LIST_PROLOGUE, PARSE_AND_LIST_LONGOPTS,
PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Handle
--plt-static-chain and --no-plt-static-chain.
ld/testsuite/
* ld-powerpc/tlsexe.d, * ld-powerpc/tlsexe.g. *ld-powerpc/tlsexe.r,
* ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g,
* ld-powerpc/tlsexetoc.r, * ld-powerpc/tlsso.d,
* ld-powerpc/tlstocso.d: Update for plt stub change.
2011-07-14 03:28:22 +00:00
|
|
|
break;
|
|
|
|
|
2012-01-11 09:28:45 +00:00
|
|
|
case OPTION_PLT_THREAD_SAFE:
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
params.plt_thread_safe = 1;
|
2012-01-11 09:28:45 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OPTION_NO_PLT_THREAD_SAFE:
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
params.plt_thread_safe = 0;
|
2012-01-11 09:28:45 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OPTION_PLT_ALIGN:
|
|
|
|
if (optarg != NULL)
|
|
|
|
{
|
|
|
|
char *end;
|
|
|
|
unsigned long val = strtoul (optarg, &end, 0);
|
|
|
|
if (*end || val > 8)
|
|
|
|
einfo (_("%P%F: invalid --plt-align `%s'\''\n"), optarg);
|
2014-11-24 02:11:33 +00:00
|
|
|
params.plt_stub_align = val;
|
2012-01-11 09:28:45 +00:00
|
|
|
}
|
|
|
|
else
|
2014-11-24 02:11:33 +00:00
|
|
|
params.plt_stub_align = 5;
|
2012-01-11 09:28:45 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OPTION_NO_PLT_ALIGN:
|
2014-11-24 02:11:33 +00:00
|
|
|
params.plt_stub_align = 0;
|
2012-01-11 09:28:45 +00:00
|
|
|
break;
|
|
|
|
|
2003-06-08 14:07:34 +00:00
|
|
|
case OPTION_STUBSYMS:
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
params.emit_stub_syms = 1;
|
2003-06-08 14:07:34 +00:00
|
|
|
break;
|
|
|
|
|
2009-10-02 15:00:30 +00:00
|
|
|
case OPTION_NO_STUBSYMS:
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
params.emit_stub_syms = 0;
|
2009-10-02 15:00:30 +00:00
|
|
|
break;
|
|
|
|
|
2002-05-22 09:04:48 +00:00
|
|
|
case OPTION_DOTSYMS:
|
2003-02-09 04:36:44 +00:00
|
|
|
dotsyms = 1;
|
2002-05-22 09:04:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OPTION_NO_DOTSYMS:
|
2003-02-09 04:36:44 +00:00
|
|
|
dotsyms = 0;
|
|
|
|
break;
|
|
|
|
|
2014-02-19 03:53:12 +00:00
|
|
|
case OPTION_SAVRES:
|
|
|
|
params.save_restore_funcs = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPTION_NO_SAVRES:
|
|
|
|
params.save_restore_funcs = 0;
|
|
|
|
break;
|
|
|
|
|
2003-02-09 04:36:44 +00:00
|
|
|
case OPTION_NO_TLS_OPT:
|
2004-11-04 11:55:13 +00:00
|
|
|
no_tls_opt = 1;
|
|
|
|
break;
|
|
|
|
|
include/elf/
* ppc.h (DT_PPC_TLSOPT): Define.
* ppc64.h (DT_PPC64_TLSOPT): Define.
bfd/
* elf32-ppc.c (TLS_GET_ADDR_GLINK_SIZE): Define.
(ADD_3_12_2, BEQLR, CMPWI_11_0, LWZ_11_3, LWZ_12_3): Define.
(MR_0_3, MR_3_0): Define.
(struct ppc_elf_link_hash_table): Add no_tls_get_addr_opt.
(ppc_elf_select_plt_layout): Save emit_stub_syms param earlier.
(ppc_elf_tls_setup): Add no_tls_get_addr_opt param and save to hash
table. Check for presense of __tls_get_addr_opt
(allocate_dynrelocs): Increase glink entry size for __tls_get_addr.
(ppc_elf_size_dynamic_sections): Add DT_PPC_TLS_OPT tag.
(write_glink_stub): Add param p.
(ppc_elf_relocate_section): Adjust write_glink_stub call.
(ppc_elf_finish_dynamic_symbol): Emit special glink call stub for
__tls_get_addr.
* elf32-ppc.h (ppc_elf_tls_setup): Update prototype.
* elf64-ppc.c (struct ppc_link_hash_table): Add no_tls_get_addr_opt.
(ppc64_elf_tls_setup): Add no_tls_get_addr_opt param and save to hash
table. Check for presense of __tls_get_addr_opt.
(ppc64_elf_size_dynamic_sections): Add DT_PPC64_TLS_OPT tag.
(LD_R11_0R3, LD_R12_0R3, MR_R0_R3, CMPDI_R11_0, ADD_R3_R12_R13,
BEQLR, MR_R3_R0, MFLR_R11, STD_R11_0R1, BCTRL, LD_R11_0R1,
LD_R2_0R1, MTLR_R11): Define.
(build_tls_get_addr_stub): New function.
(ppc_build_one_stub): Call it.
(ppc_size_one_stub): Add extra size for __tls_get_addr stub.
(ppc64_elf_relocate_section): Don't change nop to ld 2,40(1) for
__tls_get_addr plt call.
* elf64-ppc.h (ppc64_elf_tls_setup): Update prototype.
binutils/
* readelf.c (get_ppc_dynamic_type): Add TLSOPT.
(get_ppc64_dynamic_type): Likewise.
ld/
* emultempl/ppc32elf.em (no_tls_get_addr_opt): New var.
(ppc_before_allocation): Pass to ppc_elf_tls_setup.
(OPTION_NO_TLS_GET_ADDR_OPT): Define. Redefine other options in
terms of previous option.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add
--no-tls-get-addr-optimize.
(PARSE_AND_LIST_ARGS_CASES): Handle it.
* emultempl/ppc64elf.em (no_tls_get_addr_opt): New var.
(ppc_before_allocation): Pass to ppc64_elf_tls_setup.
(OPTION_NO_TLS_GET_ADDR_OPT): Define.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add
--no-tls-get-addr-optimize.
(PARSE_AND_LIST_ARGS_CASES): Handle it.
ld/testsuite/
* ld-powerpc/tlslib.s: Delete dot-symbol entry syms. Add
__tls_get_addr_opt.
* ld-powerpc/tlslib32.s: Add __tls_get_addr_opt.
* ld-powerpc/oldtlslib.s: New file, old-abi version of tlslib.s.
* ld-powerpc/powerpc.exp: Build old-abi library and use it in
two new link tests.
* ld-powerpc/tlsexe.d: Update for new __tls_get_addr stub.
* ld-powerpc/tlsexe.g, * ld-powerpc/tlsexe.r, *ld-powerpc/tlsexe32.d,
* ld-powerpc/tlsexe32.g, * ld-powerpc/tlsexe32.r,
* ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g,
* ld-powerpc/tlsexetoc.r: Likewise.
2009-09-21 11:51:02 +00:00
|
|
|
case OPTION_NO_TLS_GET_ADDR_OPT:
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
params.no_tls_get_addr_opt = 1;
|
include/elf/
* ppc.h (DT_PPC_TLSOPT): Define.
* ppc64.h (DT_PPC64_TLSOPT): Define.
bfd/
* elf32-ppc.c (TLS_GET_ADDR_GLINK_SIZE): Define.
(ADD_3_12_2, BEQLR, CMPWI_11_0, LWZ_11_3, LWZ_12_3): Define.
(MR_0_3, MR_3_0): Define.
(struct ppc_elf_link_hash_table): Add no_tls_get_addr_opt.
(ppc_elf_select_plt_layout): Save emit_stub_syms param earlier.
(ppc_elf_tls_setup): Add no_tls_get_addr_opt param and save to hash
table. Check for presense of __tls_get_addr_opt
(allocate_dynrelocs): Increase glink entry size for __tls_get_addr.
(ppc_elf_size_dynamic_sections): Add DT_PPC_TLS_OPT tag.
(write_glink_stub): Add param p.
(ppc_elf_relocate_section): Adjust write_glink_stub call.
(ppc_elf_finish_dynamic_symbol): Emit special glink call stub for
__tls_get_addr.
* elf32-ppc.h (ppc_elf_tls_setup): Update prototype.
* elf64-ppc.c (struct ppc_link_hash_table): Add no_tls_get_addr_opt.
(ppc64_elf_tls_setup): Add no_tls_get_addr_opt param and save to hash
table. Check for presense of __tls_get_addr_opt.
(ppc64_elf_size_dynamic_sections): Add DT_PPC64_TLS_OPT tag.
(LD_R11_0R3, LD_R12_0R3, MR_R0_R3, CMPDI_R11_0, ADD_R3_R12_R13,
BEQLR, MR_R3_R0, MFLR_R11, STD_R11_0R1, BCTRL, LD_R11_0R1,
LD_R2_0R1, MTLR_R11): Define.
(build_tls_get_addr_stub): New function.
(ppc_build_one_stub): Call it.
(ppc_size_one_stub): Add extra size for __tls_get_addr stub.
(ppc64_elf_relocate_section): Don't change nop to ld 2,40(1) for
__tls_get_addr plt call.
* elf64-ppc.h (ppc64_elf_tls_setup): Update prototype.
binutils/
* readelf.c (get_ppc_dynamic_type): Add TLSOPT.
(get_ppc64_dynamic_type): Likewise.
ld/
* emultempl/ppc32elf.em (no_tls_get_addr_opt): New var.
(ppc_before_allocation): Pass to ppc_elf_tls_setup.
(OPTION_NO_TLS_GET_ADDR_OPT): Define. Redefine other options in
terms of previous option.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add
--no-tls-get-addr-optimize.
(PARSE_AND_LIST_ARGS_CASES): Handle it.
* emultempl/ppc64elf.em (no_tls_get_addr_opt): New var.
(ppc_before_allocation): Pass to ppc64_elf_tls_setup.
(OPTION_NO_TLS_GET_ADDR_OPT): Define.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add
--no-tls-get-addr-optimize.
(PARSE_AND_LIST_ARGS_CASES): Handle it.
ld/testsuite/
* ld-powerpc/tlslib.s: Delete dot-symbol entry syms. Add
__tls_get_addr_opt.
* ld-powerpc/tlslib32.s: Add __tls_get_addr_opt.
* ld-powerpc/oldtlslib.s: New file, old-abi version of tlslib.s.
* ld-powerpc/powerpc.exp: Build old-abi library and use it in
two new link tests.
* ld-powerpc/tlsexe.d: Update for new __tls_get_addr stub.
* ld-powerpc/tlsexe.g, * ld-powerpc/tlsexe.r, *ld-powerpc/tlsexe32.d,
* ld-powerpc/tlsexe32.g, * ld-powerpc/tlsexe32.r,
* ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g,
* ld-powerpc/tlsexetoc.r: Likewise.
2009-09-21 11:51:02 +00:00
|
|
|
break;
|
|
|
|
|
2004-11-04 11:55:13 +00:00
|
|
|
case OPTION_NO_OPD_OPT:
|
|
|
|
no_opd_opt = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPTION_NO_TOC_OPT:
|
|
|
|
no_toc_opt = 1;
|
2002-05-22 09:04:48 +00:00
|
|
|
break;
|
2004-08-19 07:47:25 +00:00
|
|
|
|
2005-01-06 09:03:56 +00:00
|
|
|
case OPTION_NO_MULTI_TOC:
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
params.no_multi_toc = 1;
|
2005-01-06 09:03:56 +00:00
|
|
|
break;
|
|
|
|
|
2010-03-15 02:03:00 +00:00
|
|
|
case OPTION_NO_TOC_SORT:
|
|
|
|
no_toc_sort = 1;
|
|
|
|
break;
|
|
|
|
|
2004-08-19 07:47:25 +00:00
|
|
|
case OPTION_NON_OVERLAPPING_OPD:
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
params.non_overlapping_opd = 1;
|
2004-08-19 07:47:25 +00:00
|
|
|
break;
|
2012-05-26 11:13:20 +00:00
|
|
|
|
|
|
|
case OPTION_TRADITIONAL_FORMAT:
|
|
|
|
no_tls_opt = 1;
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
params.no_tls_get_addr_opt = 1;
|
2012-05-26 11:13:20 +00:00
|
|
|
no_opd_opt = 1;
|
|
|
|
no_toc_opt = 1;
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
params.no_multi_toc = 1;
|
2012-05-26 11:13:20 +00:00
|
|
|
no_toc_sort = 1;
|
Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params. Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars. Adjust code throughout file.
2014-02-17 06:38:00 +00:00
|
|
|
params.plt_static_chain = 1;
|
2012-05-26 11:13:20 +00:00
|
|
|
return FALSE;
|
2002-05-01 02:34:54 +00:00
|
|
|
'
|
|
|
|
|
2002-01-16 05:52:38 +00:00
|
|
|
# Put these extra ppc64elf routines in ld_${EMULATION_NAME}_emulation
|
|
|
|
#
|
2015-01-27 13:10:05 +00:00
|
|
|
LDEMUL_NEW_VERS_PATTERN=gld${EMULATION_NAME}_new_vers_pattern
|
|
|
|
LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=ppc_create_output_section_statements
|
|
|
|
LDEMUL_AFTER_OPEN=ppc_after_open
|
2002-11-12 07:56:38 +00:00
|
|
|
LDEMUL_BEFORE_ALLOCATION=ppc_before_allocation
|
2002-01-16 05:52:38 +00:00
|
|
|
LDEMUL_AFTER_ALLOCATION=gld${EMULATION_NAME}_after_allocation
|
2006-06-20 02:22:16 +00:00
|
|
|
LDEMUL_FINISH=gld${EMULATION_NAME}_finish
|