From 755f42fe99bf0e0da7aa866f348f69aac49e2ac7 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 24 Jan 1994 17:59:18 +0000 Subject: [PATCH] * ldlang.c (relaxing): Removed global variable. (lang_size_sections): If the canonical symbols have not already been read in, read them in before relaxing. * ldlang.h (relaxing): Removed declaration. --- ld/ChangeLog | 7 +++++++ ld/ldlang.c | 26 +++++++++++++++++++++----- ld/ldlang.h | 12 ++++-------- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index b71b3d2b71..c4f9fd92b9 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +Mon Jan 24 12:56:37 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * ldlang.c (relaxing): Removed global variable. + (lang_size_sections): If the canonical symbols have not already + been read in, read them in before relaxing. + * ldlang.h (relaxing): Removed declaration. + Fri Jan 21 00:44:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) * ldlang.c (new_afile): Initialize loaded field to false. diff --git a/ld/ldlang.c b/ld/ldlang.c index 4c818cd047..71a0388848 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -145,7 +145,6 @@ static int topower PARAMS ((int)); static void reset_memory_regions PARAMS ((void)); /* EXPORTS */ -boolean relaxing; lang_output_section_statement_type *abs_output_section; lang_statement_list_type *stat_ptr = &statement_list; lang_statement_list_type file_chain = @@ -1769,15 +1768,32 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax) lang_input_section_type *is; asection *i; - relaxing = true; - is = &(*prev)->input_section; i = is->section; + /* FIXME: The interface to bfd_relax_section should be changed + to not require the generic symbols to be read. Changing + this would require changing both b_out_relax_section and + bfd_coff_relax16_section. */ + if (is->ifile->asymbols == (asymbol **) NULL) + { + unsigned int symsize; + + symsize = get_symtab_upper_bound (i->owner); + is->ifile->asymbols = (asymbol **) ldmalloc (symsize); + is->ifile->symbol_count = + bfd_canonicalize_symtab (i->owner, is->ifile->asymbols); + + /* The generic linker code in BFD requires that these + symbols be stored in the outsymbols and symcount + fields. When the bfd_relax_section is interface is + fixed this should also be fixed. */ + i->owner->outsymbols = is->ifile->asymbols; + i->owner->symcount = is->ifile->symbol_count; + } + if (bfd_relax_section (i->owner, i, &link_info, is->ifile->asymbols)) had_relax = true; - - relaxing = false; } else { (*prev)->input_section.section->_cooked_size = diff --git a/ld/ldlang.h b/ld/ldlang.h index 7df1189c58..1e7e36a3c7 100644 --- a/ld/ldlang.h +++ b/ld/ldlang.h @@ -30,7 +30,7 @@ typedef enum lang_input_file_is_file_enum } lang_input_file_enum_type; -typedef unsigned short fill_type; +typedef unsigned int fill_type; typedef struct statement_list { union lang_statement_union *head; @@ -275,13 +275,10 @@ typedef union lang_statement_union extern bfd_size_type largest_section; extern lang_output_section_statement_type *abs_output_section; -extern lang_input_statement_type *script_file; extern boolean lang_has_input_file; -extern boolean relaxing; extern etree_type *base; extern lang_statement_list_type *stat_ptr; extern boolean delete_output_file_on_failure; -extern lang_output_section_statement_type *create_object_symbols; extern void lang_init PARAMS ((void)); extern struct memory_region_struct *lang_memory_region_lookup @@ -296,10 +293,8 @@ extern void lang_enter_output_section_statement bfd_vma block_value, etree_type *align, etree_type *subalign, - etree_type *base)); + etree_type *)); extern void lang_final PARAMS ((void)); -extern struct symbol_cache_entry *create_symbol - PARAMS ((const char *, unsigned int, struct sec *)); extern void lang_process PARAMS ((void)); extern void lang_section_start PARAMS ((const char *, union etree_union *)); extern void lang_add_entry PARAMS ((const char *)); @@ -374,7 +369,8 @@ extern void ldlang_add_undef PARAMS ((const char *const name)); extern void lang_add_output_format PARAMS ((const char *, int from_script)); extern void lang_list_init PARAMS ((lang_statement_list_type*)); extern void lang_add_data PARAMS ((int type, union etree_union *)); -extern void lang_for_each_statement PARAMS ((void (*func)())); +extern void lang_for_each_statement + PARAMS ((void (*func) (lang_statement_union_type *))); extern PTR stat_alloc PARAMS ((size_t size)); #endif