diff options
author | Steve Chamberlain <sac@cygnus> | 1993-03-30 17:49:00 +0000 |
---|---|---|
committer | Steve Chamberlain <sac@cygnus> | 1993-03-30 17:49:00 +0000 |
commit | 29f33467f23eaff819c4321f8cf9eb7fc1ac3b74 (patch) | |
tree | 29bb8ccddd3a2de4fa1802ee34e51a46084fb5c8 /ld/relax.c | |
parent | 21c7770362ef8eee989c93e7612673cfac3c8e84 (diff) | |
download | gdb-29f33467f23eaff819c4321f8cf9eb7fc1ac3b74.zip gdb-29f33467f23eaff819c4321f8cf9eb7fc1ac3b74.tar.gz gdb-29f33467f23eaff819c4321f8cf9eb7fc1ac3b74.tar.bz2 |
Tue Mar 30 09:40:25 1993 Steve Chamberlain (sac@thepub.cygnus.com)
* ldindr.c (add_indirect): Keep more information in the alias
symbol chain.
* ldlang.c (wild_doit): Don't inherit NEVER_LOAD section
attribute from an input section.
* ldmain.c (Q_enter_file_symbols): Common section is NEVER_LOAD by
default. (Q_enter_file_symbos): Indirect symbols now are known by
their section, not a special symbol flag.
* ldsym.c (write_file_locals): Indirect symbols aren't local.
(write_file_globals): Write the mapping for an indirect symbol.
* relax.c (build_it): When forced to write a NEVER_LOAD section,
fill it with zeros.
Diffstat (limited to 'ld/relax.c')
-rw-r--r-- | ld/relax.c | 278 |
1 files changed, 145 insertions, 133 deletions
@@ -16,12 +16,12 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* - +/* + new age linking -Tie together all the interseting blocks +Tie together all the interseting blocks */ @@ -39,150 +39,163 @@ Tie together all the interseting blocks #include "ldgram.h" #include "relax.h" static void -DEFUN(build_it,(statement), - lang_statement_union_type *statement) +DEFUN (build_it, (statement), + lang_statement_union_type * statement) { - switch (statement->header.type) { + 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); - - } - - /* 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(); - } - break; + { + + 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); + + } + + abort (); + } + break; #endif - case lang_data_statement_enum: - - { - - 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_section->owner, value, play_area); - size = LONG_SIZE; - break; - case SHORT: - bfd_put_16(output_section->owner, value, play_area); - size = SHORT_SIZE; - break; - case BYTE: - bfd_put_8(output_section->owner, value, play_area); - size = BYTE_SIZE; - break; - } - - bfd_set_section_contents(output_section->owner, - statement->data_statement.output_section, - play_area, - statement->data_statement.output_vma, - size); - - - - } - - break; - case lang_input_section_enum: - { - /* Create a new seclet in the output section with this + case lang_data_statement_enum: + + { + + 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_section->owner, value, play_area); + size = LONG_SIZE; + break; + case SHORT: + bfd_put_16 (output_section->owner, value, play_area); + size = SHORT_SIZE; + break; + case BYTE: + bfd_put_8 (output_section->owner, value, play_area); + size = BYTE_SIZE; + break; + } + + bfd_set_section_contents (output_section->owner, + statement->data_statement.output_section, + play_area, + statement->data_statement.output_vma, + size); + + + + } + + 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: - /* Make a new seclet with the right filler */ - { - /* Create a new seclet in the output section with this + 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); + + if (i->flags & SEC_NEVER_LOAD) + { + /* We've got a never load section inside one which is going + to be output, we'll change it into a fill seclet */ + seclet->type = bfd_fill_seclet; + seclet->u.fill.value = 0; + } + else + { + 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 */ - 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; - } - break; + 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; + } + break; - break; - default: - /* All the other ones fall through */ - ; + break; + default: + /* All the other ones fall through */ + ; - } + } } -void -DEFUN(write_relax,(output_bfd, data, relocateable), - bfd *output_bfd AND - PTR data AND - boolean relocateable) +void +DEFUN (write_relax, (output_bfd, data, relocateable), + bfd * output_bfd AND + PTR data AND + boolean relocateable) { -/* Tie up all the statements to generate an output bfd structure which + /* Tie up all the statements to generate an output bfd structure which bfd can mull over */ - lang_for_each_statement(build_it); + lang_for_each_statement (build_it); - bfd_seclet_link(output_bfd, data, relocateable); + bfd_seclet_link (output_bfd, data, relocateable); } - + /* See if we can change the size of this section by shrinking the @@ -190,19 +203,18 @@ DEFUN(write_relax,(output_bfd, data, relocateable), symbols in it, and shift around the data too. */ boolean -DEFUN(relax_section,(this_ptr), - lang_statement_union_type **this_ptr) +DEFUN (relax_section, (this_ptr), + lang_statement_union_type ** this_ptr) { extern lang_input_statement_type *script_file; lang_input_section_type *is = &((*this_ptr)->input_section); asection *i = is->section; - if (!(i->owner->flags & BFD_IS_RELAXABLE)) - { - if (i->owner != script_file->the_bfd) - einfo("%B: not assembled with -linkrelax\n", i->owner); - } - - return bfd_relax_section(i->owner, i, is->ifile->asymbols); - -} + if (!(i->owner->flags & BFD_IS_RELAXABLE)) + { + if (i->owner != script_file->the_bfd) + einfo ("%B: not assembled with -linkrelax\n", i->owner); + } + + return bfd_relax_section (i->owner, i, is->ifile->asymbols); +} |