diff options
Diffstat (limited to 'bfd/elf32-s390.c')
-rw-r--r-- | bfd/elf32-s390.c | 540 |
1 files changed, 260 insertions, 280 deletions
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index e8d94af..857b7a0 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -1,5 +1,5 @@ /* IBM S/390-specific support for 32-bit ELF - Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Carl B. Pedersen and Martin Schwidefsky. This file is part of BFD, the Binary File Descriptor library. @@ -351,7 +351,7 @@ elf_s390_info_to_howto (abfd, cache_ptr, dst) /* A relocation function which doesn't do anything. */ static bfd_reloc_status_type s390_tls_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) + output_bfd, error_message) bfd *abfd ATTRIBUTE_UNUSED; arelent *reloc_entry; asymbol *symbol ATTRIBUTE_UNUSED; @@ -935,7 +935,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs) && local_got_refcounts == NULL) { bfd_size_type size; - + size = symtab_hdr->sh_info; size *= (sizeof (bfd_signed_vma) + sizeof(char)); local_got_refcounts = ((bfd_signed_vma *) @@ -969,20 +969,20 @@ elf_s390_check_relocs (abfd, info, sec, relocs) /* Got is created, nothing to be done. */ break; - case R_390_PLT16DBL: - case R_390_PLT32DBL: + case R_390_PLT16DBL: + case R_390_PLT32DBL: case R_390_PLT32: case R_390_PLTOFF16: case R_390_PLTOFF32: /* This symbol requires a procedure linkage table entry. We - actually build the entry in adjust_dynamic_symbol, - because this might be a case of linking PIC code which is - never referenced by a dynamic object, in which case we - don't need to generate a procedure linkage table entry - after all. */ + actually build the entry in adjust_dynamic_symbol, + because this might be a case of linking PIC code which is + never referenced by a dynamic object, in which case we + don't need to generate a procedure linkage table entry + after all. */ /* If this is a local symbol, we resolve it directly without - creating a procedure linkage table entry. */ + creating a procedure linkage table entry. */ if (h != NULL) { h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; @@ -1022,10 +1022,10 @@ elf_s390_check_relocs (abfd, info, sec, relocs) case R_390_TLS_IEENT: if (info->shared) info->flags |= DF_STATIC_TLS; - /* Fall through */ + /* Fall through. */ case R_390_GOT12: - case R_390_GOT16: + case R_390_GOT16: case R_390_GOT32: case R_390_GOTENT: case R_390_TLS_GD32: @@ -1087,19 +1087,19 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (r_type != R_390_TLS_IE32) break; - /* Fall through */ + /* Fall through. */ case R_390_TLS_LE32: if (!info->shared) break; info->flags |= DF_STATIC_TLS; - /* Fall through */ + /* Fall through. */ - case R_390_8: - case R_390_16: + case R_390_8: + case R_390_16: case R_390_32: - case R_390_PC16: - case R_390_PC16DBL: + case R_390_PC16: + case R_390_PC16DBL: case R_390_PC32DBL: case R_390_PC32: if (h != NULL && !info->shared) @@ -1216,8 +1216,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs) /* Track dynamic relocs needed for local syms too. We really need local syms available to do this easily. Oh well. */ - asection *s; + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, r_symndx); if (s == NULL) @@ -1231,6 +1231,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (p == NULL || p->sec != sec) { bfd_size_type amt = sizeof *p; + p = ((struct elf_s390_dyn_relocs *) bfd_alloc (htab->elf.dynobj, amt)); if (p == NULL) @@ -1253,17 +1254,17 @@ elf_s390_check_relocs (abfd, info, sec, relocs) /* This relocation describes the C++ object vtable hierarchy. Reconstruct it for later use during GC. */ - case R_390_GNU_VTINHERIT: - if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) - return FALSE; - break; + case R_390_GNU_VTINHERIT: + if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ - case R_390_GNU_VTENTRY: - if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend)) - return FALSE; - break; + case R_390_GNU_VTENTRY: + if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; default: break; @@ -1326,9 +1327,6 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs) struct elf_link_hash_entry **sym_hashes; bfd_signed_vma *local_got_refcounts; const Elf_Internal_Rela *rel, *relend; - unsigned long r_symndx; - int r_type; - struct elf_link_hash_entry *h; elf_section_data (sec)->local_dynrel = NULL; @@ -1339,16 +1337,31 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs) relend = relocs + sec->reloc_count; for (rel = relocs; rel < relend; rel++) { + unsigned long r_symndx; + unsigned int r_type; + struct elf_link_hash_entry *h = NULL; + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + struct elf_s390_link_hash_entry *eh; + struct elf_s390_dyn_relocs **pp; + struct elf_s390_dyn_relocs *p; - if (r_symndx < symtab_hdr->sh_info) - h = NULL; - else - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + eh = (struct elf_s390_link_hash_entry *) h; - r_type = elf_s390_tls_transition (info, - ELF32_R_TYPE (rel->r_info), - r_symndx >= symtab_hdr->sh_info); + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { + /* Everything must go for SEC. */ + *pp = p->next; + break; + } + } + + r_type = ELF32_R_TYPE (rel->r_info); + r_type = elf_s390_tls_transition (info, r_type, h != NULL); switch (r_type) { case R_390_TLS_LDM32: @@ -1379,14 +1392,7 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs) if (local_got_refcounts[r_symndx] > 0) local_got_refcounts[r_symndx] -= 1; } - if (r_type != R_390_TLS_IE32) - break; - /* Fall through */ - - case R_390_TLS_LE32: - if (!info->shared) - break; - /* Fall through */ + break; case R_390_8: case R_390_12: @@ -1396,33 +1402,10 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs) case R_390_PC16DBL: case R_390_PC32DBL: case R_390_PC32: - if (h != NULL) - { - struct elf_s390_link_hash_entry *eh; - struct elf_s390_dyn_relocs **pp; - struct elf_s390_dyn_relocs *p; - - if (!info->shared && h->plt.refcount > 0) - h->plt.refcount -= 1; - - eh = (struct elf_s390_link_hash_entry *) h; - - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) - if (p->sec == sec) - { - if (ELF32_R_TYPE (rel->r_info) == R_390_PC16 - || ELF32_R_TYPE (rel->r_info) == R_390_PC16DBL - || ELF32_R_TYPE (rel->r_info) == R_390_PC32DBL - || ELF32_R_TYPE (rel->r_info) == R_390_PC32) - p->pc_count -= 1; - p->count -= 1; - if (p->count == 0) - *pp = p->next; - break; - } - } - break; - + if (info->shared) + break; + /* Fall through. */ + case R_390_PLT16DBL: case R_390_PLT32DBL: case R_390_PLT32: @@ -1516,8 +1499,8 @@ elf_s390_adjust_dynamic_symbol (info, h) && h->root.type != bfd_link_hash_undefined)) { /* This case can occur if we saw a PLT32 reloc in an input - file, but the symbol was never referred to by a dynamic - object, or if all references were garbage collected. In + file, but the symbol was never referred to by a dynamic + object, or if all references were garbage collected. In such a case, we don't actually need to build a procedure linkage table, and we can just do a PC32 reloc instead. */ h->plt.offset = (bfd_vma) -1; @@ -1847,6 +1830,7 @@ allocate_dynrelocs (h, inf) for (p = eh->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; + sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela); } @@ -2014,7 +1998,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) } else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) { - if (s->_raw_size != 0 && s != htab->srelplt) + if (s->_raw_size != 0) relocs = TRUE; /* We use the reloc_count field as a counter if we need @@ -2079,10 +2063,10 @@ elf_s390_size_dynamic_sections (output_bfd, info) } if (relocs) - { - if (!add_dynamic_entry (DT_RELA, 0) - || !add_dynamic_entry (DT_RELASZ, 0) - || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) + { + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) return FALSE; /* If any dynamic relocs apply to a read-only section, @@ -2202,8 +2186,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, r_type = ELF32_R_TYPE (rel->r_info); if (r_type == (int) R_390_GNU_VTINHERIT - || r_type == (int) R_390_GNU_VTENTRY) - continue; + || r_type == (int) R_390_GNU_VTENTRY) + continue; if (r_type >= (int) R_390_max) { bfd_set_error (bfd_error_bad_value); @@ -2252,7 +2236,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; else if (info->shared - && (!info->symbolic || info->allow_shlib_undefined) && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; @@ -2260,7 +2243,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, + input_section, rel->r_offset, (!info->shared || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return FALSE; @@ -2291,7 +2274,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, Current offset - size first entry / entry size. */ plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) / PLT_ENTRY_SIZE; - + /* Offset in GOT is PLT index plus GOT headers(3) times 4, addr & GOT addr. */ relocation = (plt_index + 3) * GOT_ENTRY_SIZE; @@ -2303,164 +2286,162 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, } /* Fall through. */ - case R_390_GOT12: - case R_390_GOT16: - case R_390_GOT32: + case R_390_GOT12: + case R_390_GOT16: + case R_390_GOT32: case R_390_GOTENT: - /* Relocation is to the entry for this symbol in the global - offset table. */ + /* Relocation is to the entry for this symbol in the global + offset table. */ if (htab->sgot == NULL) abort (); - if (h != NULL) - { + if (h != NULL) + { bfd_boolean dyn; - off = h->got.offset; + off = h->got.offset; dyn = htab->elf.dynamic_sections_created; - if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h) - || (info->shared - && (info->symbolic + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h) + || (info->shared + && (info->symbolic || h->dynindx == -1 || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - { - /* This is actually a static link, or it is a - -Bsymbolic link and the symbol is defined - locally, or the symbol was forced to be local - because of a version file. We must initialize - this entry in the global offset table. Since the - offset must always be a multiple of 2, we use the - least significant bit to record whether we have - initialized it already. - - When doing a dynamic link, we create a .rel.got - relocation entry to initialize the value. This - is done in the finish_dynamic_symbol routine. */ - if ((off & 1) != 0) - off &= ~1; - else - { + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + { + /* This is actually a static link, or it is a + -Bsymbolic link and the symbol is defined + locally, or the symbol was forced to be local + because of a version file. We must initialize + this entry in the global offset table. Since the + offset must always be a multiple of 2, we use the + least significant bit to record whether we have + initialized it already. + + When doing a dynamic link, we create a .rel.got + relocation entry to initialize the value. This + is done in the finish_dynamic_symbol routine. */ + if ((off & 1) != 0) + off &= ~1; + else + { bfd_put_32 (output_bfd, relocation, htab->sgot->contents + off); - h->got.offset |= 1; - } - } + h->got.offset |= 1; + } + } else unresolved_reloc = FALSE; - } - else - { + } + else + { if (local_got_offsets == NULL) abort (); - off = local_got_offsets[r_symndx]; + off = local_got_offsets[r_symndx]; - /* The offset must always be a multiple of 4. We use - the least significant bit to record whether we have - already generated the necessary reloc. */ - if ((off & 1) != 0) - off &= ~1; - else - { - bfd_put_32 (output_bfd, relocation, + /* The offset must always be a multiple of 4. We use + the least significant bit to record whether we have + already generated the necessary reloc. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_32 (output_bfd, relocation, htab->sgot->contents + off); - if (info->shared) - { - asection *srelgot; - Elf_Internal_Rela outrel; + if (info->shared) + { + asection *srelgot; + Elf_Internal_Rela outrel; bfd_byte *loc; - srelgot = htab->srelgot; + srelgot = htab->srelgot; if (srelgot == NULL) abort (); - outrel.r_offset = (htab->sgot->output_section->vma - + htab->sgot->output_offset - + off); - outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE); + outrel.r_offset = (htab->sgot->output_section->vma + + htab->sgot->output_offset + + off); + outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE); outrel.r_addend = relocation; loc = srelgot->contents; loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); - } + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + } - local_got_offsets[r_symndx] |= 1; - } - } + local_got_offsets[r_symndx] |= 1; + } + } if (off >= (bfd_vma) -2) abort (); relocation = htab->sgot->output_offset + off; - /* - * For @GOTENT the relocation is against the offset between - * the instruction and the symbols entry in the GOT and not - * between the start of the GOT and the symbols entry. We - * add the vma of the GOT to get the correct value. - */ + /* For @GOTENT the relocation is against the offset between + the instruction and the symbols entry in the GOT and not + between the start of the GOT and the symbols entry. We + add the vma of the GOT to get the correct value. */ if ( r_type == R_390_GOTENT || r_type == R_390_GOTPLTENT) relocation += htab->sgot->output_section->vma; - break; + break; case R_390_GOTOFF16: - case R_390_GOTOFF32: - /* Relocation is relative to the start of the global offset - table. */ - - /* Note that sgot->output_offset is not involved in this - calculation. We always want the start of .got. If we - defined _GLOBAL_OFFSET_TABLE in a different way, as is - permitted by the ABI, we might have to change this - calculation. */ - relocation -= htab->sgot->output_section->vma; - break; - - case R_390_GOTPC: + case R_390_GOTOFF32: + /* Relocation is relative to the start of the global offset + table. */ + + /* Note that sgot->output_offset is not involved in this + calculation. We always want the start of .got. If we + defined _GLOBAL_OFFSET_TABLE in a different way, as is + permitted by the ABI, we might have to change this + calculation. */ + relocation -= htab->sgot->output_section->vma; + break; + + case R_390_GOTPC: case R_390_GOTPCDBL: - /* Use global offset table as symbol value. */ - relocation = htab->sgot->output_section->vma; + /* Use global offset table as symbol value. */ + relocation = htab->sgot->output_section->vma; unresolved_reloc = FALSE; - break; + break; - case R_390_PLT16DBL: - case R_390_PLT32DBL: - case R_390_PLT32: - /* Relocation is to the entry for this symbol in the - procedure linkage table. */ + case R_390_PLT16DBL: + case R_390_PLT32DBL: + case R_390_PLT32: + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ - /* Resolve a PLT32 reloc against a local symbol directly, - without using the procedure linkage table. */ - if (h == NULL) - break; + /* Resolve a PLT32 reloc against a local symbol directly, + without using the procedure linkage table. */ + if (h == NULL) + break; - if (h->plt.offset == (bfd_vma) -1 + if (h->plt.offset == (bfd_vma) -1 || htab->splt == NULL) - { - /* We didn't make a PLT entry for this symbol. This - happens when statically linking PIC code, or when - using -Bsymbolic. */ - break; - } - - relocation = (htab->splt->output_section->vma - + htab->splt->output_offset - + h->plt.offset); + { + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when + using -Bsymbolic. */ + break; + } + + relocation = (htab->splt->output_section->vma + + htab->splt->output_offset + + h->plt.offset); unresolved_reloc = FALSE; - break; + break; case R_390_PLTOFF16: case R_390_PLTOFF32: - /* Relocation is to the entry for this symbol in the - procedure linkage table relative to the start of the GOT. */ + /* Relocation is to the entry for this symbol in the + procedure linkage table relative to the start of the GOT. */ /* For local symbols or if we didn't make a PLT entry for this symbol resolve the symbol directly. */ - if ( h == NULL + if ( h == NULL || h->plt.offset == (bfd_vma) -1 || htab->splt == NULL) { @@ -2468,28 +2449,28 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, break; } - relocation = (htab->splt->output_section->vma - + htab->splt->output_offset - + h->plt.offset + relocation = (htab->splt->output_section->vma + + htab->splt->output_offset + + h->plt.offset - htab->sgot->output_section->vma); unresolved_reloc = FALSE; - break; - - case R_390_8: - case R_390_16: - case R_390_32: - case R_390_PC16: - case R_390_PC16DBL: - case R_390_PC32DBL: - case R_390_PC32: + break; + + case R_390_8: + case R_390_16: + case R_390_32: + case R_390_PC16: + case R_390_PC16DBL: + case R_390_PC32DBL: + case R_390_PC32: /* r_symndx will be zero only for relocs against symbols from removed linkonce sections, or sections discarded by a linker script. */ - if (r_symndx == 0 - || (input_section->flags & SEC_ALLOC) == 0) + if (r_symndx == 0 + || (input_section->flags & SEC_ALLOC) == 0) break; - if ((info->shared + if ((info->shared && ((r_type != R_390_PC16 && r_type != R_390_PC16DBL && r_type != R_390_PC32DBL @@ -2509,9 +2490,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, & ELF_LINK_HASH_DEF_REGULAR) == 0) || h->root.type == bfd_link_hash_undefweak || h->root.type == bfd_link_hash_undefined))) - { - Elf_Internal_Rela outrel; - bfd_boolean skip, relocate; + { + Elf_Internal_Rela outrel; + bfd_boolean skip, relocate; asection *sreloc; bfd_byte *loc; @@ -2519,8 +2500,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, are copied into the output file to be resolved at run time. */ - skip = FALSE; - relocate = FALSE; + skip = FALSE; + relocate = FALSE; outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, @@ -2529,12 +2510,12 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, skip = TRUE; else if (outrel.r_offset == (bfd_vma) -2) skip = TRUE, relocate = TRUE; - outrel.r_offset += (input_section->output_section->vma - + input_section->output_offset); + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); - if (skip) + if (skip) memset (&outrel, 0, sizeof outrel); - else if (h != NULL + else if (h != NULL && h->dynindx != -1 && (r_type == R_390_PC16 || r_type == R_390_PC16DBL @@ -2544,17 +2525,17 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, || !info->symbolic || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) - { - outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); + { + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); outrel.r_addend = rel->r_addend; - } - else - { + } + else + { /* This symbol is local, or marked to become local. */ relocate = TRUE; outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE); outrel.r_addend = relocation + rel->r_addend; - } + } sreloc = elf_section_data (input_section)->sreloc; if (sreloc == NULL) @@ -2564,13 +2545,13 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); - /* If this reloc is against an external symbol, we do - not want to fiddle with the addend. Otherwise, we - need to include the symbol value so that it becomes - an addend for the dynamic reloc. */ - if (! relocate) - continue; - } + /* If this reloc is against an external symbol, we do + not want to fiddle with the addend. Otherwise, we + need to include the symbol value so that it becomes + an addend for the dynamic reloc. */ + if (! relocate) + continue; + } break; /* Relocations for tls literal pool entries. */ @@ -2592,7 +2573,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); } - /* Fall through */ + /* Fall through. */ case R_390_TLS_GD32: case R_390_TLS_GOTIE32: @@ -2636,7 +2617,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, if ((off & 1) != 0) off &= ~1; - else + else { Elf_Internal_Rela outrel; bfd_byte *loc; @@ -2667,7 +2648,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, { if (indx == 0) { - BFD_ASSERT (! unresolved_reloc); + BFD_ASSERT (! unresolved_reloc); bfd_put_32 (output_bfd, relocation - dtpoff_base (info), htab->sgot->contents + off + GOT_ENTRY_SIZE); @@ -2771,7 +2752,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, htab->tls_ldm_got.offset |= 1; } relocation = htab->sgot->output_offset + off; - unresolved_reloc = FALSE; + unresolved_reloc = FALSE; break; case R_390_TLS_LE32: @@ -2981,8 +2962,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym) bfd_vma relative_offset; /* This symbol has an entry in the procedure linkage table. Set - it up. */ - + it up. */ if (h->dynindx == -1 || htab->splt == NULL || htab->sgotplt == NULL @@ -2990,26 +2970,26 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym) abort (); /* Calc. index no. - Current offset - size first entry / entry size. */ + Current offset - size first entry / entry size. */ plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) / PLT_ENTRY_SIZE; /* Offset in GOT is PLT index plus GOT headers(3) times 4, - addr & GOT addr. */ + addr & GOT addr. */ got_offset = (plt_index + 3) * GOT_ENTRY_SIZE; /* S390 uses halfwords for relative branch calc! */ relative_offset = - ((PLT_FIRST_ENTRY_SIZE + - (PLT_ENTRY_SIZE * plt_index) + 18) / 2); + (PLT_ENTRY_SIZE * plt_index) + 18) / 2); /* If offset is > 32768, branch to a previous branch - 390 can only handle +-64 K jumps. */ + 390 can only handle +-64 K jumps. */ if ( -32768 > (int) relative_offset ) - relative_offset = - -(unsigned) (((65536 / PLT_ENTRY_SIZE - 1) * PLT_ENTRY_SIZE) / 2); + relative_offset + = -(unsigned) (((65536 / PLT_ENTRY_SIZE - 1) * PLT_ENTRY_SIZE) / 2); /* Fill in the entry in the procedure linkage table. */ if (!info->shared) { - bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD0, + bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD0, htab->splt->contents + h->plt.offset); bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD1, htab->splt->contents + h->plt.offset + 4); @@ -3080,10 +3060,10 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym) } /* Insert offset into reloc. table here. */ bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela), - htab->splt->contents + h->plt.offset + 28); + htab->splt->contents + h->plt.offset + 28); /* Fill in the entry in the global offset table. - Points to instruction after GOT offset. */ + Points to instruction after GOT offset. */ bfd_put_32 (output_bfd, (htab->splt->output_section->vma + htab->splt->output_offset @@ -3120,7 +3100,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym) bfd_byte *loc; /* This symbol has an entry in the global offset table. Set it - up. */ + up. */ if (htab->sgot == NULL || htab->srelgot == NULL) abort (); @@ -3143,16 +3123,16 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym) BFD_ASSERT((h->got.offset & 1) != 0); rela.r_info = ELF32_R_INFO (0, R_390_RELATIVE); rela.r_addend = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - } + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } else { BFD_ASSERT((h->got.offset & 1) == 0); bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgot->contents + h->got.offset); rela.r_info = ELF32_R_INFO (h->dynindx, R_390_GLOB_DAT); - rela.r_addend = 0; - } + rela.r_addend = 0; + } loc = htab->srelgot->contents; loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela); @@ -3270,39 +3250,39 @@ elf_s390_finish_dynamic_sections (output_bfd, info) /* Fill in the special first entry in the procedure linkage table. */ if (htab->splt && htab->splt->_raw_size > 0) { - memset (htab->splt->contents, 0, PLT_FIRST_ENTRY_SIZE); - if (info->shared) + memset (htab->splt->contents, 0, PLT_FIRST_ENTRY_SIZE); + if (info->shared) { bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD0, - htab->splt->contents ); + htab->splt->contents ); bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD1, - htab->splt->contents +4 ); + htab->splt->contents +4 ); bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD2, - htab->splt->contents +8 ); + htab->splt->contents +8 ); bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD3, - htab->splt->contents +12 ); + htab->splt->contents +12 ); bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD4, - htab->splt->contents +16 ); - } - else - { - bfd_put_32 (output_bfd, (bfd_vma)PLT_FIRST_ENTRY_WORD0, - htab->splt->contents ); - bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD1, - htab->splt->contents +4 ); - bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD2, - htab->splt->contents +8 ); - bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD3, - htab->splt->contents +12 ); - bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD4, - htab->splt->contents +16 ); - bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD5, - htab->splt->contents +20 ); - bfd_put_32 (output_bfd, - htab->sgotplt->output_section->vma + htab->splt->contents +16 ); + } + else + { + bfd_put_32 (output_bfd, (bfd_vma)PLT_FIRST_ENTRY_WORD0, + htab->splt->contents ); + bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD1, + htab->splt->contents +4 ); + bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD2, + htab->splt->contents +8 ); + bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD3, + htab->splt->contents +12 ); + bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD4, + htab->splt->contents +16 ); + bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD5, + htab->splt->contents +20 ); + bfd_put_32 (output_bfd, + htab->sgotplt->output_section->vma + htab->sgotplt->output_offset, - htab->splt->contents + 24); - } + htab->splt->contents + 24); + } elf_section_data (htab->splt->output_section) ->this_hdr.sh_entsize = 4; } @@ -3377,27 +3357,27 @@ elf_s390_grok_prstatus (abfd, note) #define elf_backend_plt_header_size PLT_ENTRY_SIZE #define elf_backend_rela_normal 1 -#define elf_info_to_howto elf_s390_info_to_howto +#define elf_info_to_howto elf_s390_info_to_howto #define bfd_elf32_bfd_is_local_label_name elf_s390_is_local_label_name #define bfd_elf32_bfd_link_hash_table_create elf_s390_link_hash_table_create #define bfd_elf32_bfd_reloc_type_lookup elf_s390_reloc_type_lookup #define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol -#define elf_backend_check_relocs elf_s390_check_relocs +#define elf_backend_check_relocs elf_s390_check_relocs #define elf_backend_copy_indirect_symbol elf_s390_copy_indirect_symbol #define elf_backend_create_dynamic_sections elf_s390_create_dynamic_sections #define elf_backend_finish_dynamic_sections elf_s390_finish_dynamic_sections #define elf_backend_finish_dynamic_symbol elf_s390_finish_dynamic_symbol -#define elf_backend_gc_mark_hook elf_s390_gc_mark_hook -#define elf_backend_gc_sweep_hook elf_s390_gc_sweep_hook +#define elf_backend_gc_mark_hook elf_s390_gc_mark_hook +#define elf_backend_gc_sweep_hook elf_s390_gc_sweep_hook #define elf_backend_reloc_type_class elf_s390_reloc_type_class -#define elf_backend_relocate_section elf_s390_relocate_section +#define elf_backend_relocate_section elf_s390_relocate_section #define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections #define elf_backend_reloc_type_class elf_s390_reloc_type_class #define elf_backend_grok_prstatus elf_s390_grok_prstatus #define bfd_elf32_mkobject elf_s390_mkobject -#define elf_backend_object_p elf_s390_object_p +#define elf_backend_object_p elf_s390_object_p #include "elf32-target.h" |