aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2007-05-11 06:39:05 +0000
committerAlan Modra <amodra@gmail.com>2007-05-11 06:39:05 +0000
commit016687f8ba456b033639a2174da7a0fc35428eb8 (patch)
treea533ef04e5f97a7b5ee279a260d558bdc4b98907 /ld
parentece5ef60797fafabe50aae16758ecb33b033871d (diff)
downloadbinutils-016687f8ba456b033639a2174da7a0fc35428eb8.zip
binutils-016687f8ba456b033639a2174da7a0fc35428eb8.tar.gz
binutils-016687f8ba456b033639a2174da7a0fc35428eb8.tar.bz2
bfd/
* elf32-ppc.h (ppc_elf_select_plt_layout): Update prototype. (enum ppc_elf_plt_type): Move from.. * elf32-ppc.c: ..here. (struct ppc_elf_obj_tdata): Add makes_plt_call and has_rel16. (struct ppc_elf_link_hash_table): Reorder. Add old_bfd. Delete can_use_new_plt. Make is_vxworks a bitfield. (ppc_elf_link_hash_table_create): Don't clear is_vxworks (again). (ppc_elf_check_relocs): Update setting of reloc flags. Set old_bfd. (ppc_elf_select_plt_layout): Modify parameters. Use bfd reloc flags to better detect object files needing old bss-style plt. Allow secure plt to be used without rel16 relocs being detected. Warn if secure plt request cannot be allowed. ld/ * emultempl/ppc32elf.em (plt_style): New variable. (old_plt): Delete. (ppc_after_open): Adjust ppc_elf_select_plt_layout call. (PARSE_AND_LIST_PROLOGUE): Define OPTION_NEW_PLT, renumber OPTION_OLD_PLT, OPTION_OLD_GOT and OPTION_STUBSYMS. (PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add secure-plt. (PARSE_AND_LIST_ARGS_CASES): Handle OPTION_NEW_PLT. * ld.texinfo (--secure-plt): Document.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog11
-rw-r--r--ld/emultempl/ppc32elf.em21
-rw-r--r--ld/ld.texinfo8
3 files changed, 33 insertions, 7 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 3a7e751..6951481 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,14 @@
+2007-05-11 Alan Modra <amodra@bigpond.net.au>
+
+ * emultempl/ppc32elf.em (plt_style): New variable.
+ (old_plt): Delete.
+ (ppc_after_open): Adjust ppc_elf_select_plt_layout call.
+ (PARSE_AND_LIST_PROLOGUE): Define OPTION_NEW_PLT, renumber
+ OPTION_OLD_PLT, OPTION_OLD_GOT and OPTION_STUBSYMS.
+ (PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add secure-plt.
+ (PARSE_AND_LIST_ARGS_CASES): Handle OPTION_NEW_PLT.
+ * ld.texinfo (--secure-plt): Document.
+
2007-05-08 Alan Modra <amodra@bigpond.net.au>
* ld.h (args_type, ld_config_type): Reorder fields.
diff --git a/ld/emultempl/ppc32elf.em b/ld/emultempl/ppc32elf.em
index cee14c0..b0239e0 100644
--- a/ld/emultempl/ppc32elf.em
+++ b/ld/emultempl/ppc32elf.em
@@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2003, 2005 Free Software Foundation, Inc.
+# Copyright 2003, 2005, 2007 Free Software Foundation, Inc.
#
# This file is part of GLD, the Gnu Linker.
#
@@ -45,7 +45,7 @@ static int notlsopt = 0;
static int emit_stub_syms = 0;
/* Chooses the correct place for .plt and .got. */
-static int old_plt = 0;
+static enum ppc_elf_plt_type plt_style = PLT_UNSET;
static int old_got = 0;
static void
@@ -62,7 +62,7 @@ ppc_after_open (void)
lang_output_section_statement_type *got_os[2];
emit_stub_syms |= link_info.emitrelocations;
- new_plt = ppc_elf_select_plt_layout (output_bfd, &link_info, old_plt,
+ new_plt = ppc_elf_select_plt_layout (output_bfd, &link_info, plt_style,
emit_stub_syms);
if (new_plt < 0)
einfo ("%X%P: select_plt_layout problem %E\n");
@@ -148,14 +148,16 @@ fi
#
PARSE_AND_LIST_PROLOGUE='
#define OPTION_NO_TLS_OPT 301
-#define OPTION_OLD_PLT 302
-#define OPTION_OLD_GOT 303
-#define OPTION_STUBSYMS 304
+#define OPTION_NEW_PLT 302
+#define OPTION_OLD_PLT 303
+#define OPTION_OLD_GOT 304
+#define OPTION_STUBSYMS 305
'
PARSE_AND_LIST_LONGOPTS='
{ "emit-stub-syms", no_argument, NULL, OPTION_STUBSYMS },
{ "no-tls-optimize", no_argument, NULL, OPTION_NO_TLS_OPT },
+ { "secure-plt", no_argument, NULL, OPTION_NEW_PLT },
{ "bss-plt", no_argument, NULL, OPTION_OLD_PLT },
{ "sdata-got", no_argument, NULL, OPTION_OLD_GOT },
'
@@ -164,6 +166,7 @@ PARSE_AND_LIST_OPTIONS='
fprintf (file, _("\
--emit-stub-syms Label linker stubs with a symbol.\n\
--no-tls-optimize Don'\''t try to optimize TLS accesses.\n\
+ --secure-plt Use new-style PLT if possible.\n\
--bss-plt Force old-style BSS PLT.\n\
--sdata-got Force GOT location just before .sdata.\n"
));
@@ -178,8 +181,12 @@ PARSE_AND_LIST_ARGS_CASES='
notlsopt = 1;
break;
+ case OPTION_NEW_PLT:
+ plt_style = PLT_NEW;
+ break;
+
case OPTION_OLD_PLT:
- old_plt = 1;
+ plt_style = PLT_OLD;
break;
case OPTION_OLD_GOT:
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index 788c515..700662e 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -5699,6 +5699,14 @@ PLT, if all input files (including startup and static libraries) were
compiled with @samp{-msecure-plt}. @samp{--bss-plt} forces the old
BSS PLT (and GOT layout) which can give slightly better performance.
+@kindex --secure-plt
+@item --secure-plt
+@command{ld} will use the new PLT and GOT layout if it is linking new
+@samp{-fpic} or @samp{-fPIC} code, but does not do so automatically
+when linking non-PIC code. This option requests the new PLT and GOT
+layout. A warning will be given if some object file requires the old
+style BSS PLT.
+
@cindex PowerPC GOT
@kindex --sdata-got
@item --sdata-got