X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf32-bfin.c;h=e6383a782ff6c7a0c5bb525a9b0c119e5fbc4682;hb=dc7148375d70a95aa66328276a08a50914482aef;hp=2e4751f89c0ab7ce4dc70f557c95599b02b3b3d2;hpb=4b24dd1acad5c133d12aab6a575c83269336e47f;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 2e4751f89c..e6383a782f 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -1,5 +1,5 @@ /* ADI Blackfin BFD support for 32-bit ELF. - Copyright (C) 2005-2019 Free Software Foundation, Inc. + Copyright (C) 2005-2020 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -25,6 +25,7 @@ #include "elf/bfin.h" #include "dwarf2.h" #include "hashtab.h" +#include "elf32-bfin.h" /* FUNCTION : bfin_pltpc_reloc ABSTRACT : TODO : figure out how to handle pltpc relocs. */ @@ -1133,14 +1134,14 @@ bfd_boolean elf32_bfin_code_in_l1 = 0; /* Set by ld emulation if --data-in-l1. */ bfd_boolean elf32_bfin_data_in_l1 = 0; -static void -elf32_bfin_final_write_processing (bfd *abfd, - bfd_boolean linker ATTRIBUTE_UNUSED) +static bfd_boolean +elf32_bfin_final_write_processing (bfd *abfd) { if (elf32_bfin_code_in_l1) elf_elfheader (abfd)->e_flags |= EF_BFIN_CODE_IN_L1; if (elf32_bfin_data_in_l1) elf_elfheader (abfd)->e_flags |= EF_BFIN_DATA_IN_L1; + return _bfd_elf_final_write_processing (abfd); } /* Return TRUE if the name is a local label. @@ -1210,9 +1211,7 @@ bfin_check_relocs (bfd * abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_BFIN_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; @@ -1603,7 +1602,7 @@ bfin_relocate_section (bfd * output_bfd, if (name == NULL) return FALSE; if (*name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (r == bfd_reloc_overflow) @@ -1729,7 +1728,7 @@ static struct bfd_link_hash_table * bfinfdpic_elf_link_hash_table_create (bfd *abfd) { struct bfinfdpic_elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct bfinfdpic_elf_link_hash_table); + size_t amt = sizeof (struct bfinfdpic_elf_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) @@ -2562,7 +2561,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { @@ -2780,8 +2779,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, bfd_vma offset; addend += bfinfdpic_got_section (info)->output_section->vma; - if ((bfd_get_section_flags (output_bfd, - input_section->output_section) + if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { if (_bfinfdpic_osec_readonly_p (output_bfd, @@ -2809,8 +2807,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, picrel); } } - else if ((bfd_get_section_flags (output_bfd, - input_section->output_section) + else if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { bfd_vma offset; @@ -2903,8 +2900,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, if (osec) addend += osec->output_section->vma; if (IS_FDPIC (input_bfd) - && (bfd_get_section_flags (output_bfd, - input_section->output_section) + && (bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { if (_bfinfdpic_osec_readonly_p (output_bfd, @@ -2941,8 +2937,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, } else { - if ((bfd_get_section_flags (output_bfd, - input_section->output_section) + if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { if (_bfinfdpic_osec_readonly_p (output_bfd, @@ -3203,7 +3198,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); elf_hash_table (info)->sgot = s; if (s == NULL - || !bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; if (bed->want_got_sym) @@ -3240,7 +3235,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".rel.got", (flags | SEC_READONLY)); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 2)) + || !bfd_set_section_alignment (s, 2)) return FALSE; bfinfdpic_gotrel_section (info) = s; @@ -3249,7 +3244,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".rofixup", (flags | SEC_READONLY)); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 2)) + || !bfd_set_section_alignment (s, 2)) return FALSE; bfinfdpic_gotfixup_section (info) = s; @@ -3263,7 +3258,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; /* Blackfin-specific: remember it. */ bfinfdpic_plt_section (info) = s; @@ -3291,7 +3286,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".rel.plt", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; /* Blackfin-specific: remember it. */ bfinfdpic_pltrel_section (info) = s; @@ -3357,7 +3352,7 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) ".rela.bss", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; } } @@ -4618,7 +4613,7 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_BFIN_FUNCDESC_VALUE: picrel->relocsfdv++; - if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + if (bfd_section_flags (sec) & SEC_ALLOC) picrel->relocs32--; /* Fall through. */ @@ -4627,7 +4622,7 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info, break; picrel->sym++; - if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + if (bfd_section_flags (sec) & SEC_ALLOC) picrel->relocs32++; break; @@ -4760,6 +4755,10 @@ elf32_bfin_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) flagword old_flags, new_flags; bfd_boolean error = FALSE; + /* FIXME: What should be checked when linking shared libraries? */ + if ((ibfd->flags & DYNAMIC) != 0) + return TRUE; + new_flags = elf_elfheader (ibfd)->e_flags; old_flags = elf_elfheader (obfd)->e_flags; @@ -4847,7 +4846,7 @@ static struct bfd_link_hash_table * bfin_link_hash_table_create (bfd * abfd) { struct bfin_link_hash_table *ret; - bfd_size_type amt = sizeof (struct bfin_link_hash_table); + size_t amt = sizeof (struct bfin_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) @@ -5066,9 +5065,9 @@ bfin_adjust_dynamic_symbol (struct bfd_link_info *info, /* Apply the required alignment. */ s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) + if (power_of_two > bfd_section_alignment (s)) { - if (!bfd_set_section_alignment (dynobj, s, power_of_two)) + if (!bfd_set_section_alignment (s, power_of_two)) return FALSE; } @@ -5202,7 +5201,7 @@ bfin_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, s); + name = bfd_section_name (s); strip = FALSE; @@ -5403,7 +5402,7 @@ bfd_bfin_elf32_create_embedded_relocs (bfd *abfd, free (internal_relocs); return TRUE; -error_return: + error_return: if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf) free (isymbuf); if (internal_relocs != NULL