Automatic date update in version.in
[binutils-gdb.git] / bfd / mach-o.c
index 1f0d47008110a78a74ab86faef11ae696a86791e..e32b7873cef6b78f2ff994ef550e160a49710a96 100644 (file)
@@ -1,5 +1,5 @@
 /* Mach-O support for BFD.
-   Copyright (C) 1999-2021 Free Software Foundation, Inc.
+   Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -36,7 +36,7 @@
 #define bfd_mach_o_mkobject bfd_mach_o_gen_mkobject
 
 #define FILE_ALIGN(off, algn) \
-  (((off) + ((file_ptr) 1 << (algn)) - 1) & ((file_ptr) -1U << (algn)))
+  (((off) + ((ufile_ptr) 1 << (algn)) - 1) & ((ufile_ptr) -1 << (algn)))
 
 static bool
 bfd_mach_o_read_dyld_content (bfd *abfd, bfd_mach_o_dyld_info_command *cmd);
@@ -3653,12 +3653,12 @@ bfd_mach_o_read_section_32 (bfd *abfd, unsigned long prot)
   section->offset = bfd_h_get_32 (abfd, raw.offset);
   section->align = bfd_h_get_32 (abfd, raw.align);
   /* PR 17512: file: 0017eb76.  */
-  if (section->align > 64)
+  if (section->align >= 31)
     {
       _bfd_error_handler
-       (_("bfd_mach_o_read_section_32: overlarge alignment value: %#lx, "
-          "using 32 instead"), section->align);
-      section->align = 32;
+       (_("bfd_mach_o_read_section_32: overlarge alignment value: %#lx"),
+        section->align);
+      section->align = 30;
     }
   section->reloff = bfd_h_get_32 (abfd, raw.reloff);
   section->nreloc = bfd_h_get_32 (abfd, raw.nreloc);
@@ -3696,12 +3696,12 @@ bfd_mach_o_read_section_64 (bfd *abfd, unsigned long prot)
   section->size = bfd_h_get_64 (abfd, raw.size);
   section->offset = bfd_h_get_32 (abfd, raw.offset);
   section->align = bfd_h_get_32 (abfd, raw.align);
-  if (section->align > 64)
+  if (section->align >= 63)
     {
       _bfd_error_handler
-       (_("bfd_mach_o_read_section_64: overlarge alignment value: %#lx, "
-          "using 32 instead"), section->align);
-      section->align = 32;
+       (_("bfd_mach_o_read_section_64: overlarge alignment value: %#lx"),
+        section->align);
+      section->align = 62;
     }
   section->reloff = bfd_h_get_32 (abfd, raw.reloff);
   section->nreloc = bfd_h_get_32 (abfd, raw.nreloc);