]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - bfd/bfd.c
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / bfd / bfd.c
index 538bdfa5d7df9dfbd3fb1e73bf57e145a4fc543e..f19443388386f156c2ecae4bec7b0a1dda617d85 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1,5 +1,5 @@
 /* Generic BFD library interface and support routines.
-   Copyright (C) 1990-2020 Free Software Foundation, Inc.
+   Copyright (C) 1990-2021 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -245,6 +245,10 @@ CODE_FRAGMENT
 .  {* Set if this is a slim LTO object not loaded with a compiler plugin.  *}
 .  unsigned int lto_slim_object : 1;
 .
+.  {* Do not attempt to modify this file.  Set when detecting errors
+.     that BFD is not prepared to handle for objcopy/strip.  *}
+.  unsigned int read_only : 1;
+.
 .  {* Set to dummy BFD created when claimed by a compiler plug-in
 .     library.  *}
 .  bfd *plugin_dummy_bfd;
@@ -2331,49 +2335,6 @@ bfd_emul_get_maxpagesize (const char *emul)
   return 0;
 }
 
-static void
-bfd_elf_set_pagesize (const bfd_target *target, bfd_vma size,
-                     int offset, const bfd_target *orig_target)
-{
-  if (target->flavour == bfd_target_elf_flavour)
-    {
-      const struct elf_backend_data *bed;
-
-      bed = xvec_get_elf_backend_data (target);
-      *((bfd_vma *) ((char *) bed + offset)) = size;
-    }
-
-  if (target->alternative_target
-      && target->alternative_target != orig_target)
-    bfd_elf_set_pagesize (target->alternative_target, size, offset,
-                         orig_target);
-}
-
-/*
-FUNCTION
-       bfd_emul_set_maxpagesize
-
-SYNOPSIS
-       void bfd_emul_set_maxpagesize (const char *, bfd_vma);
-
-DESCRIPTION
-       For ELF, set the maximum page size for the emulation.  It is
-       a no-op for other formats.
-
-*/
-
-void
-bfd_emul_set_maxpagesize (const char *emul, bfd_vma size)
-{
-  const bfd_target *target;
-
-  target = bfd_find_target (emul, NULL);
-  if (target)
-    bfd_elf_set_pagesize (target, size,
-                         offsetof (struct elf_backend_data,
-                                   maxpagesize), target);
-}
-
 /*
 FUNCTION
        bfd_emul_get_commonpagesize
@@ -2409,31 +2370,6 @@ bfd_emul_get_commonpagesize (const char *emul, bfd_boolean relro)
   return 0;
 }
 
-/*
-FUNCTION
-       bfd_emul_set_commonpagesize
-
-SYNOPSIS
-       void bfd_emul_set_commonpagesize (const char *, bfd_vma);
-
-DESCRIPTION
-       For ELF, set the common page size for the emulation.  It is
-       a no-op for other formats.
-
-*/
-
-void
-bfd_emul_set_commonpagesize (const char *emul, bfd_vma size)
-{
-  const bfd_target *target;
-
-  target = bfd_find_target (emul, NULL);
-  if (target)
-    bfd_elf_set_pagesize (target, size,
-                         offsetof (struct elf_backend_data,
-                                   commonpagesize), target);
-}
-
 /*
 FUNCTION
        bfd_demangle
@@ -2554,6 +2490,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents,
       if ((abfd->flags & BFD_COMPRESS_GABI) != 0)
        {
          const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+         struct bfd_elf_section_data * esd = elf_section_data (sec);
 
          /* Set the SHF_COMPRESSED bit.  */
          elf_section_flags (sec) |= SHF_COMPRESSED;
@@ -2567,6 +2504,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents,
                          &echdr->ch_addralign);
              /* bfd_log2 (alignof (Elf32_Chdr)) */
              bfd_set_section_alignment (sec, 2);
+             esd->this_hdr.sh_addralign = 4;
            }
          else
            {
@@ -2578,6 +2516,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents,
                          &echdr->ch_addralign);
              /* bfd_log2 (alignof (Elf64_Chdr)) */
              bfd_set_section_alignment (sec, 3);
+             esd->this_hdr.sh_addralign = 8;
            }
          break;
        }