[binutils-gdb] bfd/ELF: drop align_file_position()

Jan Beulich jbeulich@sourceware.org
Fri Oct 11 06:21:57 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=29ed50151ab5905776eb3d5a956ac964ea852342

commit 29ed50151ab5905776eb3d5a956ac964ea852342
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Oct 11 08:20:06 2024 +0200

    bfd/ELF: drop align_file_position()
    
    Switch the sole user to BFD_ALIGN() instead. (It's comment was partly
    wrong [stale?] anyway, talking of some maximum that was nowhere in
    sight.)

Diff:
---
 bfd/elf.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/bfd/elf.c b/bfd/elf.c
index 27d45fc17a5..5d85742326d 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4557,15 +4557,6 @@ elf_map_symbols (bfd *abfd, unsigned int *pnum_locals)
   return true;
 }
 
-/* Align to the maximum file alignment that could be required for any
-   ELF data structure.  */
-
-static inline file_ptr
-align_file_position (file_ptr off, int align)
-{
-  return (off + align - 1) & ~(align - 1);
-}
-
 /* Assign a file position to a section, optionally aligning to the
    required section alignment.  */
 
@@ -7116,7 +7107,7 @@ _bfd_elf_assign_file_positions_for_non_load (bfd *abfd)
 
   /* Place the section headers.  */
   i_ehdrp = elf_elfheader (abfd);
-  off = align_file_position (off, 1 << bed->s->log_file_align);
+  off = BFD_ALIGN (off, 1u << bed->s->log_file_align);
   i_ehdrp->e_shoff = off;
   off += i_ehdrp->e_shnum * i_ehdrp->e_shentsize;
   elf_next_file_pos (abfd) = off;


More information about the Binutils-cvs mailing list