summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-08-05 10:26:38 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-08-05 10:26:38 -0700
commitbb0215d7a6e2de0aa751487cd91538846f540728 (patch)
tree38ecf35280ab54b733d441aa9cdfabe7c0078ec9
parentd9a0f8532bcb46ba8061ca3517d256449cfbc6d9 (diff)
downloadsamples-bb0215d7a6e2de0aa751487cd91538846f540728.tar.gz
samples-bb0215d7a6e2de0aa751487cd91538846f540728.tar.xz
samples-bb0215d7a6e2de0aa751487cd91538846f540728.zip
elf2exe: use putle() when updating cs:ip for the relocator stub
CS:IP in the relocator stub are littleendian values, too. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--elf2exe/elf2exe.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/elf2exe/elf2exe.c b/elf2exe/elf2exe.c
index 7942361..ba0e5f8 100644
--- a/elf2exe/elf2exe.c
+++ b/elf2exe/elf2exe.c
@@ -467,12 +467,12 @@ static int process_file(const char *infile, const char *outfile)
- 1;
memcpy((char *)out->wr + where, rel32_code, rel32_size);
- hdr->ip = mzhdr->ip;
- hdr->cs = mzhdr->cs;
+ hdr->ip = mzhdr->ip; /* Already littleendian */
+ hdr->cs = mzhdr->cs; /* Already littleendian */
putle(&hdr->nrelocs, er[1].nrelocs);
- mzhdr->ip = 0;
- mzhdr->cs = (where - hdrsize) >> 4;
+ putle(&mzhdr->ip, 0);
+ putle(&mzhdr->cs, (where - hdrsize) >> 4);
}
/* Copy relocations */