aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2013-11-13 12:54:29 +0000
committerNick Clifton <nickc@redhat.com>2013-11-13 12:54:29 +0000
commite2729ebe257b26c62a0a3c6f5432185df78cffb3 (patch)
tree3e78bfd98ef3e7adb0c1342caf856f372715f371
parentc42bd95ac2827f22c134f13752c44ecc69d153f7 (diff)
downloadgdb-e2729ebe257b26c62a0a3c6f5432185df78cffb3.zip
gdb-e2729ebe257b26c62a0a3c6f5432185df78cffb3.tar.gz
gdb-e2729ebe257b26c62a0a3c6f5432185df78cffb3.tar.bz2
* rescoff.c (write_coff_file): Use 64-bit alignment for resource
data. (coff_res_to_bin): Likewise.
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/rescoff.c25
2 files changed, 18 insertions, 13 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 237debe..cc9c6f9 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2013-11-13 Martin Mitas <mity@morous.org>
+
+ * rescoff.c (write_coff_file): Use 64-bit alignment for resource
+ data.
+ (coff_res_to_bin): Likewise.
+
2013-11-07 Doug Evans <dje@google.com>
Add pretty-printing of .debug_gnu_pubnames, .debug_gnu_pubtypes.
diff --git a/binutils/rescoff.c b/binutils/rescoff.c
index 8799ea2..c594719 100644
--- a/binutils/rescoff.c
+++ b/binutils/rescoff.c
@@ -1,6 +1,5 @@
/* rescoff.c -- read and write resources in Windows COFF files.
- Copyright 1997, 1998, 1999, 2000, 2003, 2005, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright 1997-2013 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
Rewritten by Kai Tietz, Onevision.
@@ -501,22 +500,22 @@ write_coff_file (const char *filename, const char *target,
know the various offsets we will need. */
coff_bin_sizes (resources, &cwi);
- /* Force the directory strings to be 32 bit aligned. Every other
- structure is 32 bit aligned anyhow. */
- cwi.dirstrsize = (cwi.dirstrsize + 3) &~ 3;
+ /* Force the directory strings to be 64 bit aligned. Every other
+ structure is 64 bit aligned anyhow. */
+ cwi.dirstrsize = (cwi.dirstrsize + 7) & ~7;
/* Actually convert the resources to binary. */
coff_to_bin (resources, &cwi);
- /* Add another 2 bytes to the directory strings if needed for
+ /* Add another few bytes to the directory strings if needed for
alignment. */
- if ((cwi.dirstrs.length & 3) != 0)
+ if ((cwi.dirstrs.length & 7) != 0)
{
+ rc_uint_type pad = 8 - (cwi.dirstrs.length & 7);
bfd_byte *ex;
- ex = coff_alloc (&cwi.dirstrs, 2);
- ex[0] = 0;
- ex[1] = 0;
+ ex = coff_alloc (& cwi.dirstrs, pad);
+ memset (ex, 0, pad);
}
/* Make sure that the data we built came out to the same size as we
@@ -741,10 +740,10 @@ coff_res_to_bin (const rc_res_resource *res, struct coff_write_info *cwi)
cwi->resources.last->next = d;
cwi->resources.last = d;
- cwi->resources.length += (d->length + 3) & ~3;
+ cwi->resources.length += (d->length + 7) & ~7;
windres_put_32 (cwi->wrbfd, erd->size, d->length);
- /* Force the next resource to have 32 bit alignment. */
- d->length = (d->length + 3) & ~3;
+ /* Force the next resource to have 64 bit alignment. */
+ d->length = (d->length + 7) & ~7;
}