Automatic date update in version.in
[binutils-gdb.git] / bfd / bfd.c
index abe50939e2495b280a6ba2b05ad49dd57a63641e..913ce2d6abe9cfd1b30d58feff10b7f8e5adde42 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1,5 +1,5 @@
 /* Generic BFD library interface and support routines.
-   Copyright (C) 1990-2021 Free Software Foundation, Inc.
+   Copyright (C) 1990-2022 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -276,10 +276,19 @@ CODE_FRAGMENT
 .  {* The number of sections.  *}
 .  unsigned int section_count;
 .
+.  {* The archive plugin file descriptor.  *}
+.  int archive_plugin_fd;
+.
+.  {* The number of opens on the archive plugin file descriptor.  *}
+.  unsigned int archive_plugin_fd_open_count;
+.
 .  {* A field used by _bfd_generic_link_add_archive_symbols.  This will
 .     be used only for archive elements.  *}
 .  int archive_pass;
 .
+.  {* The total size of memory from bfd_alloc.  *}
+.  bfd_size_type alloc_size;
+.
 .  {* Stuff only useful for object files:
 .     The start address.  *}
 .  bfd_vma start_address;
@@ -1042,12 +1051,7 @@ _bfd_doprnt (FILE *stream, const char *format, union _bfd_doprnt_args *args)
                        *sptr++ = ptr[-1];
                        *sptr = '\0';
 #endif
-#if defined (__GNUC__) || defined (HAVE_LONG_LONG)
                        PRINT_TYPE (long long, ll);
-#else
-                       /* Fake it and hope for the best.  */
-                       PRINT_TYPE (long, l);
-#endif
                        break;
                      }
                  }
@@ -1062,14 +1066,7 @@ _bfd_doprnt (FILE *stream, const char *format, union _bfd_doprnt_args *args)
                if (wide_width == 0)
                  PRINT_TYPE (double, d);
                else
-                 {
-#if defined (__GNUC__) || defined (HAVE_LONG_DOUBLE)
-                   PRINT_TYPE (long double, ld);
-#else
-                   /* Fake it and hope for the best.  */
-                   PRINT_TYPE (double, d);
-#endif
-                 }
+                 PRINT_TYPE (long double, ld);
              }
              break;
            case 's':
@@ -1271,11 +1268,7 @@ _bfd_doprnt_scan (const char *format, union _bfd_doprnt_args *args)
                        break;
                      case 2:
                      default:
-#if defined (__GNUC__) || defined (HAVE_LONG_LONG)
                        arg_type = LongLong;
-#else
-                       arg_type = Long;
-#endif
                        break;
                      }
                  }
@@ -1290,13 +1283,7 @@ _bfd_doprnt_scan (const char *format, union _bfd_doprnt_args *args)
                if (wide_width == 0)
                  arg_type = Double;
                else
-                 {
-#if defined (__GNUC__) || defined (HAVE_LONG_DOUBLE)
-                   arg_type = LongDouble;
-#else
-                   arg_type = Double;
-#endif
-                 }
+                 arg_type = LongDouble;
              }
              break;
            case 's':
@@ -1751,6 +1738,7 @@ bfd_get_sign_extend_vma (bfd *abfd)
       || strcmp (name, "pei-i386") == 0
       || strcmp (name, "pe-x86-64") == 0
       || strcmp (name, "pei-x86-64") == 0
+      || strcmp (name, "pei-aarch64-little") == 0
       || strcmp (name, "pe-arm-wince-little") == 0
       || strcmp (name, "pei-arm-wince-little") == 0
       || strcmp (name, "aixcoff-rs6000") == 0
@@ -1873,6 +1861,24 @@ _bfd_set_gp_value (bfd *abfd, bfd_vma v)
     elf_gp (abfd) = v;
 }
 
+/*
+FUNCTION
+       bfd_set_gp_value
+
+SYNOPSIS
+       void bfd_set_gp_value (bfd *abfd, bfd_vma v);
+
+DESCRIPTION
+       Allow external access to the fucntion to set the GP value.
+       This is specifically added for gdb-compile support.
+*/
+
+void
+bfd_set_gp_value (bfd *abfd, bfd_vma v)
+{
+  _bfd_set_gp_value (abfd, v);
+}
+
 /*
 FUNCTION
        bfd_scan_vma
@@ -1906,10 +1912,8 @@ bfd_scan_vma (const char *string, const char **end, int base)
   if (sizeof (bfd_vma) <= sizeof (unsigned long))
     return strtoul (string, (char **) end, base);
 
-#if defined (HAVE_STRTOULL) && defined (HAVE_LONG_LONG)
   if (sizeof (bfd_vma) <= sizeof (unsigned long long))
     return strtoull (string, (char **) end, base);
-#endif
 
   if (base == 0)
     {
@@ -2340,7 +2344,7 @@ FUNCTION
        bfd_emul_get_commonpagesize
 
 SYNOPSIS
-       bfd_vma bfd_emul_get_commonpagesize (const char *, bool);
+       bfd_vma bfd_emul_get_commonpagesize (const char *);
 
 DESCRIPTION
        Returns the common page size, in bytes, as determined by
@@ -2351,7 +2355,7 @@ RETURNS
 */
 
 bfd_vma
-bfd_emul_get_commonpagesize (const char *emul, bool relro)
+bfd_emul_get_commonpagesize (const char *emul)
 {
   const bfd_target *target;
 
@@ -2362,10 +2366,7 @@ bfd_emul_get_commonpagesize (const char *emul, bool relro)
       const struct elf_backend_data *bed;
 
       bed = xvec_get_elf_backend_data (target);
-      if (relro)
-       return bed->relropagesize;
-      else
-       return bed->commonpagesize;
+      return bed->commonpagesize;
     }
   return 0;
 }
@@ -2500,7 +2501,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents,
              Elf32_External_Chdr *echdr = (Elf32_External_Chdr *) contents;
              bfd_put_32 (abfd, ELFCOMPRESS_ZLIB, &echdr->ch_type);
              bfd_put_32 (abfd, sec->size, &echdr->ch_size);
-             bfd_put_32 (abfd, 1 << sec->alignment_power,
+             bfd_put_32 (abfd, 1u << sec->alignment_power,
                          &echdr->ch_addralign);
              /* bfd_log2 (alignof (Elf32_Chdr)) */
              bfd_set_section_alignment (sec, 2);
@@ -2512,7 +2513,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents,
              bfd_put_32 (abfd, ELFCOMPRESS_ZLIB, &echdr->ch_type);
              bfd_put_32 (abfd, 0, &echdr->ch_reserved);
              bfd_put_64 (abfd, sec->size, &echdr->ch_size);
-             bfd_put_64 (abfd, 1 << sec->alignment_power,
+             bfd_put_64 (abfd, UINT64_C (1) << sec->alignment_power,
                          &echdr->ch_addralign);
              /* bfd_log2 (alignof (Elf64_Chdr)) */
              bfd_set_section_alignment (sec, 3);