Commit 2d15cd07 authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Andrei Vagin

compel handle-elf.c: better align generated output

This is purely cosmetical, no functional change.

1. Make sure relocs table is well aligned.

2. printf("%#02x", 1) prints 0x01, but for 0 it prints 0,
   not 0x00 as one would expect, so output is somewhat ugly.
   Use "0x%02x" format instead to make it more uniform and
   well aligned.
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent bd22ff2a
......@@ -488,7 +488,7 @@ int __handle_elf(void *mem, size_t size)
case R_X86_64_32: /* Symbol + Addend (4 bytes) */
case R_X86_64_32S: /* Symbol + Addend (4 bytes) */
pr_debug("\t\t\t\tR_X86_64_32 at 0x%-4lx val 0x%x\n", place, value32);
pr_out(" { .offset = 0x%-8x, .type = COMPEL_TYPE_INT, "
pr_out(" { .offset = 0x%-8x, .type = COMPEL_TYPE_INT, "
".addend = %-8d, .value = 0x%-16x, }, /* R_X86_64_32 */\n",
(unsigned int)place, addend32, value32);
break;
......@@ -524,7 +524,7 @@ int __handle_elf(void *mem, size_t size)
#ifdef ELF_X86_32
case R_386_32: /* Symbol + Addend */
pr_debug("\t\t\t\tR_386_32 at 0x%-4lx val 0x%x\n", place, value32 + addend32);
pr_out(" { .offset = 0x%-8x, .type = COMPEL_TYPE_INT, "
pr_out(" { .offset = 0x%-8x, .type = COMPEL_TYPE_INT, "
".addend = %-4d, .value = 0x%x, },\n",
(unsigned int)place, addend32, value32);
break;
......@@ -573,7 +573,7 @@ int __handle_elf(void *mem, size_t size)
for (j = 0; j < sh->sh_size; j++, k++) {
if (k && (k % 8) == 0)
pr_out("\n\t");
pr_out("%#02x,", shdata[j]);
pr_out("0x%02x,", shdata[j]);
}
}
pr_out("};\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment