summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-08-22 14:05:00 -0500
committerAaron Durbin <adurbin@google.com>2014-08-22 21:30:09 +0200
commitbc349b81e97350b13d7d70c400e46d0bb8e4d1aa (patch)
treef50642b7717348760864950654d6edf0ee083742
parentf99a62b65e0b2571a815f987144dc9c5db606444 (diff)
downloadcoreboot-bc349b81e97350b13d7d70c400e46d0bb8e4d1aa.tar.xz
elfheaders: fix 64-bit ELF writing
The sh_flags for a 64-bit section header entry are 64-bit in size. Correct this. Change-Id: I2fa79d9a0fb46cc1dfa97c172357bbd2394843e0 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/6737 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh <furquan@google.com>
-rw-r--r--util/cbfstool/elfheaders.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/cbfstool/elfheaders.c b/util/cbfstool/elfheaders.c
index 71d34a9df5..fdd1599199 100644
--- a/util/cbfstool/elfheaders.c
+++ b/util/cbfstool/elfheaders.c
@@ -781,8 +781,8 @@ static void shdr_write(struct elf_writer *ew, size_t n, struct buffer *m)
xdr->put32(m, shdr->sh_name);
xdr->put32(m, shdr->sh_type);
- xdr->put32(m, shdr->sh_flags);
if (bit64) {
+ xdr->put64(m, shdr->sh_flags);
xdr->put64(m, shdr->sh_addr);
xdr->put64(m, shdr->sh_offset);
xdr->put64(m, shdr->sh_size);
@@ -791,6 +791,7 @@ static void shdr_write(struct elf_writer *ew, size_t n, struct buffer *m)
xdr->put64(m, shdr->sh_addralign);
xdr->put64(m, shdr->sh_entsize);
} else {
+ xdr->put32(m, shdr->sh_flags);
xdr->put32(m, shdr->sh_addr);
xdr->put32(m, shdr->sh_offset);
xdr->put32(m, shdr->sh_size);