public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Binutils <binutils@sourceware.org>
Subject: [PATCH] bfd/ELF: slightly "better" file alignment for object files
Date: Tue, 7 Jan 2025 11:12:35 +0100	[thread overview]
Message-ID: <806f6674-62cd-4aeb-8210-cbe8a4a182e3@suse.com> (raw)

PR gas/32435

Commit 1f1b5e506bf0 ("bfd/ELF: restrict file alignment for object
files") caused an issue in the Linux kernels modpost utility, which was
building upon .rodata sections to be 4-byte aligned in the file when
they have 4-byte alignment. While we don't want to revert back to
original behavior, apply the same alignment "capping" as done originally
in two other places also for "ordinary" sections.

--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6811,8 +6811,12 @@ assign_file_positions_except_relocs (bfd
 	      hdr->sh_offset = -1;
 	    }
 	  else
+	    /* There shouldn't be a need to effect "capped" file alignment here,
+	       yet at least the Linux kernel's modpost utility was found to be
+	       unhappy without.  While the issue was addressed there, let's be
+	       kind for at least the foreseeable future ...  */
 	    off = _bfd_elf_assign_file_position_for_section (hdr, off, false,
-							     0);
+							     bed->s->log_file_align);
 	}
 
       elf_next_file_pos (abfd) = off;

                 reply	other threads:[~2025-01-07 10:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=806f6674-62cd-4aeb-8210-cbe8a4a182e3@suse.com \
    --to=jbeulich@suse.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).