# This shell script emits a C file. -*- C -*-
# It does some substitutions.
+# This file is now misnamed, because it supports both 32 bit and 64 bit
+# ELF emulations.
+test -z "${ELFSIZE}" && ELFSIZE=32
cat >e${EMULATION_NAME}.c <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
-/* 32 bit ELF emulation code for ${EMULATION_NAME}
+/* ${ELFSIZE} bit ELF emulation code for ${EMULATION_NAME}
Copyright (C) 1991, 93, 94, 95, 1996 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
ELF support by Ian Lance Taylor <ian@cygnus.com>
EOF
if [ "x${host}" = "x${target}" ] ; then
+ if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
cat >>e${EMULATION_NAME}.c <<EOF
/* For a native linker, check the file /etc/ld.so.conf for directories
}
EOF
+ fi
fi
cat >>e${EMULATION_NAME}.c <<EOF
}
EOF
if [ "x${host}" = "x${target}" ] ; then
+ if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
cat >>e${EMULATION_NAME}.c <<EOF
lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
if (gld${EMULATION_NAME}_search_needed (lib_path, l->name))
continue;
EOF
+ fi
fi
cat >>e${EMULATION_NAME}.c <<EOF
len = strlen (l->name);
continue;
EOF
if [ "x${host}" = "x${target}" ] ; then
+ if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
cat >>e${EMULATION_NAME}.c <<EOF
if (gld${EMULATION_NAME}_check_ld_so_conf (l->name))
continue;
EOF
+ fi
fi
cat >>e${EMULATION_NAME}.c <<EOF
rpath = command_line.rpath;
if (rpath == NULL)
rpath = (const char *) getenv ("LD_RUN_PATH");
- if (! bfd_elf32_size_dynamic_sections (output_bfd,
- command_line.soname,
- rpath,
- command_line.export_dynamic,
- &link_info,
- &sinterp))
+ if (! bfd_elf${ELFSIZE}_size_dynamic_sections (output_bfd,
+ command_line.soname,
+ rpath,
+ command_line.export_dynamic,
+ &link_info,
+ &sinterp))
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
/* Let the user override the dynamic linker we are using. */
case etree_assign:
if (strcmp (exp->assign.dst, ".") != 0)
{
- if (! (bfd_elf32_record_link_assignment
+ if (! (bfd_elf${ELFSIZE}_record_link_assignment
(output_bfd, &link_info, exp->assign.dst,
exp->type.node_class == etree_provide ? true : false)))
einfo ("%P%F: failed to record assignment to %s: %E\n",
static asection *hold_section;
static lang_output_section_statement_type *hold_use;
static lang_output_section_statement_type *hold_text;
+static lang_output_section_statement_type *hold_rodata;
static lang_output_section_statement_type *hold_data;
static lang_output_section_statement_type *hold_bss;
static lang_output_section_statement_type *hold_rel;
else if (strncmp (secname, ".rel", 4) == 0
&& hold_rel != NULL)
place = hold_rel;
+ else if ((s->flags & SEC_CODE) == 0
+ && (s->flags & SEC_READONLY) != 0
+ && hold_rodata != NULL)
+ place = hold_rodata;
else if ((s->flags & SEC_READONLY) != 0
&& hold_text != NULL)
place = hold_text;
symname = (char *) xmalloc (ps - secname + sizeof "__start_");
sprintf (symname, "__start_%s", secname);
lang_add_assignment (exp_assop ('=', symname,
- exp_nameop (NAME, ".")));
+ exp_unop (ALIGN_K,
+ exp_intop ((bfd_vma) 1
+ << s->alignment_power))));
}
if (! link_info.relocateable)
if (strcmp (os->name, ".text") == 0)
hold_text = os;
+ else if (strcmp (os->name, ".rodata") == 0)
+ hold_rodata = os;
else if (strcmp (os->name, ".data") == 0)
hold_data = os;
else if (strcmp (os->name, ".bss") == 0)
hold_bss = os;
else if (hold_rel == NULL
+ && os->bfd_section != NULL
&& strncmp (os->name, ".rel", 4) == 0)
hold_rel = os;
}