X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Felf32-i370.c;h=f4cd9c15c8f28e6dc21e72816fe0a9b447b0fd21;hb=5a84f3e0d225c671f13d8571f035283012dc6448;hp=f78292500813973aec20e52bc8db1ab11851407d;hpb=555cd47695349e40eb1fe06ac707d2f278d63021;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index f782925008..f4cd9c15c8 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -367,8 +367,8 @@ i370_elf_merge_private_bfd_data (ibfd, obfd) else /* Incompatible flags */ { (*_bfd_error_handler) - ("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)", - bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags); + ("%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)", + ibfd, (long) new_flags, (long) old_flags); bfd_set_error (bfd_error_bad_value); return FALSE; @@ -500,28 +500,25 @@ i370_elf_adjust_dynamic_symbol (info, h) /* Make sure we know what is going on here. */ BFD_ASSERT (dynobj != NULL - && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) - || h->weakdef != NULL - || ((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))); + && (h->needs_plt + || h->u.weakdef != NULL + || (h->def_dynamic + && h->ref_regular + && !h->def_regular))); s = bfd_get_section_by_name (dynobj, ".rela.text"); BFD_ASSERT (s != NULL); - s->_raw_size += sizeof (Elf32_External_Rela); + s->size += sizeof (Elf32_External_Rela); /* If this is a weak symbol, and there is a real definition, the processor independent code will have arranged for us to see the real definition first, and we can just use the same value. */ - if (h->weakdef != NULL) + if (h->u.weakdef != NULL) { - BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined - || h->weakdef->root.type == bfd_link_hash_defweak); - h->root.u.def.section = h->weakdef->root.u.def.section; - h->root.u.def.value = h->weakdef->root.u.def.value; + BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined + || h->u.weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->u.weakdef->root.u.def.section; + h->root.u.def.value = h->u.weakdef->root.u.def.value; return TRUE; } @@ -568,8 +565,8 @@ i370_elf_adjust_dynamic_symbol (info, h) else srel = bfd_get_section_by_name (dynobj, ".rela.bss"); BFD_ASSERT (srel != NULL); - srel->_raw_size += sizeof (Elf32_External_Rela); - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + srel->size += sizeof (Elf32_External_Rela); + h->needs_copy = 1; } /* We need to figure out the alignment required for this symbol. I @@ -579,8 +576,7 @@ i370_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)) @@ -589,10 +585,10 @@ i370_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; } @@ -657,7 +653,7 @@ i370_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; } } @@ -677,7 +673,7 @@ i370_elf_size_dynamic_sections (output_bfd, info) { s = bfd_get_section_by_name (dynobj, *p); if (s != NULL) - s->_raw_size = 0; + s->size = 0; } } @@ -702,7 +698,7 @@ i370_elf_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. */ @@ -716,7 +712,7 @@ i370_elf_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 @@ -778,8 +774,8 @@ i370_elf_size_dynamic_sections (output_bfd, info) continue; } /* Allocate memory for the section contents. */ - 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; } @@ -892,9 +888,8 @@ i370_elf_check_relocs (abfd, info, sec, relocs) return TRUE; #ifdef DEBUG - fprintf (stderr, "i370_elf_check_relocs called for section %s in %s\n", - bfd_get_section_name (abfd, sec), - bfd_archive_filename (abfd)); + _bfd_error_handler ("i370_elf_check_relocs called for section %A in %B", + sec, abfd); #endif dynobj = elf_hash_table (info)->dynobj; @@ -955,7 +950,7 @@ i370_elf_check_relocs (abfd, info, sec, relocs) } } - sreloc->_raw_size += sizeof (Elf32_External_Rela); + sreloc->size += sizeof (Elf32_External_Rela); /* FIXME: We should here do what the m68k and i386 backends do: if the reloc is pc-relative, record it @@ -999,7 +994,7 @@ i370_elf_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; @@ -1028,12 +1023,7 @@ i370_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_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); } @@ -1162,11 +1152,10 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, return TRUE; #ifdef DEBUG - fprintf (stderr, "i370_elf_relocate_section called for %s section %s, %ld relocations%s\n", - bfd_archive_filename (input_bfd), - bfd_section_name(input_bfd, input_section), - (long) input_section->reloc_count, - (info->relocatable) ? " (relocatable)" : ""); + _bfd_error_handler ("i370_elf_relocate_section called for %B section %A, %ld relocations%s", + input_bfd, input_section, + (long) input_section->reloc_count, + (info->relocatable) ? " (relocatable)" : ""); #endif if (!i370_elf_howto_table[ R_I370_ADDR31 ]) /* Initialize howto table if needed */ @@ -1192,8 +1181,8 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, if ((unsigned)r_type >= (unsigned)R_I370_max || !i370_elf_howto_table[(int)r_type]) { - (*_bfd_error_handler) ("%s: unknown relocation type %d", - bfd_archive_filename (input_bfd), + (*_bfd_error_handler) ("%B: unknown relocation type %d", + input_bfd, (int) r_type); bfd_set_error (bfd_error_bad_value); @@ -1226,8 +1215,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, sec = h->root.u.def.section; if (info->shared && ((! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0) + || !h->def_regular) && (input_section->flags & SEC_ALLOC) != 0 && (r_type == R_I370_ADDR31 || r_type == R_I370_COPY @@ -1268,9 +1256,8 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, { default: (*_bfd_error_handler) - ("%s: unknown relocation type %d for symbol %s", - bfd_archive_filename (input_bfd), - (int) r_type, sym_name); + ("%B: unknown relocation type %d for symbol %s", + input_bfd, (int) r_type, sym_name); bfd_set_error (bfd_error_bad_value); ret = FALSE; @@ -1347,8 +1334,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, become local. */ else if (h != NULL && ((! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) + || !h->def_regular)) { BFD_ASSERT (h->dynindx != -1); outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); @@ -1411,8 +1397,8 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, case (int)R_I370_COPY: case (int)R_I370_RELATIVE: (*_bfd_error_handler) - ("%s: Relocation %s is not yet supported for symbol %s.", - bfd_archive_filename (input_bfd), + ("%B: Relocation %s is not yet supported for symbol %s.", + input_bfd, i370_elf_howto_table[(int) r_type]->name, sym_name); @@ -1452,7 +1438,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, const char *name; if (h != NULL) - name = h->root.root.string; + name = NULL; else { name = bfd_elf_string_from_elf_section (input_bfd, @@ -1466,6 +1452,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, } (*info->callbacks->reloc_overflow) (info, + (h ? &h->root : NULL), name, howto->name, (bfd_vma) 0,