clang-10 requires the use of 'override'

Discovered during gitlab auto-build for https://github.com/upx/upx/issues/595
	modified:   Makefile
	modified:   p_armpe.h
	modified:   p_djgpp2.h
	modified:   p_lx_elf.h
	modified:   p_lx_exc.h
	modified:   p_lx_interp.h
	modified:   p_lx_sh.h
	modified:   p_mach.h
	modified:   p_ps1.h
	modified:   p_tmt.h
	modified:   p_unix.h
	modified:   p_vmlinx.h
	modified:   p_vmlinz.h
	modified:   p_w32pe.h
	modified:   p_w64pep.h
	modified:   pefile.h
This commit is contained in:
John Reiser
2022-09-26 16:31:49 -07:00
committed by Markus F.X.J. Oberhumer
parent 2cfa4c1eb7
commit ec33109b22
12 changed files with 456 additions and 453 deletions
+118 -118
View File
@@ -742,14 +742,14 @@ public:
unsigned t_flavor, unsigned ts_word_cnt, unsigned tc_size,
unsigned page_shift);
virtual ~PackMachBase();
virtual int getVersion() const { return 13; }
virtual const int *getCompressionMethods(int method, int level) const;
virtual int getVersion() const override { return 13; }
virtual const int *getCompressionMethods(int method, int level) const override;
// called by the generic pack()
virtual void pack1(OutputFile *, Filter &); // generate executable header
virtual int pack2(OutputFile *, Filter &); // append compressed data
virtual off_t pack3(OutputFile *, Filter &) /*= 0*/; // append loader
virtual void pack4(OutputFile *, Filter &) /*= 0*/; // append PackHeader
virtual void pack1(OutputFile *, Filter &) override; // generate executable header
virtual int pack2(OutputFile *, Filter &) override; // append compressed data
virtual off_t pack3(OutputFile *, Filter &) override /*= 0*/; // append loader
virtual void pack4(OutputFile *, Filter &) override /*= 0*/; // append PackHeader
virtual void pack4dylib(OutputFile *, Filter &, Addr init_address);
@@ -758,18 +758,18 @@ public:
virtual void threado_rewrite(OutputFile *) = 0;
virtual void threado_write(OutputFile *) = 0;
virtual void pack1_setup_threado(OutputFile *const fo) = 0;
virtual void unpack(OutputFile *fo);
virtual void unpack(OutputFile *fo) override;
virtual bool canPack();
virtual int canUnpack();
virtual bool canPack() override;
virtual int canUnpack() override;
virtual upx_uint64_t get_mod_init_func(Mach_segment_command const *segptr);
virtual unsigned find_SEGMENT_gap(unsigned const k, unsigned pos_eof);
protected:
virtual void patchLoader();
virtual void patchLoaderChecksum();
virtual void updateLoader(OutputFile *);
virtual void buildLoader(const Filter *ft);
virtual void patchLoader() override;
virtual void patchLoaderChecksum() override;
virtual void updateLoader(OutputFile *) override;
virtual void buildLoader(const Filter *ft) override;
virtual void buildMachLoader(
upx_byte const *const proto,
unsigned const szproto,
@@ -871,16 +871,16 @@ class PackMachPPC32 : public PackMachBase<MachClass_BE32>
public:
PackMachPPC32(InputFile *f);
virtual int getFormat() const { return UPX_F_MACH_PPC32; }
virtual const char *getName() const { return "macho/ppc32"; }
virtual const char *getFullName(const options_t *) const { return "powerpc-darwin.macho"; }
virtual int getFormat() const override { return UPX_F_MACH_PPC32; }
virtual const char *getName() const override { return "macho/ppc32"; }
virtual const char *getFullName(const options_t *) const override { return "powerpc-darwin.macho"; }
protected:
virtual const int *getFilters() const;
virtual const int *getFilters() const override;
virtual void pack1_setup_threado(OutputFile *const fo);
virtual Linker* newLinker() const;
virtual void addStubEntrySections(Filter const *);
virtual void pack1_setup_threado(OutputFile *const fo) override;
virtual Linker* newLinker() const override;
virtual void addStubEntrySections(Filter const *) override;
__packed_struct(Mach_thread_command)
TE32 cmd; /* LC_THREAD or LC_UNIXTHREAD */
@@ -893,8 +893,8 @@ protected:
__packed_struct_end()
Mach_thread_command threado;
int threado_size() const { return sizeof(threado); }
void threado_setPC(upx_uint64_t pc) {
int threado_size() const override { return sizeof(threado); }
void threado_setPC(upx_uint64_t pc) override {
memset(&threado, 0, sizeof(threado));
threado.cmd = Mach_segment_command::LC_UNIXTHREAD;
threado.cmdsize = sizeof(threado);
@@ -902,10 +902,10 @@ protected:
threado.count = my_thread_state_word_count;
threado.state.srr0 = pc;
}
void threado_rewrite(OutputFile *fo) { fo->rewrite(&threado, sizeof(threado)); }
void threado_write(OutputFile *fo) { fo->write(&threado, sizeof(threado)); }
void threado_rewrite(OutputFile *fo) override { fo->rewrite(&threado, sizeof(threado)); }
void threado_write(OutputFile *fo) override { fo->write(&threado, sizeof(threado)); }
upx_uint64_t threadc_getPC(void const *ptr) {
upx_uint64_t threadc_getPC(void const *ptr) override {
Mach_thread_command const *tc = (Mach_thread_command const *)ptr;
if (tc->cmd!=Mach_segment_command::LC_UNIXTHREAD
|| tc->cmdsize!=sizeof(threado)
@@ -924,15 +924,15 @@ class PackMachPPC64 : public PackMachBase<MachClass_BE64>
public:
PackMachPPC64(InputFile *f);
virtual int getFormat() const { return UPX_F_MACH_PPC64; }
virtual const char *getName() const { return "macho/ppc64"; }
virtual const char *getFullName(const options_t *) const { return "powerpc64-darwin.macho"; }
virtual int getFormat() const override { return UPX_F_MACH_PPC64; }
virtual const char *getName() const override { return "macho/ppc64"; }
virtual const char *getFullName(const options_t *) const override { return "powerpc64-darwin.macho"; }
protected:
virtual const int *getFilters() const;
virtual const int *getFilters() const override;
virtual void pack1_setup_threado(OutputFile *const fo);
virtual Linker* newLinker() const;
virtual void pack1_setup_threado(OutputFile *const fo) override;
virtual Linker* newLinker() const override;
__packed_struct(Mach_thread_command)
BE32 cmd; /* LC_THREAD or LC_UNIXTHREAD */
@@ -945,8 +945,8 @@ protected:
__packed_struct_end()
Mach_thread_command threado;
int threado_size() const { return sizeof(threado); }
void threado_setPC(upx_uint64_t pc) {
int threado_size() const override { return sizeof(threado); }
void threado_setPC(upx_uint64_t pc) override {
memset(&threado, 0, sizeof(threado));
threado.cmd = Mach_segment_command::LC_UNIXTHREAD;
threado.cmdsize = sizeof(threado);
@@ -954,10 +954,10 @@ protected:
threado.count = my_thread_state_word_count;
threado.state64.srr0 = pc;
}
void threado_rewrite(OutputFile *fo) { fo->rewrite(&threado, sizeof(threado)); }
void threado_write(OutputFile *fo) { fo->write(&threado, sizeof(threado)); }
void threado_rewrite(OutputFile *fo) override { fo->rewrite(&threado, sizeof(threado)); }
void threado_write(OutputFile *fo) override { fo->write(&threado, sizeof(threado)); }
upx_uint64_t threadc_getPC(void const *ptr) {
upx_uint64_t threadc_getPC(void const *ptr) override{
Mach_thread_command const *tc = (Mach_thread_command const *)ptr;
if (tc->cmd!=Mach_segment_command::LC_UNIXTHREAD
|| tc->cmdsize!=sizeof(threado)
@@ -976,12 +976,12 @@ class PackDylibPPC32 : public PackMachPPC32
public:
PackDylibPPC32(InputFile *f);
virtual int getFormat() const { return UPX_F_DYLIB_PPC32; }
virtual const char *getName() const { return "dylib/ppc32"; }
virtual const char *getFullName(const options_t *) const { return "powerpc-darwin.dylib"; }
virtual int getFormat() const override { return UPX_F_DYLIB_PPC32; }
virtual const char *getName() const override { return "dylib/ppc32"; }
virtual const char *getFullName(const options_t *) const override { return "powerpc-darwin.dylib"; }
protected:
virtual off_t pack3(OutputFile *, Filter &); // append loader
virtual void pack4(OutputFile *, Filter &); // append PackHeader
virtual off_t pack3(OutputFile *, Filter &) override; // append loader
virtual void pack4(OutputFile *, Filter &) override; // append PackHeader
};
class PackDylibPPC64 : public PackMachPPC64
@@ -991,12 +991,12 @@ class PackDylibPPC64 : public PackMachPPC64
public:
PackDylibPPC64(InputFile *f);
virtual int getFormat() const { return UPX_F_DYLIB_PPC64; }
virtual const char *getName() const { return "dylib/ppc64"; }
virtual const char *getFullName(const options_t *) const { return "powerpc64-darwin.dylib"; }
virtual int getFormat() const override { return UPX_F_DYLIB_PPC64; }
virtual const char *getName() const override { return "dylib/ppc64"; }
virtual const char *getFullName(const options_t *) const override { return "powerpc64-darwin.dylib"; }
protected:
virtual off_t pack3(OutputFile *, Filter &); // append loader
virtual void pack4(OutputFile *, Filter &); // append PackHeader
virtual off_t pack3(OutputFile *, Filter &) override; // append loader
virtual void pack4(OutputFile *, Filter &) override; // append PackHeader
};
class PackMachI386 : public PackMachBase<MachClass_LE32>
@@ -1006,15 +1006,15 @@ class PackMachI386 : public PackMachBase<MachClass_LE32>
public:
PackMachI386(InputFile *f);
virtual int getFormat() const { return UPX_F_MACH_i386; }
virtual const char *getName() const { return "macho/i386"; }
virtual const char *getFullName(const options_t *) const { return "i386-darwin.macho"; }
virtual int getFormat() const override { return UPX_F_MACH_i386; }
virtual const char *getName() const override { return "macho/i386"; }
virtual const char *getFullName(const options_t *) const override { return "i386-darwin.macho"; }
protected:
virtual const int *getFilters() const;
virtual const int *getFilters() const override;
virtual void pack1_setup_threado(OutputFile *const fo);
virtual Linker* newLinker() const;
virtual void addStubEntrySections(Filter const *);
virtual void pack1_setup_threado(OutputFile *const fo) override;
virtual Linker* newLinker() const override;
virtual void addStubEntrySections(Filter const *) override;
__packed_struct(Mach_thread_command)
LE32 cmd; /* LC_THREAD or LC_UNIXTHREAD */
@@ -1027,8 +1027,8 @@ protected:
__packed_struct_end()
Mach_thread_command threado;
int threado_size() const { return sizeof(threado); }
void threado_setPC(upx_uint64_t pc) {
int threado_size() const override { return sizeof(threado); }
void threado_setPC(upx_uint64_t pc) override {
memset(&threado, 0, sizeof(threado));
threado.cmd = Mach_segment_command::LC_UNIXTHREAD;
threado.cmdsize = sizeof(threado);
@@ -1036,10 +1036,10 @@ protected:
threado.count = my_thread_state_word_count;
threado.state.eip = pc;
}
void threado_rewrite(OutputFile *fo) { fo->rewrite(&threado, sizeof(threado)); }
void threado_write(OutputFile *fo) { fo->write(&threado, sizeof(threado)); }
void threado_rewrite(OutputFile *fo) override { fo->rewrite(&threado, sizeof(threado)); }
void threado_write(OutputFile *fo) override { fo->write(&threado, sizeof(threado)); }
upx_uint64_t threadc_getPC(void const *ptr) {
upx_uint64_t threadc_getPC(void const *ptr) override{
Mach_thread_command const *tc = (Mach_thread_command const *)ptr;
if (tc->cmd!=Mach_segment_command::LC_UNIXTHREAD
|| tc->cmdsize!=sizeof(threado)
@@ -1058,12 +1058,12 @@ class PackDylibI386 : public PackMachI386
public:
PackDylibI386(InputFile *f);
virtual int getFormat() const { return UPX_F_DYLIB_i386; }
virtual const char *getName() const { return "dylib/i386"; }
virtual const char *getFullName(const options_t *) const { return "i386-darwin.dylib"; }
virtual int getFormat() const override { return UPX_F_DYLIB_i386; }
virtual const char *getName() const override { return "dylib/i386"; }
virtual const char *getFullName(const options_t *) const override { return "i386-darwin.dylib"; }
protected:
virtual off_t pack3(OutputFile *, Filter &); // append loader
virtual void pack4(OutputFile *, Filter &); // append PackHeader
virtual off_t pack3(OutputFile *, Filter &) override; // append loader
virtual void pack4(OutputFile *, Filter &) override; // append PackHeader
};
class PackMachAMD64 : public PackMachBase<MachClass_LE64>
@@ -1073,15 +1073,15 @@ class PackMachAMD64 : public PackMachBase<MachClass_LE64>
public:
PackMachAMD64(InputFile *f);
virtual int getFormat() const { return UPX_F_MACH_AMD64; }
virtual const char *getName() const { return "macho/amd64"; }
virtual const char *getFullName(const options_t *) const { return "amd64-darwin.macho"; }
virtual int getFormat() const override { return UPX_F_MACH_AMD64; }
virtual const char *getName() const override { return "macho/amd64"; }
virtual const char *getFullName(const options_t *) const override { return "amd64-darwin.macho"; }
protected:
virtual const int *getFilters() const;
virtual const int *getFilters() const override;
virtual void pack1_setup_threado(OutputFile *const fo);
virtual Linker* newLinker() const;
virtual void addStubEntrySections(Filter const *);
virtual void pack1_setup_threado(OutputFile *const fo) override;
virtual Linker* newLinker() const override;
virtual void addStubEntrySections(Filter const *) override;
__packed_struct(Mach_thread_command)
typedef MachITypes::Word Word;
@@ -1095,8 +1095,8 @@ protected:
__packed_struct_end()
Mach_thread_command threado;
int threado_size() const { return sizeof(threado); }
void threado_setPC(upx_uint64_t pc) {
int threado_size() const override { return sizeof(threado); }
void threado_setPC(upx_uint64_t pc) override {
memset(&threado, 0, sizeof(threado));
threado.cmd = Mach_segment_command::LC_UNIXTHREAD;
threado.cmdsize = sizeof(threado);
@@ -1104,10 +1104,10 @@ protected:
threado.count = my_thread_state_word_count;
threado.state.rip = pc;
}
void threado_rewrite(OutputFile *fo) { fo->rewrite(&threado, sizeof(threado)); }
void threado_write(OutputFile *fo) { fo->write(&threado, sizeof(threado)); }
void threado_rewrite(OutputFile *fo) override { fo->rewrite(&threado, sizeof(threado)); }
void threado_write(OutputFile *fo) override { fo->write(&threado, sizeof(threado)); }
upx_uint64_t threadc_getPC(void const *ptr) {
upx_uint64_t threadc_getPC(void const *ptr) override {
Mach_thread_command const *tc = (Mach_thread_command const *)ptr;
if (tc->cmd!=Mach_segment_command::LC_UNIXTHREAD
|| tc->cmdsize!=sizeof(threado)
@@ -1126,12 +1126,12 @@ class PackDylibAMD64 : public PackMachAMD64
public:
PackDylibAMD64(InputFile *f);
virtual int getFormat() const { return UPX_F_DYLIB_AMD64; }
virtual const char *getName() const { return "dylib/amd64"; }
virtual const char *getFullName(const options_t *) const { return "amd64-darwin.dylib"; }
virtual int getFormat() const override { return UPX_F_DYLIB_AMD64; }
virtual const char *getName() const override { return "dylib/amd64"; }
virtual const char *getFullName(const options_t *) const override { return "amd64-darwin.dylib"; }
protected:
virtual off_t pack3(OutputFile *, Filter &); // append loader
virtual void pack4(OutputFile *, Filter &); // append PackHeader
virtual off_t pack3(OutputFile *, Filter &) override; // append loader
virtual void pack4(OutputFile *, Filter &) override; // append PackHeader
};
class PackMachARMEL : public PackMachBase<MachClass_LE32>
@@ -1141,16 +1141,16 @@ class PackMachARMEL : public PackMachBase<MachClass_LE32>
public:
PackMachARMEL(InputFile *f);
virtual int getFormat() const { return UPX_F_MACH_ARMEL; }
virtual const char *getName() const { return "macho/arm"; }
virtual const char *getFullName(const options_t *) const { return "arm-darwin.macho"; }
virtual int getFormat() const override { return UPX_F_MACH_ARMEL; }
virtual const char *getName() const override { return "macho/arm"; }
virtual const char *getFullName(const options_t *) const override { return "arm-darwin.macho"; }
protected:
virtual const int *getCompressionMethods(int method, int level) const;
virtual const int *getFilters() const;
virtual const int *getCompressionMethods(int method, int level) const override;
virtual const int *getFilters() const override;
virtual void pack1_setup_threado(OutputFile *const fo);
virtual Linker* newLinker() const;
virtual void addStubEntrySections(Filter const *);
virtual void pack1_setup_threado(OutputFile *const fo) override;
virtual Linker* newLinker() const override;
virtual void addStubEntrySections(Filter const *) override;
__packed_struct(Mach_thread_command)
LE32 cmd; /* LC_THREAD or LC_UNIXTHREAD */
@@ -1163,8 +1163,8 @@ protected:
__packed_struct_end()
Mach_thread_command threado;
int threado_size() const { return sizeof(threado); }
void threado_setPC(upx_uint64_t pc) {
int threado_size() const override { return sizeof(threado); }
void threado_setPC(upx_uint64_t pc) override {
memset(&threado, 0, sizeof(threado));
threado.cmd = Mach_segment_command::LC_UNIXTHREAD;
threado.cmdsize = sizeof(threado);
@@ -1172,10 +1172,10 @@ protected:
threado.count = my_thread_state_word_count;
threado.state.pc = pc;
}
void threado_rewrite(OutputFile *fo) { fo->rewrite(&threado, sizeof(threado)); }
void threado_write(OutputFile *fo) { return fo->write(&threado, sizeof(threado)); }
void threado_rewrite(OutputFile *fo) override { fo->rewrite(&threado, sizeof(threado)); }
void threado_write(OutputFile *fo) override { return fo->write(&threado, sizeof(threado)); }
upx_uint64_t threadc_getPC(void const *ptr) {
upx_uint64_t threadc_getPC(void const *ptr) override {
Mach_thread_command const *tc = (Mach_thread_command const *)ptr;
if (tc->cmd!=Mach_segment_command::LC_UNIXTHREAD
|| tc->cmdsize!=sizeof(threado)
@@ -1194,15 +1194,15 @@ class PackMachARM64EL : public PackMachBase<MachClass_LE64>
public:
PackMachARM64EL(InputFile *f);
virtual int getFormat() const { return UPX_F_MACH_ARM64EL; }
virtual const char *getName() const { return "macho/arm64"; }
virtual const char *getFullName(const options_t *) const { return "arm64-darwin.macho"; }
virtual int getFormat() const override { return UPX_F_MACH_ARM64EL; }
virtual const char *getName() const override { return "macho/arm64"; }
virtual const char *getFullName(const options_t *) const override { return "arm64-darwin.macho"; }
protected:
virtual const int *getFilters() const;
virtual const int *getFilters() const override;
virtual void pack1_setup_threado(OutputFile *const fo);
virtual Linker* newLinker() const;
virtual void addStubEntrySections(Filter const *);
virtual void pack1_setup_threado(OutputFile *const fo) override;
virtual Linker* newLinker() const override;
virtual void addStubEntrySections(Filter const *) override;
__packed_struct(Mach_thread_command)
LE32 cmd; /* LC_THREAD or LC_UNIXTHREAD */
@@ -1215,8 +1215,8 @@ protected:
__packed_struct_end()
Mach_thread_command threado;
int threado_size() const { return sizeof(threado); }
void threado_setPC(upx_uint64_t pc) {
int threado_size() const override { return sizeof(threado); }
void threado_setPC(upx_uint64_t pc) override {
memset(&threado, 0, sizeof(threado));
threado.cmd = Mach_segment_command::LC_UNIXTHREAD;
threado.cmdsize = sizeof(threado);
@@ -1224,10 +1224,10 @@ protected:
threado.count = my_thread_state_word_count;
threado.state.pc = pc;
}
void threado_rewrite(OutputFile *fo) { fo->rewrite(&threado, sizeof(threado)); }
void threado_write(OutputFile *fo) { fo->write(&threado, sizeof(threado)); }
void threado_rewrite(OutputFile *fo) override { fo->rewrite(&threado, sizeof(threado)); }
void threado_write(OutputFile *fo) override { fo->write(&threado, sizeof(threado)); }
upx_uint64_t threadc_getPC(void const *ptr) {
upx_uint64_t threadc_getPC(void const *ptr) override {
Mach_thread_command const *tc = (Mach_thread_command const *)ptr;
if (tc->cmd!=Mach_segment_command::LC_UNIXTHREAD
|| tc->cmdsize!=sizeof(threado)
@@ -1246,28 +1246,28 @@ public:
PackMachFat(InputFile *f);
virtual ~PackMachFat();
virtual int getVersion() const { return 13; }
virtual int getFormat() const { return UPX_F_MACH_FAT; }
virtual const char *getName() const { return "macho/fat"; }
virtual const char *getFullName(const options_t *) const { return "fat-darwin.macho"; }
virtual const int *getCompressionMethods(int method, int level) const;
virtual const int *getFilters() const;
virtual int getVersion() const override { return 13; }
virtual int getFormat() const override { return UPX_F_MACH_FAT; }
virtual const char *getName() const override { return "macho/fat"; }
virtual const char *getFullName(const options_t *) const override { return "fat-darwin.macho"; }
virtual const int *getCompressionMethods(int method, int level) const override;
virtual const int *getFilters() const override;
protected:
// implementation
virtual unsigned check_fat_head(); // number of architectures
virtual void pack(OutputFile *fo);
virtual void unpack(OutputFile *fo);
virtual void list();
virtual void pack(OutputFile *fo) override;
virtual void unpack(OutputFile *fo) override;
virtual void list() override;
public:
virtual bool canPack();
virtual int canUnpack();
virtual bool canPack() override;
virtual int canUnpack() override;
protected:
// loader core
virtual void buildLoader(const Filter *ft);
virtual Linker* newLinker() const;
virtual void buildLoader(const Filter *ft) override;
virtual Linker* newLinker() const override;
enum { N_FAT_ARCH = 5 };
protected: