From 14d303d3313dccd3646b521f59143f57d1d8189a Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Thu, 8 Sep 2005 13:01:24 +0000 Subject: [PATCH] Small updates according to latest glibc headers. committer: mfx 1126184484 +0000 --- src/stub/l_lx_elf.c | 2 +- src/stub/l_lx_pti.c | 2 +- src/stub/linux.hh | 29 ++++++++++++++++++----------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/stub/l_lx_elf.c b/src/stub/l_lx_elf.c index 8d096ee5..0904535f 100644 --- a/src/stub/l_lx_elf.c +++ b/src/stub/l_lx_elf.c @@ -224,7 +224,7 @@ upx_bzero(char *p, size_t len) static void __attribute__((regparm(3), stdcall)) -auxv_up(Elf32_auxv_t *av, int const type, unsigned const value) +auxv_up(Elf32_auxv_t *av, unsigned const type, unsigned const value) { if (av && 0==(1&(int)av)) /* PT_INTERP usually inhibits, except for hatch */ for (;; ++av) { diff --git a/src/stub/l_lx_pti.c b/src/stub/l_lx_pti.c index e1654365..d0296222 100644 --- a/src/stub/l_lx_pti.c +++ b/src/stub/l_lx_pti.c @@ -219,7 +219,7 @@ upx_bzero(char *p, size_t len) static void __attribute__((regparm(3), stdcall)) -auxv_up(Elf32_auxv_t *av, int const type, unsigned const value) +auxv_up(Elf32_auxv_t *av, unsigned const type, unsigned const value) { if (av && 0==(1&(int)av)) /* PT_INTERP usually inhibits, except for hatch */ for (;; ++av) { diff --git a/src/stub/linux.hh b/src/stub/linux.hh index 4e96e607..b981881a 100644 --- a/src/stub/linux.hh +++ b/src/stub/linux.hh @@ -43,7 +43,10 @@ typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned uint32_t; -#if defined(_WIN32) && !defined(__GNUC__) +#if defined(__GNUC__) +__extension__ typedef long long int64_t; +__extension__ typedef unsigned long long uint64_t; +#elif defined(_WIN32) typedef __int64 int64_t; typedef unsigned __int64 uint64_t; #else @@ -73,12 +76,15 @@ struct timespec { // misc constants +#if defined(__amd64__) || defined(__powerpc64__) +#elif defined(__i386__) || defined(__powerpc__) +#define PAGE_MASK (~0ul<<12) // discards the offset, keeps the page +#define PAGE_SIZE ( 1ul<<12) +#endif + #define SEEK_SET 0 #define SEEK_CUR 1 -#define PAGE_MASK (~0u<<12) // discards the offset, keeps the page -#define PAGE_SIZE ( 1u<<12) - #define O_RDONLY 00 #define O_WRONLY 01 #define O_RDWR 02 @@ -94,12 +100,10 @@ struct timespec { #define F_SETFD 2 #define FD_CLOEXEC 1 - // #define ENOENT 2 #define EINTR 4 - // #define PROT_READ 0x1 #define PROT_WRITE 0x2 @@ -112,7 +116,8 @@ struct timespec { #define MAP_ANONYMOUS 0x20 -#ifdef __i386__ /*{*/ +#if defined(__i386__) /*{*/ + // #define __NR_exit 1 #define __NR_fork 2 @@ -328,6 +333,7 @@ static inline _syscall1(int,unlink,const char *,file) #undef Z1 #else /*}{ generic */ + extern void *brk(void *); extern int close(int); extern void *mmap(void *, size_t, int, int, int, off_t); @@ -335,7 +341,10 @@ extern int munmap(void *, size_t); extern int mprotect(void const *, size_t, int); extern int open(char const *, unsigned, unsigned); extern size_t read(int, void *, size_t); + #endif /*}*/ + + /************************************************************************* // **************************************************************************/ @@ -394,11 +403,9 @@ typedef struct typedef struct { - int a_type; + uint32_t a_type; union { - long a_val; - void *a_ptr; - void (*a_fcn) (void); + uint32_t a_val; } a_un; } Elf32_auxv_t;