Add output_type to bfd_link_info
[deliverable/binutils-gdb.git] / bfd / elf32-bfin.c
index 80d20ca224f85f45374d0be10ae93beadcf7ae06..49ef360bcdfd88709b15f5507d44a1eabf44241c 100644 (file)
@@ -1165,7 +1165,7 @@ bfin_check_relocs (bfd * abfd,
   asection *sgot;
   asection *srelgot;
 
-  if (info->relocatable)
+  if (bfd_link_relocatable (info))
     return TRUE;
 
   dynobj = elf_hash_table (info)->dynobj;
@@ -1232,7 +1232,7 @@ bfin_check_relocs (bfd * abfd,
              BFD_ASSERT (sgot != NULL);
            }
 
-         if (srelgot == NULL && (h != NULL || info->shared))
+         if (srelgot == NULL && (h != NULL || bfd_link_pic (info)))
            {
              srelgot = bfd_get_linker_section (dynobj, ".rela.got");
              if (srelgot == NULL)
@@ -1285,7 +1285,7 @@ bfin_check_relocs (bfd * abfd,
              if (local_got_refcounts[r_symndx] == 0)
                {
                  sgot->size += 4;
-                 if (info->shared)
+                 if (bfd_link_pic (info))
                    {
                      /* If we are generating a shared object, we need to
                         output a R_68K_RELATIVE reloc so that the dynamic
@@ -1455,7 +1455,7 @@ bfin_relocate_section (bfd * output_bfd,
        RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
                                         rel, 1, relend, howto, 0, contents);
 
-      if (info->relocatable)
+      if (bfd_link_relocatable (info))
        continue;
 
       address = rel->r_offset;
@@ -1502,8 +1502,10 @@ bfin_relocate_section (bfd * output_bfd,
                BFD_ASSERT (off != (bfd_vma) - 1);
                dyn = elf_hash_table (info)->dynamic_sections_created;
 
-               if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
-                   || (info->shared
+               if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
+                                                     bfd_link_pic (info),
+                                                     h)
+                   || (bfd_link_pic (info)
                        && (info->symbolic
                            || h->dynindx == -1
                            || h->forced_local)
@@ -1548,7 +1550,7 @@ bfin_relocate_section (bfd * output_bfd,
                  {
                    bfd_put_32 (output_bfd, relocation, sgot->contents + off);
 
-                   if (info->shared)
+                   if (bfd_link_pic (info))
                      {
                        asection *s;
                        Elf_Internal_Rela outrel;
@@ -1719,7 +1721,7 @@ bfin_gc_sweep_hook (bfd * abfd,
                    {
                      /* We don't need the .got entry any more.  */
                      sgot->size -= 4;
-                     if (info->shared)
+                     if (bfd_link_pic (info))
                        srelgot->size -= sizeof (Elf32_External_Rela);
                    }
                }
@@ -2213,7 +2215,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
       /* If we're linking an executable at a fixed address, we can
         omit the dynamic relocation as long as the symbol is local to
         this module.  */
-      if (info->executable && !info->pie
+      if (bfd_link_executable (info) && !bfd_link_pic (info)
          && (entry->symndx != -1
              || BFINFDPIC_SYM_LOCAL (info, entry->d.h)))
        {
@@ -2268,7 +2270,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
          if (entry->symndx == -1
              && ! BFINFDPIC_FUNCDESC_LOCAL (info, entry->d.h)
              && BFINFDPIC_SYM_LOCAL (info, entry->d.h)
-             && !(info->executable && !info->pie))
+             && !(bfd_link_executable (info) && !bfd_link_pic (info)))
            {
              reloc = R_BFIN_FUNCDESC;
              idx = elf_section_data (entry->d.h->root.u.def.section
@@ -2304,7 +2306,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
             dynamic symbol entry for the got section, so idx will be
             zero, which means we can and should compute the address
             of the private descriptor ourselves.  */
-         if (info->executable && !info->pie
+         if (bfd_link_executable (info) && !bfd_link_pic (info)
              && (entry->symndx != -1
                  || BFINFDPIC_FUNCDESC_LOCAL (info, entry->d.h)))
            {
@@ -2367,7 +2369,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
       /* If we're linking an executable at a fixed address, we can
         omit the dynamic relocation as long as the symbol is local to
         this module.  */
-      if (info->executable && !info->pie
+      if (bfd_link_executable (info) && !bfd_link_pic (info)
          && (entry->symndx != -1 || BFINFDPIC_SYM_LOCAL (info, entry->d.h)))
        {
          if (sec)
@@ -2415,7 +2417,10 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
 
       /* If we've omitted the dynamic relocation, just emit the fixed
         addresses of the symbol and of the local GOT base offset.  */
-      if (info->executable && !info->pie && sec && sec->output_section)
+      if (bfd_link_executable (info)
+         && !bfd_link_pic (info)
+         && sec
+         && sec->output_section)
        {
          lowword = ad;
          highword = bfinfdpic_got_section (info)->output_section->vma
@@ -2595,7 +2600,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
   Elf_Internal_Rela *relend;
   unsigned isec_segment, got_segment, plt_segment,
     check_segment[2];
-  int silence_segment_error = !(info->shared || info->pie);
+  int silence_segment_error = !bfd_link_pic (info);
 
   symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
@@ -2675,7 +2680,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
        RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
                                         rel, 1, relend, howto, 0, contents);
 
-      if (info->relocatable)
+      if (bfd_link_relocatable (info))
        continue;
 
       if (h != NULL
@@ -2829,7 +2834,8 @@ bfinfdpic_relocate_section (bfd * output_bfd,
                   section+offset.  */
                if (h && ! BFINFDPIC_FUNCDESC_LOCAL (info, h)
                    && BFINFDPIC_SYM_LOCAL (info, h)
-                   && !(info->executable && !info->pie))
+                   && !(bfd_link_executable (info)
+                        && !bfd_link_pic (info)))
                  {
                    dynindx = elf_section_data (h->root.u.def.section
                                                ->output_section)->dynindx;
@@ -2866,7 +2872,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
                   dynamic symbol entry for the got section, so idx will
                   be zero, which means we can and should compute the
                   address of the private descriptor ourselves.  */
-               if (info->executable && !info->pie
+               if (bfd_link_executable (info) && !bfd_link_pic (info)
                    && (!h || BFINFDPIC_FUNCDESC_LOCAL (info, h)))
                  {
                    bfd_vma offset;
@@ -2989,7 +2995,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
               can omit the dynamic relocation as long as the symbol
               is defined in the current link unit (which is implied
               by its output section not being NULL).  */
-           if (info->executable && !info->pie
+           if (bfd_link_executable (info) && !bfd_link_pic (info)
                && (!h || BFINFDPIC_SYM_LOCAL (info, h)))
              {
                if (osec)
@@ -3069,7 +3075,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
                /* If we've omitted the dynamic relocation, just emit
                   the fixed addresses of the symbol and of the local
                   GOT base offset.  */
-               if (info->executable && !info->pie
+               if (bfd_link_executable (info) && !bfd_link_pic (info)
                    && (!h || BFINFDPIC_SYM_LOCAL (info, h)))
                  bfd_put_32 (output_bfd,
                              bfinfdpic_got_section (info)->output_section->vma
@@ -3127,11 +3133,11 @@ bfinfdpic_relocate_section (bfd * output_bfd,
                   && picrel->d.h->root.type == bfd_link_hash_undefined))
            info->callbacks->warning
              (info,
-              (info->shared || info->pie)
+              bfd_link_pic (info)
               ? _("relocations between different segments are not supported")
               : _("warning: relocation references a different segment"),
               name, input_bfd, input_section, rel->r_offset);
-         if (!silence_segment_error && (info->shared || info->pie))
+         if (!silence_segment_error && bfd_link_pic (info))
            return FALSE;
          elf_elfheader (output_bfd)->e_flags |= EF_BFIN_PIC;
        }
@@ -3497,7 +3503,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info)
       h->def_regular = 1;
       h->type = STT_OBJECT;
 
-      if (! info->executable
+      if (! bfd_link_executable (info)
          && ! bfd_elf_link_record_dynamic_symbol (info, h))
        return FALSE;
     }
@@ -3566,7 +3572,7 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
         be needed, we can discard it later.  We will never need this
         section when generating a shared object, since they do not use
         copy relocs.  */
-      if (! info->shared)
+      if (! bfd_link_pic (info))
        {
          s = bfd_make_section_anyway_with_flags (abfd,
                                                  ".rela.bss",
@@ -3649,7 +3655,7 @@ _bfinfdpic_count_relocs_fixups (struct bfinfdpic_relocs_info *entry,
 {
   bfd_vma relocs = 0, fixups = 0;
 
-  if (!dinfo->info->executable || dinfo->info->pie)
+  if (!bfd_link_executable (dinfo->info) || bfd_link_pie (dinfo->info))
     relocs = entry->relocs32 + entry->relocsfd + entry->relocsfdv;
   else
     {
@@ -4251,7 +4257,7 @@ elf32_bfinfdpic_size_dynamic_sections (bfd *output_bfd,
   if (htab->dynamic_sections_created)
     {
       /* Set the contents of the .interp section to the interpreter.  */
-      if (info->executable)
+      if (bfd_link_executable (info))
        {
          s = bfd_get_linker_section (dynobj, ".interp");
          BFD_ASSERT (s != NULL);
@@ -4318,7 +4324,7 @@ static bfd_boolean
 elf32_bfinfdpic_always_size_sections (bfd *output_bfd,
                                     struct bfd_link_info *info)
 {
-  if (!info->relocatable
+  if (!bfd_link_relocatable (info)
       && !bfd_elf_stack_segment_size (output_bfd, info,
                                      "__stacksize", DEFAULT_STACK_SIZE))
     return FALSE;
@@ -4735,7 +4741,7 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info,
   bfd *dynobj;
   struct bfinfdpic_relocs_info *picrel;
 
-  if (info->relocatable)
+  if (bfd_link_relocatable (info))
     return TRUE;
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
@@ -5145,7 +5151,7 @@ bfin_finish_dynamic_symbol (bfd * output_bfd,
          the symbol was forced to be local because of a version file.
          The entry in the global offset table will already have been
          initialized in the relocate_section function.  */
-      if (info->shared
+      if (bfd_link_pic (info)
          && (info->symbolic
              || h->dynindx == -1 || h->forced_local) && h->def_regular)
        {
@@ -5232,7 +5238,7 @@ bfin_adjust_dynamic_symbol (struct bfd_link_info *info,
      only references to the symbol are via the global offset table.
      For such cases we need not do anything here; the relocations will
      be handled correctly by relocate_section.  */
-  if (info->shared)
+  if (bfd_link_pic (info))
     return TRUE;
 
   /* We must allocate the symbol in our .dynbss section, which will
@@ -5362,7 +5368,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
   if (elf_hash_table (info)->dynamic_sections_created)
     {
       /* Set the contents of the .interp section to the interpreter.  */
-      if (info->executable)
+      if (bfd_link_executable (info))
        {
          s = bfd_get_linker_section (dynobj, ".interp");
          BFD_ASSERT (s != NULL);
@@ -5388,7 +5394,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
      against symbols that have become local due to visibility changes.
      We allocated space for them in the check_relocs routine, but we
      will not fill them in in the relocate_section routine.  */
-  if (info->shared)
+  if (bfd_link_pic (info))
     elf_link_hash_traverse (elf_hash_table (info),
                            bfin_discard_copies, info);
 
@@ -5467,7 +5473,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
 #define add_dynamic_entry(TAG, VAL) \
   _bfd_elf_add_dynamic_entry (info, TAG, VAL)
 
-      if (!info->shared)
+      if (!bfd_link_pic (info))
        {
          if (!add_dynamic_entry (DT_DEBUG, 0))
            return FALSE;
@@ -5515,7 +5521,7 @@ bfd_bfin_elf32_create_embedded_relocs (bfd *abfd,
   bfd_byte *p;
   bfd_size_type amt;
 
-  BFD_ASSERT (! info->relocatable);
+  BFD_ASSERT (! bfd_link_relocatable (info));
 
   *errmsg = NULL;
 
This page took 0.031791 seconds and 4 git commands to generate.