From c0bbc2216e32510a36197d032029e27a357b3b14 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Sat, 30 Dec 2000 13:11:14 +0000 Subject: [PATCH] Always call buildLoader() directly after compress(). committer: mfx 978181874 +0000 --- src/p_djgpp2.cpp | 2 +- src/p_tmt.cpp | 2 +- src/p_w32pe.cpp | 3 ++- src/p_wcle.cpp | 11 ++++++----- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/p_djgpp2.cpp b/src/p_djgpp2.cpp index 4ed94d7b..1896b7ae 100644 --- a/src/p_djgpp2.cpp +++ b/src/p_djgpp2.cpp @@ -271,7 +271,6 @@ void PackDjgpp2::pack(OutputFile *fo) // filter Filter ft(opt->level); tryFilters(&ft, ibuf, usize - data->size, text->vaddr & ~0x1ff); - buildLoader(&ft); // compress ph.filter = ft.id; @@ -279,6 +278,7 @@ void PackDjgpp2::pack(OutputFile *fo) ph.u_len = usize; if (!compress(ibuf,obuf)) throwNotCompressible(); + buildLoader(&ft); unsigned overlapoh = findOverlapOverhead(obuf,ibuf,512); overlapoh = (overlapoh + 0x3ff) & ~0x1ff; diff --git a/src/p_tmt.cpp b/src/p_tmt.cpp index 65463115..175410d3 100644 --- a/src/p_tmt.cpp +++ b/src/p_tmt.cpp @@ -212,13 +212,13 @@ void PackTmt::pack(OutputFile *fo) // filter Filter ft(opt->level); tryFilters(&ft, ibuf, usize); - buildLoader(&ft); ph.filter = ft.id; ph.filter_cto = ft.cto; ph.u_len = usize + relocsize; if (!compress(ibuf,obuf)) throwNotCompressible(); + buildLoader(&ft); unsigned overlapoh = findOverlapOverhead(obuf,512); diff --git a/src/p_w32pe.cpp b/src/p_w32pe.cpp index ab31e1eb..640b1ce5 100644 --- a/src/p_w32pe.cpp +++ b/src/p_w32pe.cpp @@ -1619,13 +1619,14 @@ void PackW32Pe::pack(OutputFile *fo) Filter ft(opt->level); if (allow_filter) tryFilters(&ft, ibuf + ih.codebase, ih.codesize); - buildLoader(&ft); // compress ph.filter = ft.id; ph.filter_cto = ft.cto; if (!compress(ibuf + rvamin,obuf)) throwNotCompressible(); + buildLoader(&ft); + const unsigned overlapoh = findOverlapOverhead(obuf, 2048); // verify filter diff --git a/src/p_wcle.cpp b/src/p_wcle.cpp index 4bfbf828..19f41cba 100644 --- a/src/p_wcle.cpp +++ b/src/p_wcle.cpp @@ -421,6 +421,8 @@ void PackWcle::encodeImage(const Filter *ft) // reserve RESERVED bytes for the decompressor if (!compress(ibuf,oimage+RESERVED)) throwNotCompressible(); + buildLoader(ft); + overlapoh = findOverlapOverhead(oimage+RESERVED, 512); ibuf.free(); soimage = (ph.c_len + 3) &~ 3; @@ -463,11 +465,6 @@ void PackWcle::pack(OutputFile *fo) const unsigned text_size = IOT(ih.init_cs_object-1,npages) * mps; const unsigned text_vaddr = IOT(ih.init_cs_object-1,my_base_address); - // filter - Filter ft(opt->level); - tryFilters(&ft, iimage+text_vaddr, text_size, text_vaddr); - buildLoader(&ft); - // attach some useful data at the end of preprocessed fixups ifixups[sofixups++] = (unsigned char) ih.automatic_data_object; unsigned ic = objects*sizeof(*iobject_table); @@ -481,6 +478,10 @@ void PackWcle::pack(OutputFile *fo) ifixups[sofixups+12] = (unsigned char) objects; sofixups += 13; + // filter + Filter ft(opt->level); + tryFilters(&ft, iimage+text_vaddr, text_size, text_vaddr); + encodeImage(&ft); // verify filter