X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felfnn-ia64.c;h=cd94158aba186f87687038027213b3b8d5db8c1c;hb=6f6fd151cbf226bbaa66e44977f57b7c6dc33d89;hp=a80e5b8e2fd8567cdcf791a2435b5ad164182078;hpb=4b24dd1acad5c133d12aab6a575c83269336e47f;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c index a80e5b8e2f..cd94158aba 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -1,5 +1,5 @@ /* IA-64 support for 64-bit ELF - Copyright (C) 1998-2019 Free Software Foundation, Inc. + Copyright (C) 1998-2020 Free Software Foundation, Inc. Contributed by David Mosberger-Tang This file is part of BFD, the Binary File Descriptor library. @@ -39,6 +39,10 @@ #define LOG_SECTION_ALIGN 2 #endif +#define is_ia64_elf(bfd) \ + (bfd_get_flavour (bfd) == bfd_target_elf_flavour \ + && elf_object_id (bfd) == IA64_ELF_DATA) + typedef struct bfd_hash_entry *(*new_hash_entry_func) (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); @@ -938,11 +942,10 @@ elfNN_ia64_section_from_shdr (bfd *abfd, flag. */ static bfd_boolean -elfNN_ia64_section_flags (flagword *flags, - const Elf_Internal_Shdr *hdr) +elfNN_ia64_section_flags (const Elf_Internal_Shdr *hdr) { if (hdr->sh_flags & SHF_IA_64_SHORT) - *flags |= SEC_SMALL_DATA; + hdr->bfd_section->flags |= SEC_SMALL_DATA; return TRUE; } @@ -956,7 +959,7 @@ elfNN_ia64_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, { const char *name; - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); if (is_unwind_section_name (abfd, name)) { @@ -1002,9 +1005,8 @@ elfNN_ia64_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, /* The final processing done just before writing out an IA-64 ELF object file. */ -static void -elfNN_ia64_final_write_processing (bfd *abfd, - bfd_boolean linker ATTRIBUTE_UNUSED) +static bfd_boolean +elfNN_ia64_final_write_processing (bfd *abfd) { Elf_Internal_Shdr *hdr; asection *s; @@ -1036,6 +1038,7 @@ elfNN_ia64_final_write_processing (bfd *abfd, elf_elfheader(abfd)->e_flags = flags; elf_flags_init (abfd) = TRUE; } + return _bfd_elf_final_write_processing (abfd); } /* Hook called by the linker routine which adds symbols from an object @@ -1191,8 +1194,7 @@ elfNN_ia64_modify_segment_map (bfd *abfd, for SHF_IA_64_NORECOV on each. */ static bfd_boolean -elfNN_ia64_modify_program_headers (bfd *abfd, - struct bfd_link_info *info ATTRIBUTE_UNUSED) +elfNN_ia64_modify_headers (bfd *abfd, struct bfd_link_info *info) { struct elf_obj_tdata *tdata = elf_tdata (abfd); struct elf_segment_map *m; @@ -1224,7 +1226,7 @@ elfNN_ia64_modify_program_headers (bfd *abfd, found:; } - return TRUE; + return _bfd_elf_modify_headers (abfd, info); } /* According to the Tahoe assembler spec, all labels starting with a @@ -1561,11 +1563,10 @@ elfNN_ia64_create_dynamic_sections (bfd *abfd, return FALSE; { - flagword flags = bfd_get_section_flags (abfd, ia64_info->root.sgot); - bfd_set_section_flags (abfd, ia64_info->root.sgot, - SEC_SMALL_DATA | flags); + flagword flags = bfd_section_flags (ia64_info->root.sgot); + bfd_set_section_flags (ia64_info->root.sgot, SEC_SMALL_DATA | flags); /* The .got section is always aligned at 8 bytes. */ - if (! bfd_set_section_alignment (abfd, ia64_info->root.sgot, 3)) + if (!bfd_set_section_alignment (ia64_info->root.sgot, 3)) return FALSE; } @@ -1579,7 +1580,7 @@ elfNN_ia64_create_dynamic_sections (bfd *abfd, | SEC_LINKER_CREATED | SEC_READONLY)); if (s == NULL - || !bfd_set_section_alignment (abfd, s, LOG_SECTION_ALIGN)) + || !bfd_set_section_alignment (s, LOG_SECTION_ALIGN)) return FALSE; ia64_info->rel_pltoff_sec = s; @@ -1912,7 +1913,7 @@ get_dyn_sym_info (struct elfNN_ia64_link_hash_table *ia64_info, *size_p = size; *info_p = info; -has_space: + has_space: /* Append the new one to the array. */ dyn_i = info + count; memset (dyn_i, 0, sizeof (*dyn_i)); @@ -1977,11 +1978,11 @@ get_got (bfd *abfd, struct bfd_link_info *info, got = ia64_info->root.sgot; /* The .got section is always aligned at 8 bytes. */ - if (!bfd_set_section_alignment (abfd, got, 3)) + if (!bfd_set_section_alignment (got, 3)) return NULL; - flags = bfd_get_section_flags (abfd, got); - if (! bfd_set_section_flags (abfd, got, SEC_SMALL_DATA | flags)) + flags = bfd_section_flags (got); + if (!bfd_set_section_flags (got, SEC_SMALL_DATA | flags)) return NULL; } @@ -2016,7 +2017,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info, ? 0 : SEC_READONLY) | SEC_LINKER_CREATED)); if (!fptr - || !bfd_set_section_alignment (abfd, fptr, 4)) + || !bfd_set_section_alignment (fptr, 4)) { BFD_ASSERT (0); return NULL; @@ -2034,8 +2035,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info, | SEC_LINKER_CREATED | SEC_READONLY)); if (fptr_rel == NULL - || !bfd_set_section_alignment (abfd, fptr_rel, - LOG_SECTION_ALIGN)) + || !bfd_set_section_alignment (fptr_rel, LOG_SECTION_ALIGN)) { BFD_ASSERT (0); return NULL; @@ -2071,7 +2071,7 @@ get_pltoff (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED, | SEC_SMALL_DATA | SEC_LINKER_CREATED)); if (!pltoff - || !bfd_set_section_alignment (abfd, pltoff, 4)) + || !bfd_set_section_alignment (pltoff, 4)) { BFD_ASSERT (0); return NULL; @@ -2112,8 +2112,7 @@ get_reloc_section (bfd *abfd, | SEC_LINKER_CREATED | SEC_READONLY)); if (srel == NULL - || !bfd_set_section_alignment (dynobj, srel, - LOG_SECTION_ALIGN)) + || !bfd_set_section_alignment (srel, LOG_SECTION_ALIGN)) return NULL; } @@ -3171,7 +3170,7 @@ elfNN_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, sec); + name = bfd_section_name (sec); if (strcmp (name, ".got.plt") == 0) strip = FALSE; @@ -3706,7 +3705,7 @@ elfNN_ia64_choose_gp (bfd *abfd, struct bfd_link_info *info, bfd_boolean final) { if (max_short_vma - min_short_vma >= 0x400000) { -overflow: + overflow: _bfd_error_handler /* xgettext:c-format */ (_("%pB: short data segment overflowed (%#" PRIx64 " >= 0x400000)"), @@ -4476,7 +4475,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, case bfd_reloc_outofrange: case bfd_reloc_overflow: default: -missing_tls_sec: + missing_tls_sec: { const char *name; @@ -4736,6 +4735,7 @@ elfNN_ia64_set_private_flags (bfd *abfd, flagword flags) /* Merge backend specific data from an object file to the output object file when linking. */ + static bfd_boolean elfNN_ia64_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) { @@ -4744,10 +4744,8 @@ elfNN_ia64_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) flagword in_flags; bfd_boolean ok = TRUE; - /* Don't even pretend to support mixed-format linking. */ - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return FALSE; + if (!is_ia64_elf (ibfd) || !is_ia64_elf (obfd)) + return TRUE; in_flags = elf_elfheader (ibfd)->e_flags; out_flags = elf_elfheader (obfd)->e_flags; @@ -4884,7 +4882,7 @@ elfNN_ia64_object_p (bfd *abfd) flagword flags; const char *name; char *unwi_name, *unw_name; - bfd_size_type amt; + size_t amt; if (abfd->flags & DYNAMIC) return TRUE; @@ -4976,14 +4974,18 @@ elfNN_ia64_hpux_vec (const bfd_target *vec) return (vec == &ia64_elfNN_hpux_be_vec); } -static void -elfNN_hpux_post_process_headers (bfd *abfd, - struct bfd_link_info *info ATTRIBUTE_UNUSED) +static bfd_boolean +elfNN_hpux_init_file_header (bfd *abfd, struct bfd_link_info *info) { - Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd); + Elf_Internal_Ehdr *i_ehdrp; + + if (!_bfd_elf_init_file_header (abfd, info)) + return FALSE; + i_ehdrp = elf_elfheader (abfd); i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi; i_ehdrp->e_ident[EI_ABIVERSION] = 1; + return TRUE; } static bfd_boolean @@ -5013,6 +5015,11 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, break; } } + +static void +ignore_errors (const char *fmt ATTRIBUTE_UNUSED, ...) +{ +} #define TARGET_LITTLE_SYM ia64_elfNN_le_vec #define TARGET_LITTLE_NAME "elfNN-ia64-little" @@ -5040,8 +5047,8 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, elfNN_ia64_additional_program_headers #define elf_backend_modify_segment_map \ elfNN_ia64_modify_segment_map -#define elf_backend_modify_program_headers \ - elfNN_ia64_modify_program_headers +#define elf_backend_modify_headers \ + elfNN_ia64_modify_headers #define elf_info_to_howto \ elfNN_ia64_info_to_howto @@ -5110,7 +5117,7 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, We don't want to flood users with so many error messages. We turn off the warning for now. It will be turned on later when the Intel compiler is fixed. */ -#define elf_backend_link_order_error_handler NULL +#define elf_backend_link_order_error_handler ignore_errors #include "elfNN-target.h" @@ -5125,8 +5132,8 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, /* These are HP-UX specific functions. */ -#undef elf_backend_post_process_headers -#define elf_backend_post_process_headers elfNN_hpux_post_process_headers +#undef elf_backend_init_file_header +#define elf_backend_init_file_header elfNN_hpux_init_file_header #undef elf_backend_section_from_bfd_section #define elf_backend_section_from_bfd_section elfNN_hpux_backend_section_from_bfd_section