RISC-V: Add elfNN_riscv_mkobject to initialize RISC-V tdata.
[deliverable/binutils-gdb.git] / bfd / elf32-bfin.c
index 5b8f5b92642ae942b1b2f035a4a35e891c803b58..e6383a782ff6c7a0c5bb525a9b0c119e5fbc4682 100644 (file)
@@ -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)
+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;
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Return TRUE if the name is a local label.
@@ -1601,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)
@@ -1727,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)
@@ -2560,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
        {
@@ -2778,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,
@@ -2807,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;
@@ -2901,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,
@@ -2939,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,
@@ -3201,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)
@@ -3238,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;
@@ -3247,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;
@@ -3261,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;
@@ -3289,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;
@@ -3355,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;
        }
     }
@@ -4616,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.  */
 
@@ -4625,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;
 
@@ -4758,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;
 
@@ -4845,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)
@@ -5064,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;
     }
 
@@ -5200,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;
 
@@ -5401,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
This page took 0.026517 seconds and 4 git commands to generate.