diff options
Diffstat (limited to 'bfd/elf32-cris.c')
-rw-r--r-- | bfd/elf32-cris.c | 90 |
1 files changed, 41 insertions, 49 deletions
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index 775fd0e7c3..ab98304be5 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -475,7 +475,7 @@ cris_elf_grok_prstatus (abfd, note) Elf_Internal_Note *note; { int offset; - size_t raw_size; + size_t size; switch (note->descsz) { @@ -491,14 +491,14 @@ cris_elf_grok_prstatus (abfd, note) /* pr_reg */ offset = 70; - raw_size = 140; + size = 140; break; } /* Make a ".reg/999" section. */ return _bfd_elfcore_make_pseudosection (abfd, ".reg", - raw_size, note->descpos + offset); + size, note->descpos + offset); } static bfd_boolean @@ -1645,7 +1645,7 @@ elf_cris_finish_dynamic_sections (output_bfd, info) BFD_ASSERT (splt != NULL && sdyn != NULL); dyncon = (Elf32_External_Dyn *) sdyn->contents; - dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size); for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; @@ -1677,10 +1677,8 @@ elf_cris_finish_dynamic_sections (output_bfd, info) s = bfd_get_section_by_name (output_bfd, ".rela.plt"); if (s == NULL) dyn.d_un.d_val = 0; - else if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size; else - dyn.d_un.d_val = s->_raw_size; + dyn.d_un.d_val = s->size; bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; @@ -1694,19 +1692,14 @@ elf_cris_finish_dynamic_sections (output_bfd, info) about changing the DT_RELA entry. */ s = bfd_get_section_by_name (output_bfd, ".rela.plt"); if (s != NULL) - { - if (s->_cooked_size != 0) - dyn.d_un.d_val -= s->_cooked_size; - else - dyn.d_un.d_val -= s->_raw_size; - } + dyn.d_un.d_val -= s->size; bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; } } /* Fill in the first entry in the procedure linkage table. */ - if (splt->_raw_size > 0) + if (splt->size > 0) { if (info->shared) memcpy (splt->contents, elf_cris_pic_plt0_entry, PLT_ENTRY_SIZE); @@ -1727,7 +1720,7 @@ elf_cris_finish_dynamic_sections (output_bfd, info) } /* Fill in the first three entries in the global offset table. */ - if (sgot->_raw_size > 0) + if (sgot->size > 0) { if (sdyn == NULL) bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); @@ -1832,8 +1825,8 @@ cris_elf_gc_sweep_hook (abfd, info, sec, relocs) if (h->got.refcount == 0) { /* We don't need the .got entry any more. */ - sgot->_raw_size -= 4; - srelgot->_raw_size -= sizeof (Elf32_External_Rela); + sgot->size -= 4; + srelgot->size -= sizeof (Elf32_External_Rela); } } break; @@ -1848,9 +1841,9 @@ cris_elf_gc_sweep_hook (abfd, info, sec, relocs) if (local_got_refcounts[r_symndx] == 0) { /* We don't need the .got entry any more. */ - sgot->_raw_size -= 4; + sgot->size -= 4; if (info->shared) - srelgot->_raw_size -= sizeof (Elf32_External_Rela); + srelgot->size -= sizeof (Elf32_External_Rela); } } } @@ -1939,10 +1932,10 @@ elf_cris_adjust_gotplt_to_got (h, p) BFD_ASSERT (sgot != NULL && srelgot != NULL); /* Allocate space in the .got section. */ - sgot->_raw_size += 4; + sgot->size += 4; /* Allocate relocation space. */ - srelgot->_raw_size += sizeof (Elf32_External_Rela); + srelgot->size += sizeof (Elf32_External_Rela); } return TRUE; @@ -2104,8 +2097,8 @@ elf_cris_adjust_dynamic_symbol (info, h) /* If this is the first .plt entry, make room for the special first entry. */ - if (s->_raw_size == 0) - s->_raw_size += PLT_ENTRY_SIZE; + if (s->size == 0) + s->size += PLT_ENTRY_SIZE; /* If this symbol is not defined in a regular file, and we are not generating a shared library, then set the symbol to this @@ -2114,7 +2107,7 @@ elf_cris_adjust_dynamic_symbol (info, h) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) { h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; + h->root.u.def.value = s->size; } /* If there's already a GOT entry, use that, not a .got.plt. A @@ -2130,10 +2123,10 @@ elf_cris_adjust_dynamic_symbol (info, h) /* Mark the PLT offset to use the GOT entry by setting the low bit in the plt offset; it is always a multiple of pointer-size. */ - BFD_ASSERT ((s->_raw_size & 3) == 0); + BFD_ASSERT ((s->size & 3) == 0); /* Change the PLT refcount to an offset. */ - h->plt.offset = s->_raw_size; + h->plt.offset = s->size; /* By not setting gotplt_offset (i.e. it remains at 0), we signal that the got entry should be used instead. */ @@ -2141,16 +2134,16 @@ elf_cris_adjust_dynamic_symbol (info, h) h)->gotplt_offset == 0); /* Make room for this entry. */ - s->_raw_size += PLT_ENTRY_SIZE; + s->size += PLT_ENTRY_SIZE; return TRUE; } /* No GOT reference for this symbol; prepare for an ordinary PLT. */ - h->plt.offset = s->_raw_size; + h->plt.offset = s->size; /* Make room for this entry. */ - s->_raw_size += PLT_ENTRY_SIZE; + s->size += PLT_ENTRY_SIZE; /* We also need to make an entry in the .got.plt section, which will be placed in the .got section by the linker script. */ @@ -2160,13 +2153,13 @@ elf_cris_adjust_dynamic_symbol (info, h) s = bfd_get_section_by_name (dynobj, ".got.plt"); BFD_ASSERT (s != NULL); - s->_raw_size += 4; + s->size += 4; /* We also need to make an entry in the .rela.plt section. */ s = bfd_get_section_by_name (dynobj, ".rela.plt"); BFD_ASSERT (s != NULL); - s->_raw_size += sizeof (Elf32_External_Rela); + s->size += sizeof (Elf32_External_Rela); return TRUE; } @@ -2225,7 +2218,7 @@ elf_cris_adjust_dynamic_symbol (info, h) srel = bfd_get_section_by_name (dynobj, ".rela.bss"); BFD_ASSERT (srel != NULL); - srel->_raw_size += sizeof (Elf32_External_Rela); + srel->size += sizeof (Elf32_External_Rela); h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; } @@ -2239,8 +2232,7 @@ elf_cris_adjust_dynamic_symbol (info, h) power_of_two = 3; /* Apply the required alignment. */ - s->_raw_size = BFD_ALIGN (s->_raw_size, - (bfd_size_type) (1 << power_of_two)); + s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); if (power_of_two > bfd_get_section_alignment (dynobj, s)) { if (!bfd_set_section_alignment (dynobj, s, power_of_two)) @@ -2249,10 +2241,10 @@ elf_cris_adjust_dynamic_symbol (info, h) /* Define the symbol as being at this point in the section. */ h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; + h->root.u.def.value = s->size; /* Increment the section size to make room for the symbol. */ - s->_raw_size += h->size; + s->size += h->size; return TRUE; } @@ -2427,9 +2419,9 @@ cris_elf_check_relocs (abfd, info, sec, relocs) } /* Allocate space in the .got section. */ - sgot->_raw_size += 4; + sgot->size += 4; /* Allocate relocation space. */ - srelgot->_raw_size += sizeof (Elf32_External_Rela); + srelgot->size += sizeof (Elf32_External_Rela); } h->got.refcount++; } @@ -2438,13 +2430,13 @@ cris_elf_check_relocs (abfd, info, sec, relocs) /* This is a global offset table entry for a local symbol. */ if (local_got_refcounts[r_symndx] == 0) { - sgot->_raw_size += 4; + sgot->size += 4; if (info->shared) { /* If we are generating a shared object, we need to output a R_CRIS_RELATIVE reloc so that the dynamic linker can adjust this GOT entry. */ - srelgot->_raw_size += sizeof (Elf32_External_Rela); + srelgot->size += sizeof (Elf32_External_Rela); } } local_got_refcounts[r_symndx]++; @@ -2599,7 +2591,7 @@ cris_elf_check_relocs (abfd, info, sec, relocs) info->flags |= DF_TEXTREL; } - sreloc->_raw_size += sizeof (Elf32_External_Rela); + sreloc->size += sizeof (Elf32_External_Rela); /* If we are linking with -Bsymbolic, we count the number of PC relative relocations we have entered for this symbol, so that @@ -2682,7 +2674,7 @@ elf_cris_size_dynamic_sections (output_bfd, info) { s = bfd_get_section_by_name (dynobj, ".interp"); BFD_ASSERT (s != NULL); - s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->size = sizeof ELF_DYNAMIC_INTERPRETER; s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; } } @@ -2700,7 +2692,7 @@ elf_cris_size_dynamic_sections (output_bfd, info) below. */ s = bfd_get_section_by_name (dynobj, ".rela.got"); if (s != NULL) - s->_raw_size = 0; + s->size = 0; } /* If this is a -Bsymbolic shared link, then we need to discard all PC @@ -2740,7 +2732,7 @@ elf_cris_size_dynamic_sections (output_bfd, info) if (strcmp (name, ".plt") == 0) { - if (s->_raw_size == 0) + if (s->size == 0) { /* Strip this section if we don't need it; see the comment below. */ @@ -2754,7 +2746,7 @@ elf_cris_size_dynamic_sections (output_bfd, info) } else if (strncmp (name, ".rela", 5) == 0) { - if (s->_raw_size == 0) + if (s->size == 0) { /* If we don't need this section, strip it from the output file. This is mostly to handle .rela.bss and @@ -2796,8 +2788,8 @@ elf_cris_size_dynamic_sections (output_bfd, info) contents are written out. This should not happen, but this way if it does, we will not write out garbage. For reloc sections, this will make entries have the type R_CRIS_NONE. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size); + if (s->contents == NULL && s->size != 0) return FALSE; } @@ -2874,7 +2866,7 @@ elf_cris_discard_excess_dso_dynamics (h, inf) || info->symbolic)) { for (s = h->pcrel_relocs_copied; s != NULL; s = s->next) - s->section->_raw_size -= s->count * sizeof (Elf32_External_Rela); + s->section->size -= s->count * sizeof (Elf32_External_Rela); } return TRUE; @@ -2917,7 +2909,7 @@ elf_cris_discard_excess_program_dynamics (h, inf) BFD_ASSERT (srelgot != NULL); - srelgot->_raw_size -= sizeof (Elf32_External_Rela); + srelgot->size -= sizeof (Elf32_External_Rela); } /* If the locally-defined symbol isn't used by a DSO, then we don't |