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

Updated for current glibc.

committer: mfx <mfx> 1111664285 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2005-03-24 11:38:05 +00:00
parent b5413c0156
commit 96c998a1d7
3 changed files with 31 additions and 27 deletions

View File

@ -1,2 +1,4 @@
amd64-linux-sstrip
i386-linux-sstrip
sstrip sstrip
sstrip.exe sstrip.exe

View File

@ -2,22 +2,17 @@
SHELL = /bin/sh SHELL = /bin/sh
all: sstrip ##all: amd64-linux-sstrip
all: i386-linux-sstrip
sstrip: sstrip.c amd64-linux-sstrip: sstrip.c
gcc -O2 -g -Wall -W -o $@ $< gcc -m64 -O2 -g -Wall -W -o $@ $<
i386-linux-sstrip: sstrip.c
gcc -m32 -O2 -g -Wall -W -o $@ $<
mostlyclean: mostlyclean clean distclean maintainer-clean:
-rm -f *.d *.err *.i *.log *.map *~ gdb-trans* rm -f *.d *.o *.obj
rm -f sstrip amd64-linux-sstrip i386-linux-sstrip
clean distclean maintainer-clean: mostlyclean
-rm -f *.a *.lib *.o *.obj tags TAGS ID
-rm -rf .deps
rm -f sstrip
.PHONY: all mostlyclean clean distclean maintainer-clean .PHONY: all mostlyclean clean distclean maintainer-clean
.NOEXPORT:
# vi:nowrap

View File

@ -2,14 +2,21 @@
* General Public License. No warranty. See COPYING for details. * General Public License. No warranty. See COPYING for details.
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <elf.h> #include <elf.h>
#include <asm/elf.h> #undef EM_X8664
#define EM_X8664 EM_X86_64
#include <asm/types.h>
#undef u32
#define u32 __u32
#undef u64
#define u64 __u64
#include <asm/elf.h>
#ifndef TRUE #ifndef TRUE
#define TRUE 1 #define TRUE 1
@ -121,9 +128,9 @@ static int readphdrtable(int fd, Elf_Ehdr const *ehdr, Elf_Phdr **phdrs)
static int getmemorysize(Elf_Ehdr const *ehdr, Elf_Phdr const *phdrs, static int getmemorysize(Elf_Ehdr const *ehdr, Elf_Phdr const *phdrs,
unsigned long *newsize) unsigned long *newsize)
{ {
Elf32_Phdr const *phdr; Elf_Phdr const *phdr;
unsigned long size, n; unsigned long size, n;
int i; size_t i;
/* Start by setting the size to include the ELF header and the /* Start by setting the size to include the ELF header and the
* complete program segment header table. * complete program segment header table.
@ -185,8 +192,8 @@ static int truncatezeros(int fd, unsigned long *newsize)
static int modifyheaders(Elf_Ehdr *ehdr, Elf_Phdr *phdrs, static int modifyheaders(Elf_Ehdr *ehdr, Elf_Phdr *phdrs,
unsigned long newsize) unsigned long newsize)
{ {
Elf32_Phdr *phdr; Elf_Phdr *phdr;
int i; size_t i;
/* If the section header table is gone, then remove all references /* If the section header table is gone, then remove all references
* to it in the ELF header. * to it in the ELF header.
@ -309,6 +316,6 @@ int main(int argc, char *argv[])
} }
/* /*
vi:ts=8:et:nowrap vi:ts=4:et:nowrap
*/ */