diff options
Diffstat (limited to 'bfd/elf64-sparc.c')
-rw-r--r-- | bfd/elf64-sparc.c | 70 |
1 files changed, 33 insertions, 37 deletions
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 905890e98a9..51f68bd0ba0 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -478,7 +478,7 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic) case because relocations against this section may use the dynamic symbol table, and in that case bfd_section_from_shdr in elf.c does not update the RELOC_COUNT. */ - if (asect->_raw_size == 0) + if (asect->size == 0) return TRUE; rel_hdr = &d->this_hdr; @@ -794,6 +794,7 @@ init_insn_reloc (abfd, bfd_vma *pinsn; { bfd_vma relocation; + bfd_size_type sz; reloc_howto_type *howto = reloc_entry->howto; if (output_bfd != (bfd *) NULL @@ -809,7 +810,8 @@ init_insn_reloc (abfd, if (output_bfd != NULL) return bfd_reloc_continue; - if (reloc_entry->address > input_section->_cooked_size) + sz = input_section->rawsize ? input_section->rawsize : input_section->size; + if (reloc_entry->address > sz) return bfd_reloc_outofrange; relocation = (symbol->value @@ -1173,7 +1175,7 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs) /* We have already allocated space in the .got. */ break; } - h->got.offset = sgot->_raw_size; + h->got.offset = sgot->size; /* Make sure this symbol is output as a dynamic symbol. */ if (h->dynindx == -1) @@ -1182,7 +1184,7 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs) return FALSE; } - srelgot->_raw_size += sizeof (Elf64_External_Rela); + srelgot->size += sizeof (Elf64_External_Rela); } else { @@ -1207,18 +1209,18 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs) /* We have already allocated space in the .got. */ break; } - local_got_offsets[r_symndx] = sgot->_raw_size; + local_got_offsets[r_symndx] = sgot->size; if (info->shared) { /* If we are generating a shared object, we need to output a R_SPARC_RELATIVE reloc so that the dynamic linker can adjust this GOT entry. */ - srelgot->_raw_size += sizeof (Elf64_External_Rela); + srelgot->size += sizeof (Elf64_External_Rela); } } - sgot->_raw_size += 8; + sgot->size += 8; #if 0 /* Doesn't work for 64-bit -fPIC, since sethi/or builds @@ -1229,7 +1231,7 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs) /* If the .got section is more than 0x1000 bytes, we add 0x1000 to the value of _GLOBAL_OFFSET_TABLE_, so that 13 bit relocations have a greater chance of working. */ - if (sgot->_raw_size >= 0x1000 + if (sgot->size >= 0x1000 && elf_hash_table (info)->hgot->root.u.def.value == 0) elf_hash_table (info)->hgot->root.u.def.value = 0x1000; #endif @@ -1359,7 +1361,7 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs) info->flags |= DF_TEXTREL; } - sreloc->_raw_size += sizeof (Elf64_External_Rela); + sreloc->size += sizeof (Elf64_External_Rela); } break; @@ -1653,11 +1655,11 @@ sparc64_elf_adjust_dynamic_symbol (info, h) BFD_ASSERT (s != NULL); /* The first four bit in .plt is reserved. */ - if (s->_raw_size == 0) - s->_raw_size = PLT_HEADER_SIZE; + if (s->size == 0) + s->size = PLT_HEADER_SIZE; /* To simplify matters later, just store the plt index here. */ - h->plt.offset = s->_raw_size / PLT_ENTRY_SIZE; + h->plt.offset = 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 @@ -1672,18 +1674,18 @@ sparc64_elf_adjust_dynamic_symbol (info, h) } /* 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 .rela.plt section. */ s = bfd_get_section_by_name (dynobj, ".rela.plt"); BFD_ASSERT (s != NULL); - s->_raw_size += sizeof (Elf64_External_Rela); + s->size += sizeof (Elf64_External_Rela); /* The procedure linkage table size is bounded by the magnitude of the offset we can describe in the entry. */ - if (s->_raw_size >= (bfd_vma)1 << 32) + if (s->size >= (bfd_vma)1 << 32) { bfd_set_error (bfd_error_bad_value); return FALSE; @@ -1737,7 +1739,7 @@ sparc64_elf_adjust_dynamic_symbol (info, h) srel = bfd_get_section_by_name (dynobj, ".rela.bss"); BFD_ASSERT (srel != NULL); - srel->_raw_size += sizeof (Elf64_External_Rela); + srel->size += sizeof (Elf64_External_Rela); h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; } @@ -1749,8 +1751,7 @@ sparc64_elf_adjust_dynamic_symbol (info, h) power_of_two = 4; /* 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)) @@ -1759,10 +1760,10 @@ sparc64_elf_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; } @@ -1788,7 +1789,7 @@ sparc64_elf_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; } } @@ -1801,7 +1802,7 @@ sparc64_elf_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; } /* The check_relocs and adjust_dynamic_symbol entry points have @@ -1824,7 +1825,7 @@ sparc64_elf_size_dynamic_sections (output_bfd, info) 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 to handle .rela.bss and @@ -1863,8 +1864,8 @@ sparc64_elf_size_dynamic_sections (output_bfd, info) /* Allocate memory for the section contents. Zero the memory for the benefit of .rela.plt, which has 4 unused entries at the beginning, and we don't want garbage. */ - 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; } @@ -2517,7 +2518,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_SPARC_WDISP30: do_wplt30: if (sec_do_relax (input_section) - && rel->r_offset + 4 < input_section->_raw_size) + && rel->r_offset + 4 < input_section->size) { #define G0 0 #define O7 15 @@ -2724,7 +2725,7 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym) } else { - bfd_vma max = splt->_raw_size / PLT_ENTRY_SIZE; + bfd_vma max = splt->size / PLT_ENTRY_SIZE; rela.r_offset = sparc64_elf_plt_ptr_offset (h->plt.offset, max); rela.r_addend = -(sparc64_elf_plt_entry_offset (h->plt.offset) + 4) -(splt->output_section->vma + splt->output_offset); @@ -2857,7 +2858,7 @@ sparc64_elf_finish_dynamic_sections (output_bfd, info) BFD_ASSERT (splt != NULL && sdyn != NULL); dyncon = (Elf64_External_Dyn *) sdyn->contents; - dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size); for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; @@ -2897,21 +2898,16 @@ sparc64_elf_finish_dynamic_sections (output_bfd, info) if (! size) dyn.d_un.d_ptr = s->vma; 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_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); } } /* Initialize the contents of the .plt section. */ - if (splt->_raw_size > 0) + if (splt->size > 0) sparc64_elf_build_plt (output_bfd, splt->contents, - (int) (splt->_raw_size / PLT_ENTRY_SIZE)); + (int) (splt->size / PLT_ENTRY_SIZE)); elf_section_data (splt->output_section)->this_hdr.sh_entsize = PLT_ENTRY_SIZE; @@ -2921,7 +2917,7 @@ sparc64_elf_finish_dynamic_sections (output_bfd, info) the dynamic section. */ sgot = bfd_get_section_by_name (dynobj, ".got"); BFD_ASSERT (sgot != NULL); - if (sgot->_raw_size > 0) + if (sgot->size > 0) { if (sdyn == NULL) bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents); |