From: Alan Modra Date: Mon, 18 Feb 2013 02:56:58 +0000 (+0000) Subject: * elf-bfd.h (struct elf_obj_tdata): Move find_line_info, local_stubs, X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=698600e4b4f428f13630e00307012adaf0ae4c7e;p=binutils-gdb.git * elf-bfd.h (struct elf_obj_tdata): Move find_line_info, local_stubs, local_call_stubs, elf_data_symbol, elf_text_symbol, elf_data_section, and elf_text_section to.. * elfxx-mips.c (struct mips_elf_obj_tdata): ..here. Update all refs. * elf64-alpha.c (struct mips_elf_find_line): Rename to.. (struct alpha_elf_find_line): ..this. (struct alpha_elf_obj_tdata): Add find_line_info, update refs. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 905427f0786..5411140ed56 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2013-02-18 Alan Modra + + * elf-bfd.h (struct elf_obj_tdata): Move find_line_info, local_stubs, + local_call_stubs, elf_data_symbol, elf_text_symbol, elf_data_section, + and elf_text_section to.. + * elfxx-mips.c (struct mips_elf_obj_tdata): ..here. Update all refs. + * elf64-alpha.c (struct mips_elf_find_line): Rename to.. + (struct alpha_elf_find_line): ..this. + (struct alpha_elf_obj_tdata): Add find_line_info, update refs. + 2013-02-16 H.J. Lu PR ld/15146 diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index a93e0d40133..d36c2875ec3 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1586,12 +1586,6 @@ struct elf_obj_tdata /* Used by find_nearest_line entry point. */ void *line_info; - /* Used by MIPS ELF find_nearest_line entry point. The structure - could be included directly in this one, but there's no point to - wasting the memory just for the infrequently called - find_nearest_line. */ - struct mips_elf_find_line *find_line_info; - /* A place to stash dwarf1 info for this bfd. */ struct dwarf1_debug *dwarf1_find_line_info; @@ -1601,12 +1595,6 @@ struct elf_obj_tdata /* Stash away info for yet another find line/function variant. */ void *elf_find_function_cache; - /* An array of stub sections indexed by symbol number, used by the - MIPS ELF linker. FIXME: We should figure out some way to only - include this field for a MIPS ELF target. */ - asection **local_stubs; - asection **local_call_stubs; - /* Used to determine if PT_GNU_EH_FRAME segment header should be created. */ asection *eh_frame_hdr; @@ -1629,13 +1617,6 @@ struct elf_obj_tdata /* Symbol version references to external objects. */ Elf_Internal_Verneed *verref; - /* The Irix 5 support uses two virtual sections, which represent - text/data symbols defined in dynamic objects. */ - asymbol *elf_data_symbol; - asymbol *elf_text_symbol; - asection *elf_data_section; - asection *elf_text_section; - /* A pointer to the .eh_frame section. */ asection *eh_frame_section; diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 02dd2abaf6b..aeff52699e2 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -299,6 +299,15 @@ elf64_alpha_bfd_link_hash_table_create (bfd *abfd) return &ret->root.root; } +/* Alpha ELF follows MIPS ELF in using a special find_nearest_line + routine in order to handle the ECOFF debugging information. */ + +struct alpha_elf_find_line +{ + struct ecoff_debug_info d; + struct ecoff_find_line i; +}; + /* We have some private fields hanging off of the elf_tdata structure. */ struct alpha_elf_obj_tdata @@ -328,6 +337,10 @@ struct alpha_elf_obj_tdata /* For every got, this is the sum of the number of words required to hold all of the member object's local got. */ int local_got_size; + + /* Used by elf64_alpha_find_nearest_line entry point. */ + struct alpha_elf_find_line *find_line_info; + }; #define alpha_elf_tdata(abfd) \ @@ -1430,17 +1443,6 @@ elf64_alpha_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name) return name[0] == '$'; } -/* Alpha ELF follows MIPS ELF in using a special find_nearest_line - routine in order to handle the ECOFF debugging information. We - still call this mips_elf_find_line because of the slot - find_line_info in elf_obj_tdata is declared that way. */ - -struct mips_elf_find_line -{ - struct ecoff_debug_info d; - struct ecoff_find_line i; -}; - static bfd_boolean elf64_alpha_find_nearest_line (bfd *abfd, asection *section, asymbol **symbols, bfd_vma offset, const char **filename_ptr, @@ -1460,7 +1462,7 @@ elf64_alpha_find_nearest_line (bfd *abfd, asection *section, asymbol **symbols, if (msec != NULL) { flagword origflags; - struct mips_elf_find_line *fi; + struct alpha_elf_find_line *fi; const struct ecoff_debug_swap * const swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; @@ -1471,16 +1473,16 @@ elf64_alpha_find_nearest_line (bfd *abfd, asection *section, asymbol **symbols, if (elf_section_data (msec)->this_hdr.sh_type != SHT_NOBITS) msec->flags |= SEC_HAS_CONTENTS; - fi = elf_tdata (abfd)->find_line_info; + fi = alpha_elf_tdata (abfd)->find_line_info; if (fi == NULL) { bfd_size_type external_fdr_size; char *fraw_src; char *fraw_end; struct fdr *fdr_ptr; - bfd_size_type amt = sizeof (struct mips_elf_find_line); + bfd_size_type amt = sizeof (struct alpha_elf_find_line); - fi = (struct mips_elf_find_line *) bfd_zalloc (abfd, amt); + fi = (struct alpha_elf_find_line *) bfd_zalloc (abfd, amt); if (fi == NULL) { msec->flags = origflags; @@ -1509,7 +1511,7 @@ elf64_alpha_find_nearest_line (bfd *abfd, asection *section, asymbol **symbols, for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++) (*swap->swap_fdr_in) (abfd, fraw_src, fdr_ptr); - elf_tdata (abfd)->find_line_info = fi; + alpha_elf_tdata (abfd)->find_line_info = fi; /* Note that we don't bother to ever free this information. find_nearest_line is either called all the time, as in diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 282a4644ccb..63a17ccd5d7 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -499,6 +499,22 @@ struct mips_elf_obj_tdata /* The GOT requirements of input bfds. */ struct mips_got_info *got; + + /* Used by _bfd_mips_elf_find_nearest_line. The structure could be + included directly in this one, but there's no point to wasting + the memory just for the infrequently called find_nearest_line. */ + struct mips_elf_find_line *find_line_info; + + /* An array of stub sections indexed by symbol number. */ + asection **local_stubs; + asection **local_call_stubs; + + /* The Irix 5 support uses two virtual sections, which represent + text/data symbols defined in dynamic objects. */ + asymbol *elf_data_symbol; + asymbol *elf_text_symbol; + asection *elf_data_section; + asection *elf_text_section; }; /* Get MIPS ELF private object data from BFD's tdata. */ @@ -5180,8 +5196,8 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, && h->fn_stub != NULL && (r_type != R_MIPS16_CALL16 || h->need_fn_stub)) || (local_p - && elf_tdata (input_bfd)->local_stubs != NULL - && elf_tdata (input_bfd)->local_stubs[r_symndx] != NULL)) + && mips_elf_tdata (input_bfd)->local_stubs != NULL + && mips_elf_tdata (input_bfd)->local_stubs[r_symndx] != NULL)) && !section_allows_mips16_refs_p (input_section)) { /* This is a 32- or 64-bit call to a 16-bit function. We should @@ -5189,7 +5205,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, stub. */ if (local_p) { - sec = elf_tdata (input_bfd)->local_stubs[r_symndx]; + sec = mips_elf_tdata (input_bfd)->local_stubs[r_symndx]; value = 0; } else @@ -5220,12 +5236,12 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, else if (r_type == R_MIPS16_26 && !info->relocatable && ((h != NULL && (h->call_stub != NULL || h->call_fp_stub != NULL)) || (local_p - && elf_tdata (input_bfd)->local_call_stubs != NULL - && elf_tdata (input_bfd)->local_call_stubs[r_symndx] != NULL)) + && mips_elf_tdata (input_bfd)->local_call_stubs != NULL + && mips_elf_tdata (input_bfd)->local_call_stubs[r_symndx] != NULL)) && !target_is_16_bit_code_p) { if (local_p) - sec = elf_tdata (input_bfd)->local_call_stubs[r_symndx]; + sec = mips_elf_tdata (input_bfd)->local_call_stubs[r_symndx]; else { /* If both call_stub and call_fp_stub are defined, we can figure @@ -7009,7 +7025,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, case SHN_MIPS_TEXT: /* This section is used in a shared object. */ - if (elf_tdata (abfd)->elf_text_section == NULL) + if (mips_elf_tdata (abfd)->elf_text_section == NULL) { asymbol *elf_text_symbol; asection *elf_text_section; @@ -7026,11 +7042,11 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, /* Initialize the section. */ - elf_tdata (abfd)->elf_text_section = elf_text_section; - elf_tdata (abfd)->elf_text_symbol = elf_text_symbol; + mips_elf_tdata (abfd)->elf_text_section = elf_text_section; + mips_elf_tdata (abfd)->elf_text_symbol = elf_text_symbol; elf_text_section->symbol = elf_text_symbol; - elf_text_section->symbol_ptr_ptr = &elf_tdata (abfd)->elf_text_symbol; + elf_text_section->symbol_ptr_ptr = &mips_elf_tdata (abfd)->elf_text_symbol; elf_text_section->name = ".text"; elf_text_section->flags = SEC_NO_FLAGS; @@ -7043,14 +7059,14 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, /* This code used to do *secp = bfd_und_section_ptr if info->shared. I don't know why, and that doesn't make sense, so I took it out. */ - *secp = elf_tdata (abfd)->elf_text_section; + *secp = mips_elf_tdata (abfd)->elf_text_section; break; case SHN_MIPS_ACOMMON: /* Fall through. XXX Can we treat this as allocated data? */ case SHN_MIPS_DATA: /* This section is used in a shared object. */ - if (elf_tdata (abfd)->elf_data_section == NULL) + if (mips_elf_tdata (abfd)->elf_data_section == NULL) { asymbol *elf_data_symbol; asection *elf_data_section; @@ -7067,11 +7083,11 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, /* Initialize the section. */ - elf_tdata (abfd)->elf_data_section = elf_data_section; - elf_tdata (abfd)->elf_data_symbol = elf_data_symbol; + mips_elf_tdata (abfd)->elf_data_section = elf_data_section; + mips_elf_tdata (abfd)->elf_data_symbol = elf_data_symbol; elf_data_section->symbol = elf_data_symbol; - elf_data_section->symbol_ptr_ptr = &elf_tdata (abfd)->elf_data_symbol; + elf_data_section->symbol_ptr_ptr = &mips_elf_tdata (abfd)->elf_data_symbol; elf_data_section->name = ".data"; elf_data_section->flags = SEC_NO_FLAGS; @@ -7084,7 +7100,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, /* This code used to do *secp = bfd_und_section_ptr if info->shared. I don't know why, and that doesn't make sense, so I took it out. */ - *secp = elf_tdata (abfd)->elf_data_section; + *secp = mips_elf_tdata (abfd)->elf_data_section; break; case SHN_MIPS_SUNDEFINED: @@ -7590,7 +7606,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* Record this stub in an array of local symbol stubs for this BFD. */ - if (elf_tdata (abfd)->local_stubs == NULL) + if (mips_elf_tdata (abfd)->local_stubs == NULL) { unsigned long symcount; asection **n; @@ -7604,11 +7620,11 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, n = bfd_zalloc (abfd, amt); if (n == NULL) return FALSE; - elf_tdata (abfd)->local_stubs = n; + mips_elf_tdata (abfd)->local_stubs = n; } sec->flags |= SEC_KEEP; - elf_tdata (abfd)->local_stubs[r_symndx] = sec; + mips_elf_tdata (abfd)->local_stubs[r_symndx] = sec; /* We don't need to set mips16_stubs_seen in this case. That flag is used to see whether we need to look through @@ -7715,7 +7731,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* Record this stub in an array of local symbol call_stubs for this BFD. */ - if (elf_tdata (abfd)->local_call_stubs == NULL) + if (mips_elf_tdata (abfd)->local_call_stubs == NULL) { unsigned long symcount; asection **n; @@ -7729,11 +7745,11 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, n = bfd_zalloc (abfd, amt); if (n == NULL) return FALSE; - elf_tdata (abfd)->local_call_stubs = n; + mips_elf_tdata (abfd)->local_call_stubs = n; } sec->flags |= SEC_KEEP; - elf_tdata (abfd)->local_call_stubs[r_symndx] = sec; + mips_elf_tdata (abfd)->local_call_stubs[r_symndx] = sec; /* We don't need to set mips16_stubs_seen in this case. That flag is used to see whether we need to look through @@ -11649,7 +11665,7 @@ _bfd_mips_elf_find_nearest_line (bfd *abfd, asection *section, if (elf_section_data (msec)->this_hdr.sh_type != SHT_NOBITS) msec->flags |= SEC_HAS_CONTENTS; - fi = elf_tdata (abfd)->find_line_info; + fi = mips_elf_tdata (abfd)->find_line_info; if (fi == NULL) { bfd_size_type external_fdr_size; @@ -11687,7 +11703,7 @@ _bfd_mips_elf_find_nearest_line (bfd *abfd, asection *section, for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++) (*swap->swap_fdr_in) (abfd, fraw_src, fdr_ptr); - elf_tdata (abfd)->find_line_info = fi; + mips_elf_tdata (abfd)->find_line_info = fi; /* Note that we don't bother to ever free this information. find_nearest_line is either called all the time, as in