From f4022af48a4a7b67e8406f8832d3c71070bdebf4 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Tue, 20 Jan 2004 17:17:03 +0000 Subject: [PATCH] Fixes for gcc 3.4 20040118. committer: mfx 1074619023 +0000 --- src/stub/Makefile | 3 ++- src/stub/l_lx_elf.c | 12 ++++++------ src/stub/linux.hh | 1 + 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/stub/Makefile b/src/stub/Makefile index 70fcf5c5..29d3946e 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -95,10 +95,11 @@ ifeq (1,2) CC_LINUX_I386 += -malign-functions=0 -malign-jumps=0 -malign-loops=0 CC_LINUX_I386 += -Werror 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 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 += -fweb CC_LINUX_I386 += -Werror endif endif diff --git a/src/stub/l_lx_elf.c b/src/stub/l_lx_elf.c index 7c66e716..4a0bd64e 100644 --- a/src/stub/l_lx_elf.c +++ b/src/stub/l_lx_elf.c @@ -179,8 +179,8 @@ ERR_LAB void * make_hatch(Elf32_Phdr const *const phdr) { + unsigned *hatch = 0; if (phdr->p_type==PT_LOAD && phdr->p_flags & PF_X) { - unsigned *hatch; // The format of the 'if' is // if ( ( (hatch = loc1), test_loc1 ) // || ( (hatch = loc2), test_loc2 ) ) { @@ -199,23 +199,23 @@ make_hatch(Elf32_Phdr const *const phdr) // Omitting 'const' saves repeated literal in gcc. unsigned /*const*/ escape = 0xc36180cd; // "int $0x80; popa; ret" // Don't store into read-only page if value is already there. - if (*hatch != escape) { - *hatch = escape; + if (* (volatile unsigned*) hatch != escape) { + * hatch = escape; } - return hatch; } } - return 0; + return hatch; } static void __attribute__ ((regparm(2), stdcall)) -bzero(char *p, size_t len) +upx_bzero(char *p, size_t len) { if (len) do { *p++= 0; } while (--len); } +#define bzero upx_bzero static void diff --git a/src/stub/linux.hh b/src/stub/linux.hh index cf88c729..8085898c 100644 --- a/src/stub/linux.hh +++ b/src/stub/linux.hh @@ -275,6 +275,7 @@ type name(type1 arg1,type2 arg2,type3 arg3) \ } #define access syscall_access +#define _exit syscall_exit #define fcntl syscall_fcntl #define getcwd syscall_getcwd #define getrusage syscall_getrusage