aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2025-01-13 13:32:19 +0100
committerJan Beulich <jbeulich@suse.com>2025-01-13 13:32:19 +0100
commitd41df13ab36b224a622c0bdf28a96a0dee79db77 (patch)
tree6cd84e90dbff4fb3fd2f7d7de6b86d846f15b6dc
parent046a89fb4045d87934ce280fcf68d26322f3fdf1 (diff)
downloadbinutils-d41df13ab36b224a622c0bdf28a96a0dee79db77.zip
binutils-d41df13ab36b224a622c0bdf28a96a0dee79db77.tar.gz
binutils-d41df13ab36b224a622c0bdf28a96a0dee79db77.tar.bz2
bfd/ELF: slightly "better" file alignment for object files
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.
-rw-r--r--bfd/elf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 218d58d..4166847 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6805,8 +6805,12 @@ assign_file_positions_except_relocs (bfd *abfd,
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;