From e1d20fd0b528df8b1b5e2d5d91b96f3c7066b63c Mon Sep 17 00:00:00 2001 From: John Reiser Date: Mon, 22 Jan 2018 13:48:26 -0800 Subject: [PATCH] Fix wobble in PackLinuxElf64::pack2 modified: p_lx_elf.cpp --- src/p_lx_elf.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 6189f1dd..f1e50e08 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -3296,10 +3296,10 @@ int PackLinuxElf64::pack2(OutputFile *fo, Filter &ft) uip->ui_total_passes -= !!is_shlib; // not .data of shlib // compress extents - unsigned hdr_u_len = xct_off; + unsigned hdr_u_len = (is_shlib ? xct_off : (sizeof(Elf64_Ehdr) + sz_phdrs)); - unsigned total_in = 0; - unsigned total_out = sz_elf_hdrs; + unsigned total_in = (is_shlib ? 0 : xct_off); + unsigned total_out = (is_shlib ? sz_elf_hdrs : xct_off); uip->ui_pass = 0; ft.addvalue = 0; @@ -3313,7 +3313,7 @@ int PackLinuxElf64::pack2(OutputFile *fo, Filter &ft) x.offset = get_te64(&phdri[k].p_offset); x.size = get_te64(&phdri[k].p_filesz); if (0 == nx) { // 1st PT_LOAD64 must cover Ehdr at 0==p_offset - unsigned const delta = xct_off; + unsigned const delta = hdr_u_len; if (ft.id < 0x40) { // FIXME: ?? ft.addvalue += asl_delta; }