ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
+ config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
}
EOF
return FALSE;
bfd_elf_set_dyn_lib_class (entry->the_bfd,
- (enum dynamic_lib_link_class) link_class);
+ (enum dynamic_lib_link_class) link_class);
/* Continue on with normal load_symbols processing. */
return FALSE;
/* First strip off everything before the last '/'. */
soname = lbasename (abfd->filename);
- if (trace_file_tries)
+ if (verbose)
info_msg (_("found %s at %s\n"), soname, name);
global_found = NULL;
#endif
static bfd_boolean
-gld${EMULATION_NAME}_check_ld_elf_hints (const char *name, int force)
+gld${EMULATION_NAME}_check_ld_elf_hints (const struct bfd_link_needed_list *l,
+ int force)
{
static bfd_boolean initialized;
static char *ld_elf_hints;
if (ld_elf_hints == NULL)
return FALSE;
- needed.by = NULL;
- needed.name = name;
- return gld${EMULATION_NAME}_search_needed (ld_elf_hints, & needed,
- force);
+ needed.by = l->by;
+ needed.name = l->name;
+ return gld${EMULATION_NAME}_search_needed (ld_elf_hints, &needed, force);
}
EOF
# FreeBSD
}
static bfd_boolean
-gld${EMULATION_NAME}_check_ld_so_conf (const char *name, int force)
+gld${EMULATION_NAME}_check_ld_so_conf (const struct bfd_link_needed_list *l,
+ int force)
{
static bfd_boolean initialized;
static char *ld_so_conf;
return FALSE;
- needed.by = NULL;
- needed.name = name;
+ needed.by = l->by;
+ needed.name = l->name;
return gld${EMULATION_NAME}_search_needed (ld_so_conf, &needed, force);
}
{
struct elf_obj_tdata *t = elf_tdata (link_info.output_bfd);
struct build_id_info *b =
- (struct build_id_info *) xmalloc (sizeof *b);
+ (struct build_id_info *) xmalloc (sizeof *b);
b->style = link_info.emit_note_gnu_build_id;
b->sec = s;
if (!warn_eh_frame)
{
s = bfd_get_section_by_name (abfd, ".eh_frame");
- warn_eh_frame
- = (s
- && s->size > 8
- && !bfd_is_abs_section (s->output_section));
+ while (s != NULL
+ && (s->size <= 8
+ || bfd_is_abs_section (s->output_section)))
+ s = bfd_get_next_section_by_name (s);
+ warn_eh_frame = s != NULL;
}
if (elfbfd && warn_eh_frame)
break;
special action by the person doing the link. Note that the
needed list can actually grow while we are stepping through this
loop. */
- if (!link_info.executable)
- return;
needed = bfd_elf_get_needed_list (link_info.output_bfd, &link_info);
for (l = needed; l != NULL; l = l->next)
{
int force;
/* If the lib that needs this one was --as-needed and wasn't
- found to be needed, then this lib isn't needed either. */
+ found to be needed, then this lib isn't needed either. Skip
+ the lib when creating a shared object unless we are copying
+ DT_NEEDED entres. */
if (l->by != NULL
- && (bfd_elf_get_dyn_lib_class (l->by) & DYN_AS_NEEDED) != 0)
+ && ((bfd_elf_get_dyn_lib_class (l->by) & DYN_AS_NEEDED) != 0
+ || (!link_info.executable
+ && bfd_elf_get_dyn_lib_class (l->by) & DYN_NO_ADD_NEEDED) != 0))
continue;
/* If we've already seen this file, skip it. */
n.by = l->by;
n.name = l->name;
nn.by = l->by;
- if (trace_file_tries)
+ if (verbose)
info_msg (_("%s needed by %B\n"), l->name, l->by);
/* As-needed libs specified on the command line (or linker script)
case ${target} in
*-*-freebsd* | *-*-dragonfly*)
fragment <<EOF
- if (gld${EMULATION_NAME}_check_ld_elf_hints (l->name, force))
+ if (gld${EMULATION_NAME}_check_ld_elf_hints (l, force))
break;
EOF
# FreeBSD
*-*-linux-* | *-*-k*bsd*-* | *-*-gnu*)
# Linux
fragment <<EOF
- if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
+ if (gld${EMULATION_NAME}_check_ld_so_conf (l, force))
break;
EOF
fragment <<EOF
/* used by before_allocation and handle_option. */
-static void
+static void
gld${EMULATION_NAME}_append_to_separated_string (char **to, char *op_arg)
{
if (*to == NULL)
{
const char *audit_libs = elf_dt_audit (abfd);
- /* If the input bfd contains an audit entry, we need to add it as
+ /* If the input bfd contains an audit entry, we need to add it as
a dep audit entry. */
if (audit_libs && *audit_libs != '\0')
{
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
fragment <<EOF
case OPTION_AUDIT:
- gld${EMULATION_NAME}_append_to_separated_string (&audit, optarg);
+ gld${EMULATION_NAME}_append_to_separated_string (&audit, optarg);
break;
case 'P':
einfo (_("%P%F: invalid common page size \`%s'\n"),
optarg + 17);
}
+ else if (CONST_STRNEQ (optarg, "stack-size="))
+ {
+ char *end;
+ link_info.stacksize = strtoul (optarg + 11, &end, 0);
+ if (*end || link_info.stacksize < 0)
+ einfo (_("%P%F: invalid stack size \`%s'\n"), optarg + 11);
+ if (!link_info.stacksize)
+ /* Use -1 for explicit no-stack, because zero means
+ 'default'. */
+ link_info.stacksize = -1;
+ }
else if (strcmp (optarg, "execstack") == 0)
{
link_info.execstack = TRUE;
EOF
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
fragment <<EOF
+ else if (strcmp (optarg, "global") == 0)
+ link_info.flags_1 |= (bfd_vma) DF_1_GLOBAL;
else if (strcmp (optarg, "initfirst") == 0)
link_info.flags_1 |= (bfd_vma) DF_1_INITFIRST;
else if (strcmp (optarg, "interpose") == 0)
fragment <<EOF
fprintf (file, _("\
-P AUDITLIB, --depaudit=AUDITLIB\n" "\
- Specify a library to use for auditing dependencies\n"));
+ Specify a library to use for auditing dependencies\n"));
fprintf (file, _("\
--disable-new-dtags Disable new dynamic tags\n"));
fprintf (file, _("\
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
fragment <<EOF
fprintf (file, _("\
+ -z global Make symbols in DSO available for subsequently\n\
+ loaded objects\n"));
+ fprintf (file, _("\
-z initfirst Mark DSO to be initialized first at runtime\n"));
fprintf (file, _("\
-z interpose Mark object to interpose all DSOs but executable\n"));
-z now Mark object non-lazy runtime binding\n"));
fprintf (file, _("\
-z origin Mark object requiring immediate \$ORIGIN\n\
- processing at runtime\n"));
+ processing at runtime\n"));
fprintf (file, _("\
-z relro Create RELRO program header\n"));
+ fprintf (file, _("\
+ -z stacksize=SIZE Set size of stack segment\n"));
EOF
fi