Renamed Linker::align() to alignCode(). We still have to add
some way to express alignData().
This commit is contained in:
parent
4ffde4db98
commit
6c519c237e
@ -317,7 +317,7 @@ int ElfLinker::addLoader(const char *sname)
|
||||
if (unsigned l = (hex(sect[2]) - tail->offset - tail->size)
|
||||
% hex(sect[1]))
|
||||
{
|
||||
align(l);
|
||||
alignCode(l);
|
||||
tail->size += l;
|
||||
outputlen += l;
|
||||
}
|
||||
@ -329,7 +329,7 @@ int ElfLinker::addLoader(const char *sname)
|
||||
unsigned const v = ~0u << section->align;
|
||||
assert(tail);
|
||||
if (unsigned const l = ~v & -(tail->offset + tail->size)) {
|
||||
align(l);
|
||||
alignCode(l);
|
||||
tail->size += l;
|
||||
outputlen += l;
|
||||
}
|
||||
@ -457,11 +457,6 @@ void ElfLinker::alignWithByte(unsigned len, upx_byte b)
|
||||
memset(output + outputlen, b, len);
|
||||
}
|
||||
|
||||
void ElfLinker::align(unsigned len)
|
||||
{
|
||||
alignWithByte(len, 0);
|
||||
}
|
||||
|
||||
void ElfLinker::relocate1(const Relocation *rel, upx_byte *,
|
||||
unsigned, const char *)
|
||||
{
|
||||
@ -472,6 +467,7 @@ void ElfLinker::relocate1(const Relocation *rel, upx_byte *,
|
||||
|
||||
/*************************************************************************
|
||||
// ElfLinker arch subclasses
|
||||
// FIXME: add more displacment overflow checks
|
||||
**************************************************************************/
|
||||
|
||||
void ElfLinkerAMD64::relocate1(const Relocation *rel, upx_byte *location,
|
||||
@ -490,7 +486,7 @@ void ElfLinkerAMD64::relocate1(const Relocation *rel, upx_byte *location,
|
||||
if (strcmp(type, "8") == 0)
|
||||
{
|
||||
int displ = (signed char) *location + (int) value;
|
||||
if (displ < -127 || displ > 128)
|
||||
if (displ < -128 || displ > 127)
|
||||
{
|
||||
printf("target out of range (%d) in reloc %s:%x\n",
|
||||
displ, rel->section->name, rel->offset);
|
||||
@ -645,7 +641,7 @@ void ElfLinkerX86::relocate1(const Relocation *rel, upx_byte *location,
|
||||
if (strcmp(type, "8") == 0)
|
||||
{
|
||||
int displ = (signed char) *location + (int) value;
|
||||
if (range_check && (displ < -127 || displ > 128)) {
|
||||
if (range_check && (displ < -128 || displ > 127)) {
|
||||
printf("target out of range (%d) in reloc %s:%x\n",
|
||||
displ, rel->section->name, rel->offset);
|
||||
abort();
|
||||
|
||||
@ -88,7 +88,9 @@ public:
|
||||
virtual unsigned getSymbolOffset(const char *) const;
|
||||
|
||||
void alignWithByte(unsigned len, upx_byte b);
|
||||
virtual void align(unsigned len);
|
||||
virtual void alignCode(unsigned len) { alignWithByte(len, 0); }
|
||||
virtual void alignData(unsigned len) { alignWithByte(len, 0); }
|
||||
|
||||
virtual void relocate1(const Relocation *, upx_byte *location,
|
||||
unsigned value, const char *type);
|
||||
};
|
||||
@ -141,7 +143,7 @@ class ElfLinkerAMD64 : public ElfLinker
|
||||
{
|
||||
typedef ElfLinker super;
|
||||
protected:
|
||||
virtual void align(unsigned len) { alignWithByte(len, 0x90); }
|
||||
virtual void alignCode(unsigned len) { alignWithByte(len, 0x90); }
|
||||
virtual void relocate1(const Relocation *, upx_byte *location,
|
||||
unsigned value, const char *type);
|
||||
};
|
||||
@ -187,7 +189,7 @@ class ElfLinkerX86 : public ElfLinker
|
||||
{
|
||||
typedef ElfLinker super;
|
||||
protected:
|
||||
virtual void align(unsigned len) { alignWithByte(len, 0x90); }
|
||||
virtual void alignCode(unsigned len) { alignWithByte(len, 0x90); }
|
||||
virtual void relocate1(const Relocation *, upx_byte *location,
|
||||
unsigned value, const char *type);
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user