From 7fabd0295e49acb53d88c31a73719ec78d7f03a4 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 3 Nov 2005 02:54:10 +0000 Subject: [PATCH] * ldlang.h (lang_output_section_statement_type): Rearrange. Remove memspec. Make "processed" a bitfield. (lang_data_statement_type, lang_reloc_statement_type): Rename output_vma to output_offset. * ldlang.c (lang_output_section_statement_lookup_1): Init all_input_readonly. Don't init memspec. (init_os): Remove incorrect comment. (print_data_statement, print_reloc_statement): Adjust for lang_data_statement_type and lang_reloc_statement_type change. (lang_size_sections_1, lang_add_reloc): Likewise. * ldwrite.c (build_link_order): Likewise. --- ld/ChangeLog | 14 ++++++++++++++ ld/ldlang.c | 15 ++++++--------- ld/ldlang.h | 32 ++++++++++++++------------------ ld/ldwrite.c | 4 ++-- 4 files changed, 36 insertions(+), 29 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index e886145..25f0ccb 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,17 @@ +2005-11-03 Alan Modra + + * ldlang.h (lang_output_section_statement_type): Rearrange. Remove + memspec. Make "processed" a bitfield. + (lang_data_statement_type, lang_reloc_statement_type): Rename + output_vma to output_offset. + * ldlang.c (lang_output_section_statement_lookup_1): Init + all_input_readonly. Don't init memspec. + (init_os): Remove incorrect comment. + (print_data_statement, print_reloc_statement): Adjust for + lang_data_statement_type and lang_reloc_statement_type change. + (lang_size_sections_1, lang_add_reloc): Likewise. + * ldwrite.c (build_link_order): Likewise. + 2005-10-30 Mark Mitchell * lexsup.c (help): Document "@FILE". diff --git a/ld/ldlang.c b/ld/ldlang.c index 7824d24..c4b1b9c 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1087,12 +1087,12 @@ lang_output_section_statement_lookup_1 (const char *const name, int constraint) lookup->bfd_section = NULL; lookup->processed = FALSE; lookup->constraint = constraint; + lookup->all_input_readonly = FALSE; lookup->ignored = FALSE; lookup->sectype = normal_section; lookup->addr_tree = NULL; lang_list_init (&lookup->children); - lookup->memspec = NULL; lookup->flags = 0; lookup->subsection_alignment = -1; lookup->section_alignment = -1; @@ -1691,9 +1691,6 @@ init_os (lang_output_section_statement_type *s, asection *isec) output_bfd->xvec->name, s->name); } s->bfd_section->output_section = s->bfd_section; - - /* We initialize an output sections output offset to minus its own - vma to allow us to output a section through itself. */ s->bfd_section->output_offset = 0; if (!command_line.reduce_memory_overheads) { @@ -3545,7 +3542,7 @@ print_data_statement (lang_data_statement_type *data) for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++) print_space (); - addr = data->output_vma; + addr = data->output_offset; if (data->output_section != NULL) addr += data->output_section->vma; @@ -3612,7 +3609,7 @@ print_reloc_statement (lang_reloc_statement_type *reloc) for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++) print_space (); - addr = reloc->output_vma; + addr = reloc->output_offset; if (reloc->output_section != NULL) addr += reloc->output_section->vma; @@ -4292,7 +4289,7 @@ lang_size_sections_1 { unsigned int size = 0; - s->data_statement.output_vma = + s->data_statement.output_offset = dot - output_section_statement->bfd_section->vma; s->data_statement.output_section = output_section_statement->bfd_section; @@ -4330,7 +4327,7 @@ lang_size_sections_1 { int size; - s->reloc_statement.output_vma = + s->reloc_statement.output_offset = dot - output_section_statement->bfd_section->vma; s->reloc_statement.output_section = output_section_statement->bfd_section; @@ -5680,7 +5677,7 @@ lang_add_reloc (bfd_reloc_code_real_type reloc, p->addend_value = 0; p->output_section = NULL; - p->output_vma = 0; + p->output_offset = 0; } lang_assignment_statement_type * diff --git a/ld/ldlang.h b/ld/ldlang.h index 168caec..12523a4 100644 --- a/ld/ldlang.h +++ b/ld/ldlang.h @@ -128,28 +128,14 @@ typedef struct lang_output_section_phdr_list typedef struct lang_output_section_statement_struct { lang_statement_header_type header; - union etree_union *addr_tree; lang_statement_list_type children; - const char *memspec; struct lang_output_section_statement_struct *next; const char *name; - - bfd_boolean processed; - asection *bfd_section; - flagword flags; /* Or together of all input sections. */ - enum section_type sectype; lang_memory_region_type *region; lang_memory_region_type *lma_region; - size_t block_value; fill_type *fill; - - int subsection_alignment; /* Alignment of components. */ - int section_alignment; /* Alignment of start of section. */ - int constraint; - unsigned int all_input_readonly : 1; - unsigned int ignored : 1; - + union etree_union *addr_tree; union etree_union *load_base; /* If non-null, an expression to evaluate after setting the section's @@ -159,6 +145,16 @@ typedef struct lang_output_section_statement_struct union etree_union *update_dot_tree; lang_output_section_phdr_list *phdrs; + + unsigned int block_value; + int subsection_alignment; /* Alignment of components. */ + int section_alignment; /* Alignment of start of section. */ + int constraint; + flagword flags; + enum section_type sectype; + unsigned int processed : 1; + unsigned int all_input_readonly : 1; + unsigned int ignored : 1; } lang_output_section_statement_type; typedef struct @@ -186,7 +182,7 @@ typedef struct union etree_union *exp; bfd_vma value; asection *output_section; - bfd_vma output_vma; + bfd_vma output_offset; } lang_data_statement_type; /* Generate a reloc in the output file. */ @@ -218,8 +214,8 @@ typedef struct /* Output section where reloc should be performed. */ asection *output_section; - /* VMA within output section. */ - bfd_vma output_vma; + /* Offset within output section. */ + bfd_vma output_offset; } lang_reloc_statement_type; typedef struct lang_input_statement_struct diff --git a/ld/ldwrite.c b/ld/ldwrite.c index e311743..d7bfab8 100644 --- a/ld/ldwrite.c +++ b/ld/ldwrite.c @@ -55,7 +55,7 @@ build_link_order (lang_statement_union_type *statement) einfo (_("%P%F: bfd_new_link_order failed\n")); link_order->type = bfd_data_link_order; - link_order->offset = statement->data_statement.output_vma; + link_order->offset = statement->data_statement.output_offset; link_order->u.data.contents = xmalloc (QUAD_SIZE); value = statement->data_statement.value; @@ -190,7 +190,7 @@ build_link_order (lang_statement_union_type *statement) if (link_order == NULL) einfo (_("%P%F: bfd_new_link_order failed\n")); - link_order->offset = rs->output_vma; + link_order->offset = rs->output_offset; link_order->size = bfd_get_reloc_size (rs->howto); link_order->u.reloc.p = xmalloc (sizeof (struct bfd_link_order_reloc)); -- 2.7.4