X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=ld%2Femultempl%2Fbeos.em;h=ad4494e2aa0704fa2f799fbcc1cecf637c80ffb1;hb=f9671640954362a918c669700bcc9a57be25782d;hp=e07677b314240c672d5852d948a2c4e0abea87c3;hpb=1e035701d67ed8a8bc72ec9e393f2d984090a60c;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em index e07677b314..ad4494e2aa 100644 --- a/ld/emultempl/beos.em +++ b/ld/emultempl/beos.em @@ -5,24 +5,27 @@ if [ -z "$MACHINE" ]; then else OUTPUT_ARCH=${ARCH}:${MACHINE} fi -cat >e${EMULATION_NAME}.c <children); + push_stat_ptr (&abs_output_section->children); for (j = 0; init[j].ptr; j++) { long val = init[j].value; - lang_add_assignment (exp_assop ('=', init[j].symbol, exp_intop (val))); + lang_add_assignment (exp_assign (init[j].symbol, exp_intop (val), + FALSE)); if (init[j].size == sizeof(short)) *(short *)init[j].ptr = val; else if (init[j].size == sizeof(int)) @@ -363,28 +361,30 @@ gld_${EMULATION_NAME}_set_symbols (void) else abort(); } /* Restore the pointer. */ - stat_ptr = save; + pop_stat_ptr (); if (pe.FileAlignment > pe.SectionAlignment) { - einfo ("%P: warning, file alignment > section alignment.\n"); + einfo (_("%P: warning, file alignment > section alignment\n")); } } static void gld_${EMULATION_NAME}_after_open (void) { + after_open_default (); + /* Pass the wacky PE command line options into the output bfd. FIXME: This should be done via a function, rather than by including an internal BFD header. */ - if (!coff_data(output_bfd)->pe) + if (!coff_data(link_info.output_bfd)->pe) { - einfo ("%F%P: PE operations on non PE file.\n"); + einfo (_("%F%P: PE operations on non PE file\n")); } - pe_data(output_bfd)->pe_opthdr = pe; - pe_data(output_bfd)->dll = init[DLLOFF].value; + pe_data(link_info.output_bfd)->pe_opthdr = pe; + pe_data(link_info.output_bfd)->dll = init[DLLOFF].value; } @@ -397,13 +397,13 @@ sort_by_file_name (const void *a, const void *b) const lang_statement_union_type *const *rb = b; int i, a_sec, b_sec; - i = strcmp ((*ra)->input_section.ifile->the_bfd->my_archive->filename, - (*rb)->input_section.ifile->the_bfd->my_archive->filename); + i = filename_cmp ((*ra)->input_section.section->owner->my_archive->filename, + (*rb)->input_section.section->owner->my_archive->filename); if (i != 0) return i; - i = strcmp ((*ra)->input_section.ifile->filename, - (*rb)->input_section.ifile->filename); + i = filename_cmp ((*ra)->input_section.section->owner->filename, + (*rb)->input_section.section->owner->filename); if (i != 0) return i; /* the tail idata4/5 are the only ones without relocs to an @@ -412,37 +412,43 @@ sort_by_file_name (const void *a, const void *b) and HNT properly. if no reloc this one is import by ordinal so we have to sort by section contents */ - if ( ((*ra)->input_section.section->reloc_count + (*rb)->input_section.section->reloc_count) ) + if ((*ra)->input_section.section->reloc_count + + (*rb)->input_section.section->reloc_count) { - i = (((*ra)->input_section.section->reloc_count > - (*rb)->input_section.section->reloc_count) ? -1 : 0); - if ( i != 0) - return i; + i = ((*ra)->input_section.section->reloc_count + > (*rb)->input_section.section->reloc_count) ? -1 : 0; + if (i != 0) + return i; - return (((*ra)->input_section.section->reloc_count > - (*rb)->input_section.section->reloc_count) ? 0 : 1); + return ((*ra)->input_section.section->reloc_count + > (*rb)->input_section.section->reloc_count) ? 0 : 1; } else { - if ( (strcmp( (*ra)->input_section.section->name, ".idata$6") == 0) ) - return 0; /* don't sort .idata$6 or .idata$7 FIXME dlltool eliminate .idata$7 */ - - if (! bfd_get_section_contents ((*ra)->input_section.ifile->the_bfd, - (*ra)->input_section.section, &a_sec, (file_ptr) 0, (bfd_size_type)sizeof(a_sec))) - einfo ("%F%B: Can't read contents of section .idata: %E\n", - (*ra)->input_section.ifile->the_bfd); - - if (! bfd_get_section_contents ((*rb)->input_section.ifile->the_bfd, - (*rb)->input_section.section, &b_sec, (file_ptr) 0, (bfd_size_type)sizeof(b_sec) )) - einfo ("%F%B: Can't read contents of section .idata: %E\n", - (*rb)->input_section.ifile->the_bfd); - - i = ((a_sec < b_sec) ? -1 : 0); - if ( i != 0) - return i; - return ((a_sec < b_sec) ? 0 : 1); - } -return 0; + /* don't sort .idata$6 or .idata$7 FIXME dlltool eliminate .idata$7 */ + if ((strcmp ((*ra)->input_section.section->name, ".idata$6") == 0)) + return 0; + + if (!bfd_get_section_contents ((*ra)->input_section.section->owner, + (*ra)->input_section.section, &a_sec, + (file_ptr) 0, + (bfd_size_type) sizeof(a_sec))) + einfo (_("%F%P: %pB: can't read contents of section .idata: %E\n"), + (*ra)->input_section.section->owner); + + if (!bfd_get_section_contents ((*rb)->input_section.section->owner, + (*rb)->input_section.section, &b_sec, + (file_ptr) 0, + (bfd_size_type) sizeof(b_sec))) + einfo (_("%F%P: %pB: can't read contents of section .idata: %E\n"), + (*rb)->input_section.section->owner); + + i = a_sec < b_sec ? -1 : 0; + if (i != 0) + return i; + return a_sec < b_sec ? 0 : 1; + } + return 0; } static int @@ -452,16 +458,15 @@ sort_by_section_name (const void *a, const void *b) const lang_statement_union_type *const *rb = b; int i; i = strcmp ((*ra)->input_section.section->name, - (*rb)->input_section.section->name); -/* this is a hack to make .stab and .stabstr last, so we don't have - to fix strip/objcopy for .reloc sections. - FIXME stripping images with a .rsrc section still needs to be fixed */ - if ( i != 0) + (*rb)->input_section.section->name); + /* This is a hack to make .stab and .stabstr last, so we don't have + to fix strip/objcopy for .reloc sections. + FIXME stripping images with a .rsrc section still needs to be fixed. */ + if (i != 0) { - if ((strncmp ((*ra)->input_section.section->name, ".stab", 5) == 0) - && (strncmp ((*rb)->input_section.section->name, ".stab", 5) != 0)) - return 1; - return i; + if ((CONST_STRNEQ ((*ra)->input_section.section->name, ".stab")) + && (! CONST_STRNEQ ((*rb)->input_section.section->name, ".stab"))) + return 1; } return i; } @@ -534,7 +539,7 @@ sort_sections (lang_statement_union_type *s) { /* Is this the .idata section? */ if (sec->spec.name != NULL - && strncmp (sec->spec.name, ".idata", 6) == 0) + && CONST_STRNEQ (sec->spec.name, ".idata")) { /* Sort the children. We want to sort any objects in the same archive. In order to handle the case of @@ -547,7 +552,7 @@ sort_sections (lang_statement_union_type *s) { lang_statement_union_type *start = *p; if (start->header.type != lang_input_section_enum - || !start->input_section.ifile->the_bfd->my_archive) + || !start->input_section.section->owner->my_archive) p = &(start->header.next); else { @@ -606,18 +611,17 @@ sort_sections (lang_statement_union_type *s) static void gld_${EMULATION_NAME}_before_allocation (void) { - extern lang_statement_list_type *stat_ptr; - #ifdef TARGET_IS_ppcpe /* Here we rummage through the found bfds to collect toc information */ { LANG_FOR_EACH_INPUT_STATEMENT (is) - { - if (!ppc_process_before_allocation(is->the_bfd, &link_info)) - { - einfo("Errors encountered processing file %s\n", is->filename); - } - } + { + if (!ppc_process_before_allocation(is->the_bfd, &link_info)) + { + einfo (_("%P: errors encountered processing file %s\n"), + is->filename); + } + } } /* We have seen it all. Allocate it, and carry on */ @@ -632,12 +636,13 @@ gld_${EMULATION_NAME}_before_allocation (void) option? krk@cygnus.com */ { LANG_FOR_EACH_INPUT_STATEMENT (is) - { - if (!arm_process_before_allocation (is->the_bfd, & link_info)) - { - einfo ("Errors encountered processing file %s", is->filename); - } - } + { + if (!arm_process_before_allocation (is->the_bfd, & link_info)) + { + einfo (_("%P: errors encountered processing file %s\n"), + is->filename); + } + } } /* We have seen it all. Allocate it, and carry on */ @@ -661,32 +666,31 @@ gld_${EMULATION_NAME}_before_allocation (void) but I'm leaving this here in case we want to enable it for sections which are not mentioned in the linker script. */ -static bfd_boolean -gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s) +static lang_output_section_statement_type * +gld${EMULATION_NAME}_place_orphan (asection *s, + const char *secname, + int constraint) { - const char *secname; char *output_secname, *ps; lang_output_section_statement_type *os; lang_statement_union_type *l; if ((s->flags & SEC_ALLOC) == 0) - return FALSE; + return NULL; /* Don't process grouped sections unless doing a final link. If they're marked as COMDAT sections, we don't want .text\$foo to end up in .text and then have .text disappear because it's marked link-once-discard. */ - if (link_info.relocatable) - return FALSE; - - secname = bfd_get_section_name (s->owner, s); + if (bfd_link_relocatable (&link_info)) + return NULL; /* Everything from the '\$' on gets deleted so don't allow '\$' as the first character. */ if (*secname == '\$') - einfo ("%P%F: section %s has '\$' as first character\n", secname); + einfo (_("%F%P: section %s has '\$' as first character\n"), secname); if (strchr (secname + 1, '\$') == NULL) - return FALSE; + return NULL; /* Look up the output section. The Microsoft specs say sections names in image files never contain a '\$'. Fortunately, lang_..._lookup creates @@ -694,7 +698,7 @@ gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s) output_secname = xstrdup (secname); ps = strchr (output_secname + 1, '\$'); *ps = 0; - os = lang_output_section_statement_lookup (output_secname); + os = lang_output_section_statement_lookup (output_secname, constraint, TRUE); /* Find the '\$' wild statement for this section. We currently require the linker script to explicitly mention "*(.foo\$)". @@ -716,15 +720,15 @@ gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s) } ps[0] = 0; if (l == NULL) - einfo ("%P%F: *(%s\$) missing from linker script\n", output_secname); + einfo (_("%F%P: *(%s\$) missing from linker script\n"), output_secname); /* Link the input section in and we're done for now. The sections still have to be sorted, but that has to wait until all such sections have been processed by us. The sorting is done by sort_sections. */ - lang_add_section (&l->wild_statement.children, s, os, file); + lang_add_section (&l->wild_statement.children, s, NULL, os); - return TRUE; + return os; } static char * @@ -734,15 +738,15 @@ EOF # sed commands to quote an ld script as a C string. sc="-f stringify.sed" -cat >>e${EMULATION_NAME}.c <> e${EMULATION_NAME}.c -echo ' ; else if (link_info.relocatable) return' >> 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 @@ -752,7 +756,7 @@ echo ' ; else return' >> e${EMULATION_NAME}.c sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c echo '; }' >> e${EMULATION_NAME}.c -cat >>e${EMULATION_NAME}.c <