Make the assembler generate an error if there is an attempt to define a section with...
[deliverable/binutils-gdb.git] / bfd / coffcode.h
index f4bfea0ceb706b20c33600b36a32c8c89b810d03..dec2e9c63708107048ced5f1e99c3937187ac198 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for the generic parts of most COFF variants, for BFD.
 /* Support for the generic parts of most COFF variants, for BFD.
-   Copyright (C) 1990-2019 Free Software Foundation, Inc.
+   Copyright (C) 1990-2020 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -1174,6 +1174,11 @@ styp_to_sec_flags (bfd *abfd,
 #ifdef COFF_LONG_SECTION_NAMES
       || CONST_STRNEQ (name, GNU_LINKONCE_WI)
       || CONST_STRNEQ (name, GNU_LINKONCE_WT)
 #ifdef COFF_LONG_SECTION_NAMES
       || CONST_STRNEQ (name, GNU_LINKONCE_WI)
       || CONST_STRNEQ (name, GNU_LINKONCE_WT)
+      /* FIXME: These definitions ought to be in a header file.  */
+#define GNU_DEBUGLINK          ".gnu_debuglink"
+#define GNU_DEBUGALTLINK       ".gnu_debugaltlink"
+      || CONST_STRNEQ (name, GNU_DEBUGLINK)
+      || CONST_STRNEQ (name, GNU_DEBUGALTLINK)
 #endif
       || CONST_STRNEQ (name, ".stab"))
     is_dbg = TRUE;
 #endif
       || CONST_STRNEQ (name, ".stab"))
     is_dbg = TRUE;
@@ -1691,7 +1696,7 @@ coff_set_custom_section_alignment (bfd *abfd ATTRIBUTE_UNUSED,
 
   for (i = 0; i < table_size; ++i)
     {
 
   for (i = 0; i < table_size; ++i)
     {
-      const char *secname = bfd_get_section_name (abfd, section);
+      const char *secname = bfd_section_name (section);
 
       if (alignment_table[i].comparison_length == (unsigned int) -1
          ? strcmp (alignment_table[i].name, secname) == 0
 
       if (alignment_table[i].comparison_length == (unsigned int) -1
          ? strcmp (alignment_table[i].name, secname) == 0
@@ -1754,17 +1759,17 @@ coff_new_section_hook (bfd * abfd, asection * section)
 
 #ifdef RS6000COFF_C
   if (bfd_xcoff_text_align_power (abfd) != 0
 
 #ifdef RS6000COFF_C
   if (bfd_xcoff_text_align_power (abfd) != 0
-      && strcmp (bfd_get_section_name (abfd, section), ".text") == 0)
+      && strcmp (bfd_section_name (section), ".text") == 0)
     section->alignment_power = bfd_xcoff_text_align_power (abfd);
   else if (bfd_xcoff_data_align_power (abfd) != 0
     section->alignment_power = bfd_xcoff_text_align_power (abfd);
   else if (bfd_xcoff_data_align_power (abfd) != 0
-      && strcmp (bfd_get_section_name (abfd, section), ".data") == 0)
+      && strcmp (bfd_section_name (section), ".data") == 0)
     section->alignment_power = bfd_xcoff_data_align_power (abfd);
   else
     {
       int i;
 
       for (i = 0; i < XCOFF_DWSECT_NBR_NAMES; i++)
     section->alignment_power = bfd_xcoff_data_align_power (abfd);
   else
     {
       int i;
 
       for (i = 0; i < XCOFF_DWSECT_NBR_NAMES; i++)
-       if (strcmp (bfd_get_section_name (abfd, section),
+       if (strcmp (bfd_section_name (section),
                    xcoff_dwsect_names[i].name) == 0)
          {
            section->alignment_power = 0;
                    xcoff_dwsect_names[i].name) == 0)
          {
            section->alignment_power = 0;
@@ -2102,11 +2107,19 @@ coff_set_arch_mach_hook (bfd *abfd, void * filehdr)
     case I386PTXMAGIC:
     case I386AIXMAGIC:         /* Danbury PS/2 AIX C Compiler.  */
     case LYNXCOFFMAGIC:
     case I386PTXMAGIC:
     case I386AIXMAGIC:         /* Danbury PS/2 AIX C Compiler.  */
     case LYNXCOFFMAGIC:
+    case I386_APPLE_MAGIC:
+    case I386_FREEBSD_MAGIC:
+    case I386_LINUX_MAGIC:
+    case I386_NETBSD_MAGIC:
       arch = bfd_arch_i386;
       break;
 #endif
 #ifdef AMD64MAGIC
     case AMD64MAGIC:
       arch = bfd_arch_i386;
       break;
 #endif
 #ifdef AMD64MAGIC
     case AMD64MAGIC:
+    case AMD64_APPLE_MAGIC:
+    case AMD64_FREEBSD_MAGIC:
+    case AMD64_LINUX_MAGIC:
+    case AMD64_NETBSD_MAGIC:
       arch = bfd_arch_i386;
       machine = bfd_mach_x86_64;
       break;
       arch = bfd_arch_i386;
       machine = bfd_mach_x86_64;
       break;
@@ -2148,11 +2161,14 @@ coff_set_arch_mach_hook (bfd *abfd, void * filehdr)
       arch = bfd_arch_z80;
       switch (internal_f->f_flags & F_MACHMASK)
        {
       arch = bfd_arch_z80;
       switch (internal_f->f_flags & F_MACHMASK)
        {
-       case 0:
        case bfd_mach_z80strict << 12:
        case bfd_mach_z80 << 12:
        case bfd_mach_z80full << 12:
        case bfd_mach_r800 << 12:
        case bfd_mach_z80strict << 12:
        case bfd_mach_z80 << 12:
        case bfd_mach_z80full << 12:
        case bfd_mach_r800 << 12:
+       case bfd_mach_gbz80 << 12:
+       case bfd_mach_z180 << 12:
+       case bfd_mach_ez80_z80 << 12:
+       case bfd_mach_ez80_adl << 12:
          machine = ((unsigned)internal_f->f_flags & F_MACHMASK) >> 12;
          break;
        default:
          machine = ((unsigned)internal_f->f_flags & F_MACHMASK) >> 12;
          break;
        default:
@@ -2317,12 +2333,6 @@ coff_set_arch_mach_hook (bfd *abfd, void * filehdr)
       break;
 #endif
 
       break;
 #endif
 
-#ifdef TIC80_ARCH_MAGIC
-    case TIC80_ARCH_MAGIC:
-      arch = bfd_arch_tic80;
-      break;
-#endif
-
 #ifdef MCOREMAGIC
     case MCOREMAGIC:
       arch = bfd_arch_mcore;
 #ifdef MCOREMAGIC
     case MCOREMAGIC:
       arch = bfd_arch_mcore;
@@ -2643,11 +2653,14 @@ coff_set_flags (bfd * abfd,
       *magicp = Z80MAGIC;
       switch (bfd_get_mach (abfd))
        {
       *magicp = Z80MAGIC;
       switch (bfd_get_mach (abfd))
        {
-       case 0:
        case bfd_mach_z80strict:
        case bfd_mach_z80:
        case bfd_mach_z80full:
        case bfd_mach_r800:
        case bfd_mach_z80strict:
        case bfd_mach_z80:
        case bfd_mach_z80full:
        case bfd_mach_r800:
+       case bfd_mach_gbz80:
+       case bfd_mach_z180:
+       case bfd_mach_ez80_z80:
+       case bfd_mach_ez80_adl:
          *flagsp = bfd_get_mach (abfd) << 12;
          break;
        default:
          *flagsp = bfd_get_mach (abfd) << 12;
          break;
        default:
@@ -2702,12 +2715,6 @@ coff_set_flags (bfd * abfd,
       return TRUE;
 #endif
 
       return TRUE;
 #endif
 
-#ifdef TIC80_ARCH_MAGIC
-    case bfd_arch_tic80:
-      *magicp = TIC80_ARCH_MAGIC;
-      return TRUE;
-#endif
-
 #ifdef ARMMAGIC
     case bfd_arch_arm:
 #ifdef ARM_WINCE
 #ifdef ARMMAGIC
     case bfd_arch_arm:
 #ifdef ARM_WINCE
@@ -2870,7 +2877,7 @@ sort_by_secaddr (const void * arg1, const void * arg2)
 /* Calculate the file position for each section.  */
 
 #define ALIGN_SECTIONS_IN_FILE
 /* Calculate the file position for each section.  */
 
 #define ALIGN_SECTIONS_IN_FILE
-#if defined(TIC80COFF) || defined(TICOFF)
+#ifdef TICOFF
 #undef ALIGN_SECTIONS_IN_FILE
 #endif
 
 #undef ALIGN_SECTIONS_IN_FILE
 #endif
 
@@ -3208,7 +3215,7 @@ coff_compute_section_file_positions (bfd * abfd)
         incremented in coff_set_section_contents.  This is right for
         SVR3.2.  */
       if (strcmp (current->name, _LIB) == 0)
         incremented in coff_set_section_contents.  This is right for
         SVR3.2.  */
       if (strcmp (current->name, _LIB) == 0)
-       (void) bfd_set_section_vma (abfd, current, 0);
+       bfd_set_section_vma (current, 0);
 #endif
 
 #ifdef ALIGN_SECTIONS_IN_FILE
 #endif
 
 #ifdef ALIGN_SECTIONS_IN_FILE
@@ -3798,9 +3805,6 @@ coff_write_object_contents (bfd * abfd)
      but it doesn't hurt to set it internally.  */
   internal_f.f_target_id = TI_TARGET_ID;
 #endif
      but it doesn't hurt to set it internally.  */
   internal_f.f_target_id = TI_TARGET_ID;
 #endif
-#ifdef TIC80_TARGET_ID
-  internal_f.f_target_id = TIC80_TARGET_ID;
-#endif
 
   /* FIXME, should do something about the other byte orders and
      architectures.  */
 
   /* FIXME, should do something about the other byte orders and
      architectures.  */
@@ -3828,10 +3832,6 @@ coff_write_object_contents (bfd * abfd)
     internal_a.magic = TICOFF_AOUT_MAGIC;
 #define __A_MAGIC_SET__
 #endif
     internal_a.magic = TICOFF_AOUT_MAGIC;
 #define __A_MAGIC_SET__
 #endif
-#ifdef TIC80COFF
-    internal_a.magic = TIC80_ARCH_MAGIC;
-#define __A_MAGIC_SET__
-#endif /* TIC80 */
 
 #if defined(ARM)
 #define __A_MAGIC_SET__
 
 #if defined(ARM)
 #define __A_MAGIC_SET__
@@ -3998,7 +3998,7 @@ coff_write_object_contents (bfd * abfd)
       if (text_sec != NULL)
        {
          internal_a.o_sntext = text_sec->target_index;
       if (text_sec != NULL)
        {
          internal_a.o_sntext = text_sec->target_index;
-         internal_a.o_algntext = bfd_get_section_alignment (abfd, text_sec);
+         internal_a.o_algntext = bfd_section_alignment (text_sec);
        }
       else
        {
        }
       else
        {
@@ -4008,7 +4008,7 @@ coff_write_object_contents (bfd * abfd)
       if (data_sec != NULL)
        {
          internal_a.o_sndata = data_sec->target_index;
       if (data_sec != NULL)
        {
          internal_a.o_sndata = data_sec->target_index;
-         internal_a.o_algndata = bfd_get_section_alignment (abfd, data_sec);
+         internal_a.o_algndata = bfd_section_alignment (data_sec);
        }
       else
        {
        }
       else
        {
@@ -4377,8 +4377,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
           PR 17521: file: 078-10659-0.004.  */
        continue;
       else
           PR 17521: file: 078-10659-0.004.  */
        continue;
       else
-       cache_ptr->u.offset = (dst.l_addr.l_paddr
-                              - bfd_section_vma (abfd, asect));
+       cache_ptr->u.offset = dst.l_addr.l_paddr - bfd_section_vma (asect);
       cache_ptr++;
     }
 
       cache_ptr++;
     }
 
@@ -4763,7 +4762,7 @@ coff_slurp_symbol_table (bfd * abfd)
            case C_ALIAS:       /* Duplicate tag.  */
 #endif
              /* New storage classes for TI COFF.  */
            case C_ALIAS:       /* Duplicate tag.  */
 #endif
              /* New storage classes for TI COFF.  */
-#if defined(TIC80COFF) || defined(TICOFF)
+#ifdef TICOFF
            case C_UEXT:        /* Tentative external definition.  */
 #endif
            case C_EXTLAB:      /* External load time label.  */
            case C_UEXT:        /* Tentative external definition.  */
 #endif
            case C_EXTLAB:      /* External load time label.  */
@@ -4796,7 +4795,7 @@ coff_slurp_symbol_table (bfd * abfd)
   obj_symbols (abfd) = cached_area;
   obj_raw_syments (abfd) = native_symbols;
 
   obj_symbols (abfd) = cached_area;
   obj_raw_syments (abfd) = native_symbols;
 
-  bfd_get_symcount (abfd) = number_of_symbols;
+  abfd->symcount = number_of_symbols;
   obj_convert (abfd) = table_ptr;
   /* Slurp the line tables for each section too.  */
   {
   obj_convert (abfd) = table_ptr;
   /* Slurp the line tables for each section too.  */
   {
@@ -4873,7 +4872,7 @@ coff_classify_symbol (bfd *abfd,
          name = _bfd_coff_internal_syment_name (abfd, syment, buf)
          sec = coff_section_from_bfd_index (abfd, syment->n_scnum);
          if (sec != NULL && name != NULL
          name = _bfd_coff_internal_syment_name (abfd, syment, buf)
          sec = coff_section_from_bfd_index (abfd, syment->n_scnum);
          if (sec != NULL && name != NULL
-             && (strcmp (bfd_get_section_name (abfd, sec), name) == 0))
+             && (strcmp (bfd_section_name (sec), name) == 0))
            return COFF_SYMBOL_PE_SECTION;
        }
 #endif
            return COFF_SYMBOL_PE_SECTION;
        }
 #endif
@@ -5649,7 +5648,7 @@ static bfd_coff_backend_data bigobj_swap_table =
 #endif /* COFF_WITH_PE_BIGOBJ */
 
 #ifndef coff_close_and_cleanup
 #endif /* COFF_WITH_PE_BIGOBJ */
 
 #ifndef coff_close_and_cleanup
-#define coff_close_and_cleanup             _bfd_generic_close_and_cleanup
+#define coff_close_and_cleanup             _bfd_coff_close_and_cleanup
 #endif
 
 #ifndef coff_bfd_free_cached_info
 #endif
 
 #ifndef coff_bfd_free_cached_info
@@ -5738,6 +5737,10 @@ static bfd_coff_backend_data bigobj_swap_table =
 #define coff_bfd_is_group_section          bfd_generic_is_group_section
 #endif
 
 #define coff_bfd_is_group_section          bfd_generic_is_group_section
 #endif
 
+#ifndef coff_bfd_group_name
+#define coff_bfd_group_name                bfd_coff_group_name
+#endif
+
 #ifndef coff_bfd_discard_group
 #define coff_bfd_discard_group             bfd_generic_discard_group
 #endif
 #ifndef coff_bfd_discard_group
 #define coff_bfd_discard_group             bfd_generic_discard_group
 #endif
This page took 0.03268 seconds and 4 git commands to generate.