X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=ld%2Femultempl%2Fsunos.em;h=bfea49efc059e2daede62e9ecdeab2bdc395a074;hb=0b8683b7eb25cc150c7738ddc0d237f255e0fa70;hp=61a5c01c6b2faac4b3103bc8e7c57e92e8d9c3c5;hpb=30727aa6d12fb866494020c0b62ab265a2bdcdfe;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em index 61a5c01c6b..bfea49efc0 100644 --- a/ld/emultempl/sunos.em +++ b/ld/emultempl/sunos.em @@ -1,46 +1,50 @@ # This shell script emits a C file. -*- C -*- # It does some substitutions. -cat >e${EMULATION_NAME}.c < SunOS shared library support by Ian Lance Taylor -This file is part of GLD, the Gnu Linker. + This file is part of the GNU Binutils. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ #define TARGET_IS_${EMULATION_NAME} -#include - -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libiberty.h" +#include "safe-ctype.h" #include "ld.h" #include "ldmain.h" -#include "ldemul.h" -#include "ldfile.h" #include "ldmisc.h" #include "ldexp.h" #include "ldlang.h" +#include "ldfile.h" +#include "ldemul.h" #ifdef HAVE_DIRENT_H # include @@ -57,37 +61,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # endif #endif -static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); -static void gld${EMULATION_NAME}_set_symbols PARAMS ((void)); -static void gld${EMULATION_NAME}_create_output_section_statements - PARAMS ((void)); static void gld${EMULATION_NAME}_find_so - PARAMS ((lang_input_statement_type *)); + (lang_input_statement_type *); static char *gld${EMULATION_NAME}_search_dir - PARAMS ((const char *, const char *, boolean *)); -static void gld${EMULATION_NAME}_after_open PARAMS ((void)); + (const char *, const char *, bfd_boolean *); static void gld${EMULATION_NAME}_check_needed - PARAMS ((lang_input_statement_type *)); -static boolean gld${EMULATION_NAME}_search_needed - PARAMS ((const char *, const char *)); -static boolean gld${EMULATION_NAME}_try_needed - PARAMS ((const char *, const char *)); -static void gld${EMULATION_NAME}_before_allocation PARAMS ((void)); + (lang_input_statement_type *); +static bfd_boolean gld${EMULATION_NAME}_search_needed + (const char *, const char *); +static bfd_boolean gld${EMULATION_NAME}_try_needed + (const char *, const char *); static void gld${EMULATION_NAME}_find_assignment - PARAMS ((lang_statement_union_type *)); -static void gld${EMULATION_NAME}_find_exp_assignment PARAMS ((etree_type *)); + (lang_statement_union_type *); +static void gld${EMULATION_NAME}_find_exp_assignment + (etree_type *); static void gld${EMULATION_NAME}_count_need - PARAMS ((lang_input_statement_type *)); + (lang_input_statement_type *); static void gld${EMULATION_NAME}_set_need - PARAMS ((lang_input_statement_type *)); -static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); + (lang_input_statement_type *); static void -gld${EMULATION_NAME}_before_parse() +gld${EMULATION_NAME}_before_parse (void) { - ldfile_output_architecture = bfd_arch_${ARCH}; - config.dynamic_link = true; - config.has_shared = true; + ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`); + input_flags.dynamic = TRUE; + config.has_shared = TRUE; } /* This is called after the command line arguments have been parsed, @@ -96,13 +94,13 @@ gld${EMULATION_NAME}_before_parse() list. */ static void -gld${EMULATION_NAME}_set_symbols () +gld${EMULATION_NAME}_set_symbols (void) { EOF if [ "x${host}" = "x${target}" ] ; then case " ${EMULATION_LIBPATH} " in *" ${EMULATION_NAME} "*) -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <search_dirs_flag - || ! inp->is_archive - || ! inp->dynamic) + if (! inp->flags.search_dirs + || ! inp->flags.maybe_archive + || ! inp->flags.dynamic) return; - ASSERT (strncmp (inp->local_sym_name, "-l", 2) == 0); + ASSERT (CONST_STRNEQ (inp->local_sym_name, "-l")); for (search = search_head; search != NULL; search = search->next) { - boolean found_static; + bfd_boolean found_static; found = gld${EMULATION_NAME}_search_dir (search->name, inp->filename, &found_static); @@ -190,7 +187,7 @@ gld${EMULATION_NAME}_find_so (inp) /* Turn off the search_dirs_flag to prevent ldfile_open_file from searching for this file again. */ - inp->search_dirs_flag = false; + inp->flags.search_dirs = FALSE; free (found); @@ -222,10 +219,8 @@ gld${EMULATION_NAME}_find_so (inp) /* Search a directory for a .so file. */ static char * -gld${EMULATION_NAME}_search_dir (dirname, filename, found_static) - const char *dirname; - const char *filename; - boolean *found_static; +gld${EMULATION_NAME}_search_dir + (const char *dirname, const char *filename, bfd_boolean *found_static) { int force_maj, force_min; const char *dot; @@ -240,7 +235,7 @@ gld${EMULATION_NAME}_search_dir (dirname, filename, found_static) int statval; struct stat st; - *found_static = false; + *found_static = FALSE; force_maj = -1; force_min = -1; @@ -272,39 +267,39 @@ gld${EMULATION_NAME}_search_dir (dirname, filename, found_static) if (dir == NULL) return NULL; dirnamelen = strlen (dirname); - + while ((entry = readdir (dir)) != NULL) { const char *s; int found_maj, found_min; - if (strncmp (entry->d_name, "lib", 3) != 0 + if (! CONST_STRNEQ (entry->d_name, "lib") || strncmp (entry->d_name + 3, filename, len) != 0) continue; if (dot == NULL && strcmp (entry->d_name + 3 + len, ".a") == 0) { - *found_static = true; + *found_static = TRUE; continue; } /* We accept libfoo.so without a version number, even though the - native linker does not. This is more convenient for packages - which just generate .so files for shared libraries, as on ELF - systems. */ - if (strncmp (entry->d_name + 3 + len, ".so", 3) != 0) + native linker does not. This is more convenient for packages + which just generate .so files for shared libraries, as on ELF + systems. */ + if (! CONST_STRNEQ (entry->d_name + 3 + len, ".so")) continue; if (entry->d_name[6 + len] == '\0') ; else if (entry->d_name[6 + len] == '.' - && isdigit ((unsigned char) entry->d_name[7 + len])) + && ISDIGIT (entry->d_name[7 + len])) ; else continue; for (s = entry->d_name + 6 + len; *s != '\0'; s++) - if (*s != '.' && ! isdigit ((unsigned char) *s)) + if (*s != '.' && ! ISDIGIT (*s)) break; if (*s != '\0') continue; @@ -361,17 +356,19 @@ gld${EMULATION_NAME}_search_dir (dirname, filename, found_static) between after_open and check_needed. */ static struct bfd_link_needed_list *global_needed; -static boolean global_found; +static bfd_boolean global_found; /* This is called after all the input files have been opened. */ static void -gld${EMULATION_NAME}_after_open () +gld${EMULATION_NAME}_after_open (void) { struct bfd_link_needed_list *needed, *l; + after_open_default (); + /* We only need to worry about this when doing a final link. */ - if (link_info.relocateable || link_info.shared) + if (bfd_link_relocatable (&link_info) || bfd_link_pic (&link_info)) return; /* Get the list of files which appear in ld_need entries in dynamic @@ -382,7 +379,7 @@ gld${EMULATION_NAME}_after_open () include another without requiring special action by the person doing the link. Note that the needed list can actually grow while we are stepping through this loop. */ - needed = bfd_sunos_get_needed_list (output_bfd, &link_info); + needed = bfd_sunos_get_needed_list (link_info.output_bfd, &link_info); for (l = needed; l != NULL; l = l->next) { struct bfd_link_needed_list *ll; @@ -400,16 +397,16 @@ gld${EMULATION_NAME}_after_open () /* See if this file was included in the link explicitly. */ global_needed = l; - global_found = false; + global_found = FALSE; lang_for_each_input_file (gld${EMULATION_NAME}_check_needed); if (global_found) continue; - if (strncmp (lname, "-l", 2) != 0) + if (! CONST_STRNEQ (lname, "-l")) { bfd *abfd; - abfd = bfd_openr (lname, bfd_get_target (output_bfd)); + abfd = bfd_openr (lname, bfd_get_target (link_info.output_bfd)); if (abfd != NULL) { if (! bfd_check_format (abfd, bfd_object)) @@ -430,11 +427,11 @@ gld${EMULATION_NAME}_after_open () { /* We've found the needed dynamic object. */ if (! bfd_link_add_symbols (abfd, &link_info)) - einfo ("%F%B: could not read symbols: %E\n", abfd); + einfo (_("%F%B: error adding symbols: %E\n"), abfd); } else { - einfo ("%P: warning: %s, needed by %B, not found\n", + einfo (_("%P: warning: %s, needed by %B, not found\n"), lname, l->by); } @@ -468,7 +465,7 @@ EOF if [ "x${host}" = "x${target}" ] ; then case " ${EMULATION_LIBPATH} " in *" ${EMULATION_NAME} "*) -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <next) @@ -494,22 +491,20 @@ cat >>e${EMULATION_NAME}.c <name, l->by); } } /* Search for a needed file in a path. */ -static boolean -gld${EMULATION_NAME}_search_needed (path, name) - const char *path; - const char *name; +static bfd_boolean +gld${EMULATION_NAME}_search_needed (const char *path, const char *name) { const char *s; if (path == NULL || *path == '\0') - return false; + return FALSE; while (1) { const char *dir; @@ -530,7 +525,7 @@ gld${EMULATION_NAME}_search_needed (path, name) } if (gld${EMULATION_NAME}_try_needed (dir, name)) - return true; + return TRUE; if (dircopy != NULL) free (dircopy); @@ -540,50 +535,48 @@ gld${EMULATION_NAME}_search_needed (path, name) path = s + 1; } - return false; + return FALSE; } /* This function is called for each possible directory for a needed dynamic object. */ -static boolean -gld${EMULATION_NAME}_try_needed (dir, name) - const char *dir; - const char *name; +static bfd_boolean +gld${EMULATION_NAME}_try_needed (const char *dir, const char *name) { char *file; char *alc; - boolean ignore; + bfd_boolean ignore; bfd *abfd; file = gld${EMULATION_NAME}_search_dir (dir, name, &ignore); if (file == NULL) - return false; + return FALSE; alc = (char *) xmalloc (strlen (dir) + strlen (file) + 2); sprintf (alc, "%s/%s", dir, file); free (file); - abfd = bfd_openr (alc, bfd_get_target (output_bfd)); + abfd = bfd_openr (alc, bfd_get_target (link_info.output_bfd)); if (abfd == NULL) - return false; + return FALSE; if (! bfd_check_format (abfd, bfd_object)) { (void) bfd_close (abfd); - return false; + return FALSE; } if ((bfd_get_file_flags (abfd) & DYNAMIC) == 0) { (void) bfd_close (abfd); - return false; + return FALSE; } /* We've found the needed dynamic object. */ /* Add this file into the symbol table. */ if (! bfd_link_add_symbols (abfd, &link_info)) - einfo ("%F%B: could not read symbols: %E\n", abfd); + einfo (_("%F%B: error adding symbols: %E\n"), abfd); - return true; + return TRUE; } /* See if we have already included a needed object in the link. This @@ -591,15 +584,14 @@ gld${EMULATION_NAME}_try_needed (dir, name) dynamic object more than once. */ static void -gld${EMULATION_NAME}_check_needed (s) - lang_input_statement_type *s; +gld${EMULATION_NAME}_check_needed (lang_input_statement_type *s) { if (s->filename == NULL) return; - if (strncmp (global_needed->name, "-l", 2) != 0) + if (! CONST_STRNEQ (global_needed->name, "-l")) { if (strcmp (s->filename, global_needed->name) == 0) - global_found = true; + global_found = TRUE; } else { @@ -615,7 +607,7 @@ gld${EMULATION_NAME}_check_needed (s) else ++sname; - if (strncmp (sname, "lib", 3) != 0) + if (! CONST_STRNEQ (sname, "lib")) return; sname += 3; @@ -639,7 +631,7 @@ gld${EMULATION_NAME}_check_needed (s) || (smin != lmin && smin != -1 && lmin != -1)) return; - global_found = true; + global_found = TRUE; } } @@ -647,7 +639,7 @@ gld${EMULATION_NAME}_check_needed (s) to lang_for_each_statement. Ick. */ static const char *find_assign; -static boolean found_assign; +static bfd_boolean found_assign; /* We need to use static variables to pass information around the call to lang_for_each_input_file. Ick. */ @@ -667,7 +659,7 @@ static bfd_byte *need_pnames; sections, but before any sizes or addresses have been set. */ static void -gld${EMULATION_NAME}_before_allocation () +gld${EMULATION_NAME}_before_allocation (void) { struct bfd_link_hash_entry *hdyn = NULL; asection *sneed; @@ -677,11 +669,13 @@ gld${EMULATION_NAME}_before_allocation () /* The SunOS native linker creates a shared library whenever there are any undefined symbols in a link, unless -e is used. This is pretty weird, but we are compatible. */ - if (! link_info.shared && ! link_info.relocateable && ! entry_from_cmdline) + if (! bfd_link_pic (&link_info) + && !bfd_link_relocatable (&link_info) + && ! entry_from_cmdline) { struct bfd_link_hash_entry *h; - - for (h = link_info.hash->undefs; h != NULL; h = h->next) + + for (h = link_info.hash->undefs; h != NULL; h = h->u.undef.next) { if (h->type == bfd_link_hash_undefined && h->u.undef.abfd != NULL @@ -690,24 +684,24 @@ gld${EMULATION_NAME}_before_allocation () && strcmp (h->root.string, "__GLOBAL_OFFSET_TABLE_") != 0) { find_assign = h->root.string; - found_assign = false; + found_assign = FALSE; lang_for_each_statement (gld${EMULATION_NAME}_find_assignment); if (! found_assign) { - link_info.shared = true; + link_info.type = type_dll; break; } } } } - if (link_info.shared) + if (bfd_link_pic (&link_info)) { lang_output_section_statement_type *os; /* Set the .text section to start at 0x20, not 0x2020. FIXME: - This is too magical. */ - os = lang_output_section_statement_lookup (".text"); + This is too magical. */ + os = lang_output_section_statement_lookup (".text", 0, TRUE); if (os->addr_tree == NULL) os->addr_tree = exp_intop (0x20); } @@ -718,15 +712,15 @@ gld${EMULATION_NAME}_before_allocation () one. We need to create the symbol before calling size_dynamic_sections, although we can't set the value until afterward. */ - if (! link_info.relocateable) + if (!bfd_link_relocatable (&link_info)) { - hdyn = bfd_link_hash_lookup (link_info.hash, "__DYNAMIC", true, false, - false); + hdyn = bfd_link_hash_lookup (link_info.hash, "__DYNAMIC", TRUE, FALSE, + FALSE); if (hdyn == NULL) - einfo ("%P%F: bfd_link_hash_lookup: %E\n"); - if (! bfd_sunos_record_link_assignment (output_bfd, &link_info, + einfo (_("%P%F: bfd_link_hash_lookup: %E\n")); + if (! bfd_sunos_record_link_assignment (link_info.output_bfd, &link_info, "__DYNAMIC")) - einfo ("%P%F: failed to record assignment to __DYNAMIC: %E\n"); + einfo (_("%P%F: failed to record assignment to __DYNAMIC: %E\n")); } /* If we are going to make any variable assignments, we need to let @@ -736,9 +730,9 @@ gld${EMULATION_NAME}_before_allocation () /* Let the backend linker work out the sizes of any sections required by dynamic linking. */ - if (! bfd_sunos_size_dynamic_sections (output_bfd, &link_info, &sdyn, - &sneed, &srules)) - einfo ("%P%F: failed to set dynamic section sizes: %E\n"); + if (! bfd_sunos_size_dynamic_sections (link_info.output_bfd, &link_info, + &sdyn, &sneed, &srules)) + einfo (_("%P%F: failed to set dynamic section sizes: %E\n")); if (sneed != NULL) { @@ -754,7 +748,7 @@ gld${EMULATION_NAME}_before_allocation () dynamic object. */ ASSERT (need_entries != 0); - sneed->_raw_size = need_size; + sneed->size = need_size; sneed->contents = (bfd_byte *) xmalloc (need_size); need_contents = sneed->contents; @@ -774,7 +768,7 @@ gld${EMULATION_NAME}_before_allocation () option. */ if (command_line.rpath) { - srules->_raw_size = strlen (command_line.rpath); + srules->size = strlen (command_line.rpath); srules->contents = (bfd_byte *) command_line.rpath; } else @@ -786,7 +780,7 @@ gld${EMULATION_NAME}_before_allocation () for (search = search_head; search != NULL; search = search->next) if (search->cmdline) size += strlen (search->name) + 1; - srules->_raw_size = size; + srules->size = size; if (size > 0) { char *p; @@ -811,7 +805,7 @@ gld${EMULATION_NAME}_before_allocation () /* We must assign a value to __DYNAMIC. It should be zero if we are not doing a dynamic link, or the start of the .dynamic section if we are doing one. */ - if (! link_info.relocateable) + if (!bfd_link_relocatable (&link_info)) { hdyn->type = bfd_link_hash_defined; hdyn->u.def.value = 0; @@ -820,6 +814,8 @@ gld${EMULATION_NAME}_before_allocation () else hdyn->u.def.section = bfd_abs_section_ptr; } + + before_allocation_default (); } /* This is called by the before_allocation routine via @@ -830,8 +826,7 @@ gld${EMULATION_NAME}_before_allocation () symbols which are referred to by dynamic objects. */ static void -gld${EMULATION_NAME}_find_assignment (s) - lang_statement_union_type *s; +gld${EMULATION_NAME}_find_assignment (lang_statement_union_type *s) { if (s->header.type == lang_assignment_statement_enum && (find_assign == NULL || ! found_assign)) @@ -841,8 +836,7 @@ gld${EMULATION_NAME}_find_assignment (s) /* Look through an expression for an assignment statement. */ static void -gld${EMULATION_NAME}_find_exp_assignment (exp) - etree_type *exp; +gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp) { switch (exp->type.node_class) { @@ -850,15 +844,16 @@ gld${EMULATION_NAME}_find_exp_assignment (exp) if (find_assign != NULL) { if (strcmp (find_assign, exp->assign.dst) == 0) - found_assign = true; + found_assign = TRUE; return; } if (strcmp (exp->assign.dst, ".") != 0) { - if (! bfd_sunos_record_link_assignment (output_bfd, &link_info, + if (! bfd_sunos_record_link_assignment (link_info.output_bfd, + &link_info, exp->assign.dst)) - einfo ("%P%F: failed to record assignment to %s: %E\n", + einfo (_("%P%F: failed to record assignment to %s: %E\n"), exp->assign.dst); } gld${EMULATION_NAME}_find_exp_assignment (exp->assign.src); @@ -890,15 +885,14 @@ gld${EMULATION_NAME}_find_exp_assignment (exp) for more information. */ static void -gld${EMULATION_NAME}_count_need (inp) - lang_input_statement_type *inp; +gld${EMULATION_NAME}_count_need (lang_input_statement_type *inp) { if (inp->the_bfd != NULL && (inp->the_bfd->flags & DYNAMIC) != 0) { ++need_entries; need_size += NEED_ENTRY_SIZE; - if (! inp->is_archive) + if (! inp->flags.maybe_archive) need_size += strlen (inp->filename) + 1; else { @@ -912,8 +906,7 @@ gld${EMULATION_NAME}_count_need (inp) /* Fill in the contents of the .need section. */ static void -gld${EMULATION_NAME}_set_need (inp) - lang_input_statement_type *inp; +gld${EMULATION_NAME}_set_need (lang_input_statement_type *inp) { if (inp->the_bfd != NULL && (inp->the_bfd->flags & DYNAMIC) != 0) @@ -925,85 +918,83 @@ gld${EMULATION_NAME}_set_need (inp) Instead, we use offsets, and rely on the BFD backend to finish the section up correctly. FIXME: Talk about lack of referential locality. */ - bfd_put_32 (output_bfd, need_pnames - need_contents, need_pinfo); - if (! inp->is_archive) + bfd_put_32 (link_info.output_bfd, need_pnames - need_contents, + need_pinfo); + if (! inp->flags.maybe_archive) { - bfd_put_32 (output_bfd, (bfd_vma) 0, need_pinfo + 4); - bfd_put_16 (output_bfd, (bfd_vma) 0, need_pinfo + 8); - bfd_put_16 (output_bfd, (bfd_vma) 0, need_pinfo + 10); - strcpy (need_pnames, inp->filename); + bfd_put_32 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 4); + bfd_put_16 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 8); + bfd_put_16 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 10); + strcpy ((char *) need_pnames, inp->filename); } else { char *verstr; int maj, min; - bfd_put_32 (output_bfd, (bfd_vma) 0x80000000, need_pinfo + 4); + bfd_put_32 (link_info.output_bfd, (bfd_vma) 0x80000000, + need_pinfo + 4); maj = 0; min = 0; verstr = strstr (inp->filename, ".so."); if (verstr != NULL) sscanf (verstr, ".so.%d.%d", &maj, &min); - bfd_put_16 (output_bfd, (bfd_vma) maj, need_pinfo + 8); - bfd_put_16 (output_bfd, (bfd_vma) min, need_pinfo + 10); - strcpy (need_pnames, inp->local_sym_name + 2); + bfd_put_16 (link_info.output_bfd, (bfd_vma) maj, need_pinfo + 8); + bfd_put_16 (link_info.output_bfd, (bfd_vma) min, need_pinfo + 10); + strcpy ((char *) need_pnames, inp->local_sym_name + 2); } c = (need_pinfo - need_contents) / NEED_ENTRY_SIZE; if (c + 1 >= need_entries) - bfd_put_32 (output_bfd, (bfd_vma) 0, need_pinfo + 12); + bfd_put_32 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 12); else - bfd_put_32 (output_bfd, (bfd_vma) (c + 1) * NEED_ENTRY_SIZE, + bfd_put_32 (link_info.output_bfd, (bfd_vma) (c + 1) * NEED_ENTRY_SIZE, need_pinfo + 12); need_pinfo += NEED_ENTRY_SIZE; - need_pnames += strlen (need_pnames) + 1; + need_pnames += strlen ((char *) need_pnames) + 1; } } static char * -gld${EMULATION_NAME}_get_script(isfile) - int *isfile; +gld${EMULATION_NAME}_get_script (int *isfile) EOF -if test -n "$COMPILE_IN" +if test x"$COMPILE_IN" = xyes then # Scripts compiled in. # sed commands to quote an ld script as a C string. -sc='s/["\\]/\\&/g -s/$/\\n\\/ -1s/^/"/ -$s/$/n"/ -' - -cat >>e${EMULATION_NAME}.c <> e${EMULATION_NAME}.c +echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c +sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c +echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c +sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c +echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c +sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c +echo ' ; else return' >> e${EMULATION_NAME}.c +sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c +echo '; }' >> e${EMULATION_NAME}.c else # Scripts read from the filesystem. -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <