From 85c838d6131ea51bfdb76f158bcef7b34f748b32 Mon Sep 17 00:00:00 2001 From: Steve Chamberlain Date: Thu, 5 Nov 1992 19:35:38 +0000 Subject: [PATCH] * relax.c (build_it): re-enable the processing of data_statements in scripts, makes counted contructor lists work again. --- ld/ChangeLog | 5 ++ ld/relax.c | 171 ++++++++++++++++++++++++++------------------------- 2 files changed, 91 insertions(+), 85 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 01edfd10ea..23f24eecfa 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +Thu Nov 5 11:33:57 1992 Steve Chamberlain (sac@thepub.cygnus.com) + + * relax.c (build_it): re-enable the processing of data_statements + in scripts, makes counted contructor lists work again. + Thu Nov 5 05:43:01 1992 John Gilmore (gnu@cygnus.com) * ldemul.h: Remove uses of SDEF and PROTO macros (use PARAMS). diff --git a/ld/relax.c b/ld/relax.c index 5738b5bddb..ea156e34fe 100644 --- a/ld/relax.c +++ b/ld/relax.c @@ -28,116 +28,117 @@ DEFUN(build_it,(statement), { switch (statement->header.type) { #if 0 - { + { - bfd_byte play_area[SHORT_SIZE]; - unsigned int i; - bfd_putshort(output_bfd, statement->fill_statement.fill, play_area); - /* Write out all entire shorts */ - for (i = 0; - i < statement->fill_statement.size - SHORT_SIZE + 1; - i+= SHORT_SIZE) - { - bfd_set_section_contents(output_bfd, - statement->fill_statement.output_section, - play_area, - statement->data_statement.output_offset +i, - SHORT_SIZE); + bfd_byte play_area[SHORT_SIZE]; + unsigned int i; + bfd_putshort(output_bfd, statement->fill_statement.fill, play_area); + /* Write out all entire shorts */ + for (i = 0; + i < statement->fill_statement.size - SHORT_SIZE + 1; + i+= SHORT_SIZE) + { + bfd_set_section_contents(output_bfd, + statement->fill_statement.output_section, + play_area, + statement->data_statement.output_offset +i, + SHORT_SIZE); - } + } - /* Now write any remaining byte */ - if (i < statement->fill_statement.size) - { - bfd_set_section_contents(output_bfd, - statement->fill_statement.output_section, - play_area, - statement->data_statement.output_offset +i, - 1); + /* Now write any remaining byte */ + if (i < statement->fill_statement.size) + { + bfd_set_section_contents(output_bfd, + statement->fill_statement.output_section, + play_area, + statement->data_statement.output_offset +i, + 1); - } + } - abort(); - } + abort(); + } break; #endif - case lang_data_statement_enum: -#if 0 - { + case lang_data_statement_enum: - bfd_vma value = statement->data_statement.value; - bfd_byte play_area[LONG_SIZE]; - unsigned int size = 0; - switch (statement->data_statement.type) { + { + + bfd_vma value = statement->data_statement.value; + bfd_byte play_area[LONG_SIZE]; + unsigned int size = 0; + asection * output_section = statement->data_statement.output_section; + switch (statement->data_statement.type) { case LONG: - bfd_put_32(output_bfd, value, play_area); - size = LONG_SIZE; - break; + bfd_put_32(output_section->owner, value, play_area); + size = LONG_SIZE; + break; case SHORT: - bfd_put_16(output_bfd, value, play_area); - size = SHORT_SIZE; - break; + bfd_put_16(output_section->owner, value, play_area); + size = SHORT_SIZE; + break; case BYTE: - bfd_put_8(output_bfd, value, play_area); - size = BYTE_SIZE; - break; - } + bfd_put_8(output_section->owner, value, play_area); + size = BYTE_SIZE; + break; + } - bfd_set_section_contents(output_bfd, - statement->data_statement.output_section, - play_area, - statement->data_statement.output_vma, - size); + bfd_set_section_contents(output_section->owner, + statement->data_statement.output_section, + play_area, + statement->data_statement.output_vma, + size); - } -#endif - break; - case lang_input_section_enum: - { - /* Create a new seclet in the output section with this - attached */ - if (statement->input_section.ifile->just_syms_flag == false) - { - asection *i = statement->input_section.section; + } - asection *output_section = i->output_section; - - bfd_seclet_type *seclet = bfd_new_seclet(output_section->owner,output_section); - - seclet->type = bfd_indirect_seclet; - seclet->u.indirect.section = i; - seclet->u.indirect.symbols = statement->input_section.ifile->asymbols; - seclet->size = i->_cooked_size; - seclet->offset = i->output_offset; - seclet->next = 0; - } - - } break; - case lang_padding_statement_enum: + case lang_input_section_enum: + { + /* Create a new seclet in the output section with this + attached */ + if (statement->input_section.ifile->just_syms_flag == false) + { + asection *i = statement->input_section.section; + + asection *output_section = i->output_section; + + bfd_seclet_type *seclet = bfd_new_seclet(output_section->owner,output_section); + + seclet->type = bfd_indirect_seclet; + seclet->u.indirect.section = i; + seclet->u.indirect.symbols = statement->input_section.ifile->asymbols; + seclet->size = i->_cooked_size; + seclet->offset = i->output_offset; + seclet->next = 0; + } + + } + break; + case lang_padding_statement_enum: /* Make a new seclet with the right filler */ - { - /* Create a new seclet in the output section with this - attached */ + { + /* Create a new seclet in the output section with this + attached */ - bfd_seclet_type *seclet = - bfd_new_seclet(statement->padding_statement.output_section->owner, - statement->padding_statement.output_section); + bfd_seclet_type *seclet = + bfd_new_seclet(statement->padding_statement.output_section->owner, + statement->padding_statement.output_section); - seclet->type = bfd_fill_seclet; - seclet->size = statement->padding_statement.size; - seclet->offset = statement->padding_statement.output_offset; - seclet->u.fill.value = statement->padding_statement.fill; - seclet->next = 0; - } + seclet->type = bfd_fill_seclet; + seclet->size = statement->padding_statement.size; + seclet->offset = statement->padding_statement.output_offset; + seclet->u.fill.value = statement->padding_statement.fill; + seclet->next = 0; + } break; break; - default: + default: /* All the other ones fall through */ ;