From ff0e4a93416510eaac29ab780ab631dbeb81206a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 27 Mar 1996 22:23:18 +0000 Subject: [PATCH] Remove SEC_LINKER_MARK, and add a linker_mark bitfield to the asection structure instead. --- bfd/ChangeLog | 14 +++++++++----- bfd/aoutx.h | 12 ++++++------ bfd/bfd-in2.h | 19 +++++++++++++------ bfd/coff-ppc.c | 2 +- bfd/cofflink.c | 4 ++-- bfd/elflink.h | 4 ++-- bfd/section.c | 25 ++++++++++++++++--------- bfd/xcofflink.c | 4 ++-- 8 files changed, 51 insertions(+), 33 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 91a23bf..9d63a46 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -10,6 +10,9 @@ Wed Mar 27 10:43:34 1996 Ian Lance Taylor (coff_ppc_relocate_section): Remove unused variables. Make fprintf strings and argument types correspond. Put before_addr in DEBUG_RELOC ifdef. + (dump_toc): Make fprintf strings and argument types correspond. + (ppc_process_before_allocation): Remove unused variables. Always + return a value. (ppc_reflo_reloc): Ifdef out. (ppc_addr32nb_reloc): Ifdef out. (ppc_coff_rtype2howto): Make fprintf strings and argument types @@ -19,13 +22,12 @@ Wed Mar 27 10:43:34 1996 Ian Lance Taylor * peicode.h (pe_print_idata): Move otherwise unused variables into the #ifdef where they are used. Always return a value. - (pe_print_edata): Change fprintf strings and add cast to make - fprintf strings correspond to actual types. Always return a - value. + (pe_print_edata): Make fprintf strings and argument types + correspond. Always return a value. (pe_print_pdata): Removed unused variable addr_value. Always return a value. (pe_print_reloc): Remove unused variable onaline. Make fprintf - strings and arguments correspond. Always return a value. + strings and argument types correspond. Always return a value. * elf32-ppc.c (ppc_elf_fake_sections): Return true. (ppc_elf_finish_dynamic_symbol): Move definition of unused @@ -43,7 +45,9 @@ Wed Mar 27 10:43:34 1996 Ian Lance Taylor * Makefile.in: Rebuild dependencies. (HFILES): Add ns32k.h. - * section.c (SEC_LINKER_MARK): Define. + * section.c (struct sec): Add linker_mark field. Change + user_set_vma and reloc_done to be single bit fields. + (STD_SECTION): Update accordingly. * bfd-in2.h: Rebuild. * aoutx.h (NAME(aout,final_link)): Mark sections included in the link. diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 07f95ac..2b8407b 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -3690,7 +3690,7 @@ NAME(aout,final_link) (abfd, info, callback) for (p = o->link_order_head; p != NULL; p = p->next) { if (p->type == bfd_indirect_link_order) - p->u.indirect.section->flags |= SEC_LINKER_MARK; + p->u.indirect.section->linker_mark = true; } } @@ -3849,10 +3849,10 @@ aout_link_input_bfd (finfo, input_bfd) return false; /* Relocate and write out the sections. These functions use the - symbol map created by aout_link_write_symbols. SEC_LINKER_MARK - will be set if these sections are to be included in the link, - which will normally be the case. */ - if ((obj_textsec (input_bfd)->flags & SEC_LINKER_MARK) != 0) + symbol map created by aout_link_write_symbols. The linker_mark + field will be set if these sections are to be included in the + link, which will normally be the case. */ + if (obj_textsec (input_bfd)->linker_mark) { if (! aout_link_input_section (finfo, input_bfd, obj_textsec (input_bfd), @@ -3860,7 +3860,7 @@ aout_link_input_bfd (finfo, input_bfd) exec_hdr (input_bfd)->a_trsize)) return false; } - if ((obj_datasec (input_bfd)->flags & SEC_LINKER_MARK) != 0) + if (obj_datasec (input_bfd)->linker_mark) { if (! aout_link_input_section (finfo, input_bfd, obj_datasec (input_bfd), diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 11cc952..148ee13 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -891,12 +891,21 @@ typedef struct sec table. */ #define SEC_SORT_ENTRIES 0x80000 - /* A mark flag used by some of the linker backends. This - should not be set by application code. */ -#define SEC_LINKER_MARK 0x100000 - /* End of section flags. */ + /* Some internal packed boolean fields. */ + + /* See the vma field. */ + unsigned int user_set_vma : 1; + + /* Whether relocations have been processed. */ + unsigned int reloc_done : 1; + + /* A mark flag used by some of the linker backends. */ + unsigned int linker_mark : 1; + + /* End of internal packed boolean fields. */ + /* The virtual memory address of the section - where it will be at run time. The symbols are relocated against this. The user_set_vma flag is maintained by bfd; if it's not set, the @@ -905,7 +914,6 @@ typedef struct sec target and various flags). */ bfd_vma vma; - boolean user_set_vma; /* The load address of the section - where it would be in a rom image; really only used for writing section header @@ -1006,7 +1014,6 @@ typedef struct sec bfd *owner; - boolean reloc_done; /* A symbol which points at this section only */ struct symbol_cache_entry *symbol; struct symbol_cache_entry **symbol_ptr_ptr; diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c index a991fe6..99c3d28 100644 --- a/bfd/coff-ppc.c +++ b/bfd/coff-ppc.c @@ -2762,7 +2762,7 @@ ppc_bfd_coff_final_link (abfd, info) link. This will normally be every section. We need to do this so that we can identify any sections which the linker has decided to not include. */ - sec->flags |= SEC_LINKER_MARK; + sec->linker_mark = true; if (info->strip == strip_none || info->strip == strip_some) diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 123685b..4cc3d50 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -495,7 +495,7 @@ _bfd_coff_final_link (abfd, info) link. This will normally be every section. We need to do this so that we can identify any sections which the linker has decided to not include. */ - sec->flags |= SEC_LINKER_MARK; + sec->linker_mark = true; if (info->strip == strip_none || info->strip == strip_some) @@ -1750,7 +1750,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd) { bfd_byte *contents; - if ((o->flags & SEC_LINKER_MARK) == 0) + if (! o->linker_mark) { /* This section was omitted from the link. */ continue; diff --git a/bfd/elflink.h b/bfd/elflink.h index d613d9d..a27f930 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -1802,7 +1802,7 @@ elf_bfd_final_link (abfd, info) link. This will normally be every section. We need to do this so that we can identify any sections which the linker has decided to not include. */ - sec->flags |= SEC_LINKER_MARK; + sec->linker_mark = true; if (info->relocateable) o->reloc_count += sec->reloc_count; @@ -2811,7 +2811,7 @@ elf_link_input_bfd (finfo, input_bfd) /* Relocate the contents of each section. */ for (o = input_bfd->sections; o != NULL; o = o->next) { - if ((o->flags & SEC_LINKER_MARK) == 0) + if (! o->linker_mark) { /* This section was omitted from the link. */ continue; diff --git a/bfd/section.c b/bfd/section.c index 840606d..469b026 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -269,12 +269,21 @@ CODE_FRAGMENT . table. *} .#define SEC_SORT_ENTRIES 0x80000 . -. {* A mark flag used by some of the linker backends. This -. should not be set by application code. *} -.#define SEC_LINKER_MARK 0x100000 -. . {* End of section flags. *} . +. {* Some internal packed boolean fields. *} +. +. {* See the vma field. *} +. unsigned int user_set_vma : 1; +. +. {* Whether relocations have been processed. *} +. unsigned int reloc_done : 1; +. +. {* A mark flag used by some of the linker backends. *} +. unsigned int linker_mark : 1; +. +. {* End of internal packed boolean fields. *} +. . {* The virtual memory address of the section - where it will be . at run time. The symbols are relocated against this. The . user_set_vma flag is maintained by bfd; if it's not set, the @@ -283,7 +292,6 @@ CODE_FRAGMENT . target and various flags). *} . . bfd_vma vma; -. boolean user_set_vma; . . {* The load address of the section - where it would be in a . rom image; really only used for writing section header @@ -384,7 +392,6 @@ CODE_FRAGMENT . . bfd *owner; . -. boolean reloc_done; . {* A symbol which points at this section only *} . struct symbol_cache_entry *symbol; . struct symbol_cache_entry **symbol_ptr_ptr; @@ -443,9 +450,9 @@ static const asymbol global_syms[] = #define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX) \ const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \ const asection SEC = \ - { NAME, 0, 0, FLAGS, 0, false, 0, 0, 0, 0, (asection *) &SEC, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (boolean) 0, \ - (asymbol *) &global_syms[IDX], (asymbol **) &SYM, } + { NAME, 0, 0, FLAGS, 0, 0, 0, 0, 0, 0, 0, 0, (asection *) &SEC, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + (asymbol *) &global_syms[IDX], (asymbol **) &SYM, 0, 0 } STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol, BFD_COM_SECTION_NAME, 0); diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index ddb9cad..681e1e2 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -3221,7 +3221,7 @@ _bfd_xcoff_bfd_final_link (abfd, info) link. This will normally be every section. We need to do this so that we can identify any sections which the linker has decided to not include. */ - sec->flags |= SEC_LINKER_MARK; + sec->linker_mark = true; if (info->strip == strip_none || info->strip == strip_some) @@ -4577,7 +4577,7 @@ xcoff_link_input_bfd (finfo, input_bfd) { bfd_byte *contents; - if ((o->flags & SEC_LINKER_MARK) == 0) + if (! o->linker_mark) { /* This section was omitted from the link. */ continue; -- 2.7.4