diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-09-04 19:11:21 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-09-04 19:11:21 +0000 |
commit | c3c8d76890b592bf5acc1a9b7faeabd9b829dd71 (patch) | |
tree | 6358a23d0df9de73b6d5d6d3a75545ff35f05b47 /gnu/usr.bin/binutils/ld/emultempl | |
parent | 4ba440a6e788da3a64fa29b782c37150a3f5cc18 (diff) |
Merge the Cygnus 960904 sources
Diffstat (limited to 'gnu/usr.bin/binutils/ld/emultempl')
-rw-r--r-- | gnu/usr.bin/binutils/ld/emultempl/elf32.em | 34 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/ld/emultempl/pe.em | 5 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/ld/emultempl/sunos.em | 43 |
3 files changed, 44 insertions, 38 deletions
diff --git a/gnu/usr.bin/binutils/ld/emultempl/elf32.em b/gnu/usr.bin/binutils/ld/emultempl/elf32.em index 45cab9ffb99..dc3470d370e 100644 --- a/gnu/usr.bin/binutils/ld/emultempl/elf32.em +++ b/gnu/usr.bin/binutils/ld/emultempl/elf32.em @@ -1,9 +1,12 @@ # 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> @@ -554,12 +557,12 @@ gld${EMULATION_NAME}_before_allocation () 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. */ @@ -682,7 +685,7 @@ gld${EMULATION_NAME}_find_exp_assignment (exp) 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", @@ -717,6 +720,7 @@ gld${EMULATION_NAME}_find_exp_assignment (exp) 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; @@ -775,6 +779,10 @@ gld${EMULATION_NAME}_place_orphan (file, s) 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; @@ -813,7 +821,9 @@ gld${EMULATION_NAME}_place_orphan (file, s) 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) @@ -830,7 +840,8 @@ gld${EMULATION_NAME}_place_orphan (file, s) os = lang_output_section_statement_lookup (secname); wild_doit (&os->children, s, os, file); - lang_leave_output_section_statement ((bfd_vma) 0, "*default*"); + lang_leave_output_section_statement + ((bfd_vma) 0, "*default*", (struct lang_output_section_phdr_list *) NULL); stat_ptr = &add; if (*ps == '\0' && config.build_constructors) @@ -868,11 +879,14 @@ gld${EMULATION_NAME}_place_section (s) 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; } diff --git a/gnu/usr.bin/binutils/ld/emultempl/pe.em b/gnu/usr.bin/binutils/ld/emultempl/pe.em index 55257390890..0e92d85d2d2 100644 --- a/gnu/usr.bin/binutils/ld/emultempl/pe.em +++ b/gnu/usr.bin/binutils/ld/emultempl/pe.em @@ -535,7 +535,10 @@ gld_${EMULATION_NAME}_before_allocation() { LANG_FOR_EACH_INPUT_STATEMENT (is) { - ppc_process_before_allocation(is->the_bfd, &link_info); + if (!ppc_process_before_allocation(is->the_bfd, &link_info)) + { + einfo("Errors encountered processing file %s", is->filename); + } } } diff --git a/gnu/usr.bin/binutils/ld/emultempl/sunos.em b/gnu/usr.bin/binutils/ld/emultempl/sunos.em index 5f36bd1ae37..e20e08c3758 100644 --- a/gnu/usr.bin/binutils/ld/emultempl/sunos.em +++ b/gnu/usr.bin/binutils/ld/emultempl/sunos.em @@ -196,35 +196,21 @@ gld${EMULATION_NAME}_find_so (inp) alc = (char *) xmalloc (strlen (inp->filename) + 1); strcpy (alc, inp->filename); strstr (alc, ".so.")[2] = 'a'; - if (stat (alc, &st) == 0) + if (stat (alc, &st) != 0) + free (alc); + else { lang_input_statement_type *sa; - char *a; - /* Add the .sa file to the statement list just after the .so + /* Add the .sa file to the statement list just before the .so file. This is really a hack. */ sa = ((lang_input_statement_type *) xmalloc (sizeof (lang_input_statement_type))); - sa->header.next = inp->header.next; - sa->header.type = lang_input_statement_enum; - a = (char *) xmalloc (strlen (alc) + 1); - strcpy (a, alc); - sa->filename = a; - sa->local_sym_name = a; - sa->the_bfd = NULL; - sa->asymbols = NULL; - sa->symbol_count = 0; - sa->next = NULL; - sa->next_real_file = inp->next_real_file; - sa->is_archive = false; - sa->search_dirs_flag = false; - sa->just_syms_flag = false; - sa->loaded = false; - sa->real = true; - sa->complained = false; - - /* Put the new statement next on the list of statements and next - on the list of input files. */ + *sa = *inp; + + inp->filename = alc; + inp->local_sym_name = alc; + inp->header.next = (lang_statement_union_type *) sa; inp->next_real_file = (lang_statement_union_type *) sa; } @@ -367,7 +353,6 @@ gld${EMULATION_NAME}_after_open () { struct bfd_link_needed_list *ll; const char *lname; - const char *lib_path; search_dirs_type *search; lname = l->name; @@ -449,9 +434,13 @@ 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, lname)) - continue; + { + const char *lib_path; + + lib_path = (const char *) getenv ("LD_LIBRARY_PATH"); + if (gld${EMULATION_NAME}_search_needed (lib_path, lname)) + continue; + } EOF fi fi |