aboutsummaryrefslogtreecommitdiff
path: root/bfd/opncls.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-02-22 17:28:33 +0000
committerNick Clifton <nickc@redhat.com>2017-02-22 17:28:33 +0000
commit758d96d834ba725461abf4be36df9f13e0815054 (patch)
treef32e8313541644f88c48e74995eba6ef1a4d23c1 /bfd/opncls.c
parent25890fc2395cf91526d3d2ba29578ac750e1b006 (diff)
downloadgdb-758d96d834ba725461abf4be36df9f13e0815054.zip
gdb-758d96d834ba725461abf4be36df9f13e0815054.tar.gz
gdb-758d96d834ba725461abf4be36df9f13e0815054.tar.bz2
Align .gnu_debuglink sections on a 4-byte boundary.
PR binutils/21193 * opncls.c (bfd_create_gnu_debuglink_section): Give the newly created section 4-byte alignment.
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r--bfd/opncls.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 2ab7dfe..4137a3b 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -1645,6 +1645,8 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
if (sect == NULL)
return NULL;
+ /* Compute the size of the section. Allow for the CRC after the filename,
+ and padding so that it will start on a 4-byte boundary. */
debuglink_size = strlen (filename) + 1;
debuglink_size += 3;
debuglink_size &= ~3;
@@ -1654,6 +1656,11 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
/* XXX Should we delete the section from the bfd ? */
return NULL;
+ /* PR 21193: Ensure that the section has 4-byte alignment for the CRC.
+ Note - despite the name of the function being called, we are
+ setting an alignment power, not a byte alignment value. */
+ bfd_set_section_alignment (abfd, sect, 2);
+
return sect;
}