UPSTREAM: elfheaders: fix 64-bit ELF writing

The sh_flags for a 64-bit section header entry are 64-bit in size. Correct
this.

BUG=chrome-os-partner:31615
BRANCH=None
TEST=Compiles successfully and the elf.rmod created is verified using readelf
and objdump

Change-Id: I3fd2c19116c375f7321ae83d70e8f20509c6f4c1
Author: Aaron Durbin <adurbin@chromium.org>
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/214323
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Commit-Queue: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Furquan Shaikh 2014-08-26 14:47:48 -07:00 committed by chrome-internal-fetch
commit cae87fb1ef

View file

@ -769,8 +769,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);
@ -779,6 +779,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);