#include "elf-bfd.h"
#include "elf64-ppc.h"
#include "ldlex.h"
+#include "elf/ppc64.h"
static asection *ppc_add_stub_section (const char *, asection *);
static void ppc_layout_sections_again (void);
/* Fake input file for stubs. */
static lang_input_statement_type *stub_file;
-static int stub_added = 0;
/* Whether we need to call ppc_layout_sections_again. */
static int need_laying_out = 0;
if (info.add.head == NULL)
goto err_ret;
- stub_added = 1;
if (hook_in_stub (&info, &os->children.head))
return stub_sec;
static void
gld${EMULATION_NAME}_finish (void)
{
+ char *msg = NULL;
+ char *line, *endline;
+
/* 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. */
- entry_section = ".opd";
-
- if (stub_added)
+ if ((elf_elfheader (link_info.output_bfd)->e_flags & EF_PPC64_ABI) == 1)
+ 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)
{
- char *msg = NULL;
- char *line, *endline;
-
- if (params.emit_stub_syms < 0)
- params.emit_stub_syms = 1;
- if (!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)
- {
- endline = strchr (line, '\n');
- if (endline != NULL)
- *endline++ = '\0';
- fprintf (stderr, "%s: %s\n", program_name, line);
- }
- fflush (stderr);
- if (msg != NULL)
- free (msg);
+ endline = strchr (line, '\n');
+ if (endline != NULL)
+ *endline++ = '\0';
+ fprintf (stderr, "%s: %s\n", program_name, line);
}
+ fflush (stderr);
+ if (msg != NULL)
+ free (msg);
ppc64_elf_restore_symbols (&link_info);
finish_default ();