From d5e0e664264a480868010ce6626425fed6bf1180 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Sun, 9 Jul 2006 16:59:41 -0700 Subject: [PATCH] PackLinuxElf32x86::newLinker() --- src/p_lx_elf.cpp | 9 ++++++++- src/p_lx_elf.h | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 628f6e1c..7ba649ce 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -468,7 +468,9 @@ PackLinuxElf32x86::buildLinuxLoader( // PackHeader and overlay_offset at the end of the output file, // after the compressed data. - return getLoaderSize(); + unsigned const lsize = getLoaderSize(); + linker->relocate(); + return lsize; } int @@ -2013,6 +2015,11 @@ PackLinuxElf32x86::~PackLinuxElf32x86() { } +Linker* PackLinuxElf32x86::newLinker() const +{ + return new ElfLinkerX86; +} + PackBSDElf32x86::PackBSDElf32x86(InputFile *f) : super(f) { e_machine = Elf32_Ehdr::EM_386; diff --git a/src/p_lx_elf.h b/src/p_lx_elf.h index 64113427..8e0a890e 100644 --- a/src/p_lx_elf.h +++ b/src/p_lx_elf.h @@ -41,7 +41,6 @@ public: PackLinuxElf(InputFile *f); virtual ~PackLinuxElf(); /*virtual int buildLoader(const Filter *);*/ - virtual Linker* newLinker() const; virtual bool canUnpackVersion(int version) const { return (version >= 11); } protected: @@ -55,6 +54,7 @@ protected: //virtual void pack3(OutputFile *, Filter &) = 0; // append loader virtual void pack4(OutputFile *, Filter &) = 0; // append pack header + virtual Linker* newLinker() const; virtual void generateElfHdr( OutputFile *, void const *proto, @@ -287,8 +287,8 @@ protected: virtual void pack3(OutputFile *, Filter &); // append loader virtual const int *getCompressionMethods(int method, int level) const; virtual int buildLoader(const Filter *); - virtual void addStubEntrySections(upx_byte const *, unsigned); virtual Linker* newLinker() const; + virtual void addStubEntrySections(upx_byte const *, unsigned); }; /************************************************************************* @@ -330,6 +330,7 @@ protected: virtual void pack1(OutputFile *, Filter &); // generate executable header virtual int buildLoader(const Filter *); + virtual Linker* newLinker() const; virtual int buildLinuxLoader( upx_byte const *const proto, // assembly-only sections unsigned const szproto,