diff options
author | Tuckker <tuckkern+sourceware@gmail.com> | 2020-08-28 13:27:16 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-08-28 13:27:16 +0100 |
commit | 1e597a89971e781f5c33d75009b2cbf26323d2a5 (patch) | |
tree | 3b4d05a4e1052100f338ed5ab4d2deaf083a4c16 /bfd/linker.c | |
parent | 626d23209fa3632561bb02ac11cb522bede91c1e (diff) | |
download | gdb-1e597a89971e781f5c33d75009b2cbf26323d2a5.zip gdb-1e597a89971e781f5c33d75009b2cbf26323d2a5.tar.gz gdb-1e597a89971e781f5c33d75009b2cbf26323d2a5.tar.bz2 |
Prevent the linker from overestimating the alignment requirement of common symbols on targets with octets that are larger than one byte.
PR 26543
* linker.c (bfd_generic_define_common_symbol): Force the alignment
to 1 if the section has now alignment requirement.
Diffstat (limited to 'bfd/linker.c')
-rw-r--r-- | bfd/linker.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/bfd/linker.c b/bfd/linker.c index d405746..1357168 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -3095,8 +3095,13 @@ bfd_generic_define_common_symbol (bfd *output_bfd, section = h->u.c.p->section; /* Increase the size of the section to align the common symbol. - The alignment must be a power of two. */ - alignment = bfd_octets_per_byte (output_bfd, section) << power_of_two; + The alignment must be a power of two. But if the section does + not have any alignment requirement then do not increase the + alignment unnecessarily. */ + if (power_of_two) + alignment = bfd_octets_per_byte (output_bfd, section) << power_of_two; + else + alignment = 1; BFD_ASSERT (alignment != 0 && (alignment & -alignment) == alignment); section->size += alignment - 1; section->size &= -alignment; |