Lines Matching defs:*toc*

47 static bfd_reloc_status_type ppc64_elf_toc_reloc
49 static bfd_reloc_status_type ppc64_elf_toc_ha_reloc
51 static bfd_reloc_status_type ppc64_elf_toc64_reloc
916 ppc64_elf_toc_reloc, /* special_function */
933 ppc64_elf_toc_reloc, /* special_function */
950 ppc64_elf_toc_reloc, /* special_function */
969 ppc64_elf_toc_ha_reloc, /* special_function */
986 ppc64_elf_toc64_reloc, /* special_function */
1179 ppc64_elf_toc_reloc, /* special_function */
1194 ppc64_elf_toc_reloc, /* special_function */
2301 ppc64_elf_toc_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
2316 TOCstart = ppc64_elf_toc (input_section->output_section->owner);
2324 ppc64_elf_toc_ha_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
2339 TOCstart = ppc64_elf_toc (input_section->output_section->owner);
2350 ppc64_elf_toc64_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
2366 TOCstart = ppc64_elf_toc (input_section->output_section->owner);
2592 { STRING_COMMA_LEN (".toc"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
2593 { STRING_COMMA_LEN (".toc1"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
2594 { STRING_COMMA_LEN (".tocbss"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
2601 sec_toc = 2
2616 /* An array for toc sections, indexed by offset/8.
2617 Specifies the relocation symbol index used at a given toc offset. */
3080 . .quad .TOC.@tocbase
3098 . addis 12,2,Lfoo@toc@ha # in practice, the call stub
3099 . addi 12,12,Lfoo@toc@l # is slightly optimized, but
3233 . addis %r12,%r2,xxx@toc@ha
3234 . ld %r11,xxx@toc@l(%r12)
3243 . addis %r12,%r2,xxx@toc@ha
3245 . ld %r11,xxx+0@toc@l(%r12)
3246 . ld %r2,xxx+8@toc@l(%r12)
3248 . ld %r11,xxx+16@toc@l(%r12)
3252 code to adjust the value and save r2 to support multiple toc sections.
3261 . addis %r12,%r2,xxx@toc@ha
3262 . ld %r11,xxx@toc@l(%r12)
3343 /* Whether global opd/toc sym has been adjusted or not.
3344 After ppc64_elf_edit_opd/ppc64_elf_edit_toc has run, this flag
3345 should be set for all globals defined in any opd/toc section. */
3396 bfd_vma toc_off;
3400 bfd_vma toc_curr;
3438 /* Support for multiple toc sections. */
3439 unsigned int no_multi_toc:1;
3440 unsigned int multi_toc_needed:1;
3457 #define has_toc_reloc has_gp_reloc
3458 #define makes_toc_func_call need_finalize_relax
4516 sec->has_toc_reloc = 1;
4606 sec->has_toc_reloc = 1;
4680 goto dotlstoc;
4689 goto dotlstoc;
4700 dotlstoc:
4714 if (ppc64_sec->sec_type != sec_toc)
4722 ppc64_sec->sec_type = sec_toc;
6088 error, 2 on a toc GD type suitable for optimization, 3 on a toc LD
6092 get_tls_mask (char **tls_maskp, unsigned long *toc_symndx,
6109 || ppc64_elf_section_data (sec)->sec_type != sec_toc)
6126 if (toc_symndx != NULL)
6127 *toc_symndx = r_symndx;
6797 asection *toc = bfd_get_section_by_name (ibfd, ".toc");
6798 unsigned char *toc_ref = NULL;
6801 for (sec = (ibfd->sections == toc && toc && toc->next ? toc->next
6804 sec = (sec == toc ? NULL
6805 : sec->next == NULL ? toc
6806 : sec->next == toc && toc->next ? toc->next
6812 long toc_ref_index = 0;
6841 if (toc_ref != NULL)
6842 free (toc_ref);
6942 /* Check for toc tls entries. */
6943 char *toc_tls;
6946 retval = get_tls_mask (&toc_tls, NULL, &locsyms,
6950 if (retval > 1 && toc_tls != NULL)
6953 if (toc_ref != NULL)
6954 toc_ref[toc_ref_index] = 1;
6977 if (sym_sec == toc && toc != NULL)
6979 /* Mark this toc entry as referenced by a TLS
6983 if (toc_ref == NULL)
6985 toc_ref = bfd_zmalloc (toc->size / 8);
6986 if (toc_ref == NULL)
6994 BFD_ASSERT (value < toc->size && value % 8 == 0);
6995 toc_ref_index = value / 8;
6997 toc_ref[toc_ref_index] = 1;
7003 if (sec != toc
7004 || toc_ref == NULL
7005 || !toc_ref[rel->r_offset / 8])
7019 if (sec != toc
7020 || toc_ref == NULL
7021 || !toc_ref[rel->r_offset / 8])
7101 if (toc_ref != NULL)
7102 free (toc_ref);
7117 /* Called via elf_link_hash_traverse from ppc64_elf_edit_toc to adjust
7118 the values of any global symbols in a toc section that has been
7119 edited. Globals in toc sections should be a rarity, so this function
7120 sets a flag if any are found in toc sections other than the one just
7123 struct adjust_toc_info
7125 asection *toc;
7127 bfd_boolean global_toc_syms;
7131 adjust_toc_syms (struct elf_link_hash_entry *h, void *inf)
7134 struct adjust_toc_info *toc_inf = (struct adjust_toc_info *) inf;
7150 if (eh->elf.root.u.def.section == toc_inf->toc)
7152 unsigned long skip = toc_inf->skip[eh->elf.root.u.def.value >> 3];
7158 (_("%s defined in removed toc entry"), eh->elf.root.root.string);
7164 else if (strcmp (eh->elf.root.u.def.section->name, ".toc") == 0)
7165 toc_inf->global_toc_syms = TRUE;
7170 /* Examine all relocs referencing .toc sections in order to remove
7171 unused .toc entries. */
7174 ppc64_elf_edit_toc (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
7177 struct adjust_toc_info toc_inf;
7179 toc_inf.global_toc_syms = TRUE;
7182 asection *toc, *sec;
7191 toc = bfd_get_section_by_name (ibfd, ".toc");
7192 if (toc == NULL
7193 || toc->size == 0
7194 || toc->sec_info_type == ELF_INFO_TYPE_JUST_SYMS
7195 || elf_discarded_section (toc))
7218 /* Run through the relocs to see which toc entries might be
7249 if (sym_sec != toc)
7258 if (val >= toc->size)
7261 /* Anything in the toc ought to be aligned to 8 bytes.
7268 skip = bfd_zmalloc (sizeof (*skip) * (toc->size + 7) / 8);
7283 used = bfd_zmalloc (sizeof (*used) * (toc->size + 7) / 8);
7299 /* Now check all kept sections that might reference the toc.
7300 Check the toc itself last. */
7301 for (sec = (ibfd->sections == toc && toc->next ? toc->next
7304 sec = (sec == toc ? NULL
7305 : sec->next == NULL ? toc
7306 : sec->next == toc && toc->next ? toc->next
7322 /* Mark toc entries referenced as used. */
7343 /* In case we're taking addresses of toc entries. */
7359 if (sym_sec != toc)
7368 if (val >= toc->size)
7371 /* For the toc section, we only mark as used if
7373 if (sec == toc
7390 drop < skip + (toc->size + 7) / 8;
7414 /* Shuffle the toc contents, and at the same time convert the
7416 if (!bfd_malloc_and_get_section (ibfd, toc, &contents))
7419 elf_section_data (toc)->this_hdr.contents = contents;
7422 src < contents + toc->size;
7436 toc->rawsize = toc->size;
7437 toc->size = src - contents - off;
7439 if (toc->reloc_count != 0)
7444 /* Read toc relocs. */
7445 relstart = _bfd_elf_link_read_relocs (ibfd, toc, NULL, NULL,
7450 /* Remove unused toc relocs, and adjust those we keep. */
7452 for (rel = relstart; rel < relstart + toc->reloc_count; ++rel)
7460 else if (!dec_dynrel_count (rel->r_info, toc, info,
7464 toc->reloc_count = wrel - relstart;
7465 sz = elf_section_data (toc)->rel_hdr.sh_entsize;
7466 elf_section_data (toc)->rel_hdr.sh_size = toc->reloc_count * sz;
7467 BFD_ASSERT (elf_section_data (toc)->rel_hdr2 == NULL);
7470 /* Adjust addends for relocs against the toc section sym. */
7511 if (sym_sec != toc || h != NULL || sym->st_value != 0)
7531 && bfd_section_from_elf_index (ibfd, sym->st_shndx) == toc)
7538 (_("%s defined in removed toc entry"),
7548 /* Finally, adjust any global syms defined in the toc. */
7549 if (toc_inf.global_toc_syms)
7551 toc_inf.toc = toc;
7552 toc_inf.skip = skip;
7553 toc_inf.global_toc_syms = FALSE;
7554 elf_link_hash_traverse (elf_hash_table (info), adjust_toc_syms,
7555 &toc_inf);
8258 r2off = (htab->stub_group[stub_entry->target_section->id].toc_off
8259 - htab->stub_group[stub_entry->id_sec->id].toc_off);
8409 - htab->stub_group[stub_entry->id_sec->id].toc_off);
8433 r2off = (htab->stub_group[stub_entry->target_section->id].toc_off
8434 - htab->stub_group[stub_entry->id_sec->id].toc_off);
8485 - htab->stub_group[stub_entry->id_sec->id].toc_off);
8580 - htab->stub_group[stub_entry->id_sec->id].toc_off);
8663 int no_multi_toc)
8672 htab->no_multi_toc = no_multi_toc;
8697 /* Set toc_off for com, und, abs and ind sections. */
8699 htab->stub_group[id].toc_off = TOC_BASE_OFF;
8701 elf_gp (output_bfd) = htab->toc_curr = ppc64_elf_toc (output_bfd);
8725 and linker generated GOT section. Group input bfds such that the toc
8727 scripts that play games with dot in the output toc section. */
8730 ppc64_elf_next_toc_section (struct bfd_link_info *info, asection *isec)
8734 if (!htab->no_multi_toc)
8737 bfd_vma off = addr - htab->toc_curr;
8740 htab->toc_curr = addr;
8742 elf_gp (isec->owner) = (htab->toc_curr
8751 ppc64_elf_reinit_toc (bfd *output_bfd, struct bfd_link_info *info)
8755 htab->multi_toc_needed = htab->toc_curr != elf_gp (output_bfd);
8757 /* toc_curr tracks the TOC offset used for code sections below in
8759 htab->toc_curr = TOC_BASE_OFF;
8762 /* No toc references were found in ISEC. If the code in ISEC makes no
8763 calls, then there's no need to use toc adjusting stubs when branching
8771 toc_adjusting_stub_needed (struct bfd_link_info *info, asection *isec)
8778 /* We know none of our code bearing sections will need toc stubs. */
8897 /* If the called function uses the toc, we need a stub. */
8898 if (sym_sec->has_toc_reloc
8899 || sym_sec->makes_toc_func_call)
8916 can't say for sure that no toc adjusting stubs are needed, so
8924 && htab->stub_group[sym_sec->id].toc_off == 0)
8932 recur = toc_adjusting_stub_needed (info, sym_sec);
8944 htab->stub_group[sym_sec->id].toc_off = 1;
8947 sym_sec->makes_toc_func_call = 1;
8992 if (htab->multi_toc_needed)
8998 if (isec->has_toc_reloc || (isec->flags & SEC_CODE) == 0)
9001 htab->toc_curr = elf_gp (isec->owner);
9003 else if (htab->stub_group[isec->id].toc_off == 0)
9005 int ret = toc_adjusting_stub_needed (info, isec);
9009 isec->makes_toc_func_call = ret & 1;
9016 htab->stub_group[isec->id].toc_off = htab->toc_curr;
9064 bfd_vma curr_toc;
9073 curr_toc = htab->stub_group[tail->id].toc_off;
9079 && htab->stub_group[prev->id].toc_off == curr_toc)
9112 && htab->stub_group[prev->id].toc_off == curr_toc)
9346 && (htab->stub_group[code_sec->id].toc_off
9347 != htab->stub_group[section->id].toc_off)
9348 && (code_sec->has_toc_reloc
9349 || code_sec->makes_toc_func_call))
9480 ppc64_elf_toc (bfd *obfd)
9485 /* The TOC consists of sections .got, .toc, .tocbss, .plt in that
9489 s = bfd_get_section_by_name (obfd, ".toc");
9491 s = bfd_get_section_by_name (obfd, ".tocbss");
9497 o references to TOC base (SYM@toc / TOC[tc0]) without a
9498 .toc directive
9697 " toc adjust %lu\n"
9699 " long toc adj %lu\n"
9749 if (strcmp (".toc", sec->name) == 0)
9752 if (strcmp (".toc1", sec->name) == 0)
9844 unsigned long r_symndx, toc_symndx;
9937 toc_symndx = 0;
9950 /* Check for toc tls entries. */
9951 char *toc_tls;
9953 if (!get_tls_mask (&toc_tls, &toc_symndx, &local_syms,
9957 if (toc_tls)
9958 tls_mask = *toc_tls;
10009 /* Check for toc tls entries. */
10010 char *toc_tls;
10013 retval = get_tls_mask (&toc_tls, &toc_symndx, &local_syms,
10018 if (toc_tls)
10020 tls_mask = *toc_tls;
10026 goto toctprel;
10053 toctprel:
10059 if (toc_symndx != 0)
10061 rel->r_info = ELF64_R_INFO (toc_symndx, r_type);
10112 if (toc_symndx != 0)
10114 rel->r_info = ELF64_R_INFO (toc_symndx, r_type);
10221 else if (toc_symndx != 0)
10222 r_symndx = toc_symndx;
10239 if (tls_gd == 0 || toc_symndx != 0)
10330 && (htab->stub_group[sec->id].toc_off
10331 != htab->stub_group[input_section->id].toc_off)))
10372 /* Allow crt1 branch to go via a toc adjusting stub. */
10384 "recompile with -mminimal-toc or upgrade gcc"),
10392 "recompile with -mminimal-toc or "
10743 relocation += htab->stub_group[input_section->id].toc_off;
10747 relocation += htab->stub_group[sec->id].toc_off;
10754 The TOC consists of sections .got, .toc, .tocbss, and .plt,
10762 addend -= TOCstart + htab->stub_group[input_section->id].toc_off;