summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/ld/emultempl/ppc32elf.em
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/binutils/ld/emultempl/ppc32elf.em')
-rw-r--r--contrib/binutils/ld/emultempl/ppc32elf.em40
1 files changed, 33 insertions, 7 deletions
diff --git a/contrib/binutils/ld/emultempl/ppc32elf.em b/contrib/binutils/ld/emultempl/ppc32elf.em
index 10f9107..b0239e0 100644
--- a/contrib/binutils/ld/emultempl/ppc32elf.em
+++ b/contrib/binutils/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");
@@ -124,19 +124,40 @@ ppc_before_allocation (void)
EOF
+if grep -q 'ld_elf32_spu_emulation' ldemul-list.h; then
+ cat >>e${EMULATION_NAME}.c <<EOF
+/* 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
+ppc_recognized_file (lang_input_statement_type *entry)
+{
+ if (embedded_spu_file (entry, "-m32"))
+ return TRUE;
+
+ return gld${EMULATION_NAME}_load_symbols (entry);
+}
+
+EOF
+LDEMUL_RECOGNIZED_FILE=ppc_recognized_file
+fi
+
# Define some shell vars to insert bits of code into the standard elf
# parse_args and list_options functions.
#
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 },
'
@@ -145,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"
));
@@ -159,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:
OpenPOWER on IntegriCloud