1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Fixes for gcc 3.4 20040118.

committer: mfx <mfx> 1074619023 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2004-01-20 17:17:03 +00:00
parent 2d1de8b9e9
commit f4022af48a
3 changed files with 9 additions and 7 deletions

View File

@ -95,10 +95,11 @@ ifeq (1,2)
CC_LINUX_I386 += -malign-functions=0 -malign-jumps=0 -malign-loops=0 CC_LINUX_I386 += -malign-functions=0 -malign-jumps=0 -malign-loops=0
CC_LINUX_I386 += -Werror CC_LINUX_I386 += -Werror
else else
# gcc 3.4 (fold_*.bin: 1549 / 1043 / 1331) # gcc 3.4 20040118 (fold_*.bin: 1552 / 1043 / 1320)
# info: -mcpu=k6 procduces the smallest code # info: -mcpu=k6 procduces the smallest code
CC_LINUX_I386 = gcc-3.4 -march=i386 -mtune=k6 -Os -fno-omit-frame-pointer -fno-exceptions CC_LINUX_I386 = gcc-3.4 -march=i386 -mtune=k6 -Os -fno-omit-frame-pointer -fno-exceptions
CC_LINUX_I386 += -fno-align-functions -fno-align-jumps -fno-align-labels -fno-align-loops CC_LINUX_I386 += -fno-align-functions -fno-align-jumps -fno-align-labels -fno-align-loops
CC_LINUX_I386 += -fweb
CC_LINUX_I386 += -Werror CC_LINUX_I386 += -Werror
endif endif
endif endif

View File

@ -179,8 +179,8 @@ ERR_LAB
void * void *
make_hatch(Elf32_Phdr const *const phdr) make_hatch(Elf32_Phdr const *const phdr)
{ {
unsigned *hatch = 0;
if (phdr->p_type==PT_LOAD && phdr->p_flags & PF_X) { if (phdr->p_type==PT_LOAD && phdr->p_flags & PF_X) {
unsigned *hatch;
// The format of the 'if' is // The format of the 'if' is
// if ( ( (hatch = loc1), test_loc1 ) // if ( ( (hatch = loc1), test_loc1 )
// || ( (hatch = loc2), test_loc2 ) ) { // || ( (hatch = loc2), test_loc2 ) ) {
@ -199,23 +199,23 @@ make_hatch(Elf32_Phdr const *const phdr)
// Omitting 'const' saves repeated literal in gcc. // Omitting 'const' saves repeated literal in gcc.
unsigned /*const*/ escape = 0xc36180cd; // "int $0x80; popa; ret" unsigned /*const*/ escape = 0xc36180cd; // "int $0x80; popa; ret"
// Don't store into read-only page if value is already there. // Don't store into read-only page if value is already there.
if (*hatch != escape) { if (* (volatile unsigned*) hatch != escape) {
*hatch = escape; * hatch = escape;
} }
return hatch;
} }
} }
return 0; return hatch;
} }
static void static void
__attribute__ ((regparm(2), stdcall)) __attribute__ ((regparm(2), stdcall))
bzero(char *p, size_t len) upx_bzero(char *p, size_t len)
{ {
if (len) do { if (len) do {
*p++= 0; *p++= 0;
} while (--len); } while (--len);
} }
#define bzero upx_bzero
static void static void

View File

@ -275,6 +275,7 @@ type name(type1 arg1,type2 arg2,type3 arg3) \
} }
#define access syscall_access #define access syscall_access
#define _exit syscall_exit
#define fcntl syscall_fcntl #define fcntl syscall_fcntl
#define getcwd syscall_getcwd #define getcwd syscall_getcwd
#define getrusage syscall_getrusage #define getrusage syscall_getrusage