aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-10-29 13:13:17 +1030
committerAlan Modra <amodra@gmail.com>2021-10-29 15:48:22 +1030
commitc82ebeb7e6e060dacbaef02933b5f06c10f574f6 (patch)
treea67b4eb7ba6e1fabe0a7d89390144a26773952d3 /bfd/elf.c
parent208eb58158c2f23a7fbaff32a4912dbbb8d0ee5c (diff)
downloadgdb-c82ebeb7e6e060dacbaef02933b5f06c10f574f6.zip
gdb-c82ebeb7e6e060dacbaef02933b5f06c10f574f6.tar.gz
gdb-c82ebeb7e6e060dacbaef02933b5f06c10f574f6.tar.bz2
obcopy vs. files with silly section alignment
We already ignore stupid segment alignment when rewriting headers, ignore section alignment too. * elf.c (rewrite_elf_program_header): Ignore section alignment power greater than 62.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index cd8280e..4df144b 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6953,9 +6953,14 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd, bfd_vma maxpagesize)
&& !(SEGMENT_AFTER_SEGMENT (seg1, seg2, p_paddr) \
|| SEGMENT_AFTER_SEGMENT (seg2, seg1, p_paddr)))
- /* Initialise the segment mark field. */
+ /* Initialise the segment mark field, and discard stupid alignment. */
for (section = ibfd->sections; section != NULL; section = section->next)
- section->segment_mark = false;
+ {
+ asection *o = section->output_section;
+ if (o != NULL && o->alignment_power >= (sizeof (bfd_vma) * 8) - 1)
+ o->alignment_power = 0;
+ section->segment_mark = false;
+ }
/* The Solaris linker creates program headers in which all the
p_paddr fields are zero. When we try to objcopy or strip such a