From 96c998a1d7dd2fffe171aff69ae86844edd5c0a0 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Thu, 24 Mar 2005 11:38:05 +0000 Subject: [PATCH] Updated for current glibc. committer: mfx 1111664285 +0000 --- src/stub/util/sstrip/.cvsignore | 2 ++ src/stub/util/sstrip/Makefile | 23 +++++++++-------------- src/stub/util/sstrip/sstrip.c | 33 ++++++++++++++++++++------------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/stub/util/sstrip/.cvsignore b/src/stub/util/sstrip/.cvsignore index a971ab64..2da519ab 100644 --- a/src/stub/util/sstrip/.cvsignore +++ b/src/stub/util/sstrip/.cvsignore @@ -1,2 +1,4 @@ +amd64-linux-sstrip +i386-linux-sstrip sstrip sstrip.exe diff --git a/src/stub/util/sstrip/Makefile b/src/stub/util/sstrip/Makefile index 5e2a195c..0c661d2c 100644 --- a/src/stub/util/sstrip/Makefile +++ b/src/stub/util/sstrip/Makefile @@ -2,22 +2,17 @@ SHELL = /bin/sh -all: sstrip +##all: amd64-linux-sstrip +all: i386-linux-sstrip -sstrip: sstrip.c - gcc -O2 -g -Wall -W -o $@ $< +amd64-linux-sstrip: sstrip.c + gcc -m64 -O2 -g -Wall -W -o $@ $< +i386-linux-sstrip: sstrip.c + gcc -m32 -O2 -g -Wall -W -o $@ $< -mostlyclean: - -rm -f *.d *.err *.i *.log *.map *~ gdb-trans* - -clean distclean maintainer-clean: mostlyclean - -rm -f *.a *.lib *.o *.obj tags TAGS ID - -rm -rf .deps - rm -f sstrip +mostlyclean clean distclean maintainer-clean: + rm -f *.d *.o *.obj + rm -f sstrip amd64-linux-sstrip i386-linux-sstrip .PHONY: all mostlyclean clean distclean maintainer-clean -.NOEXPORT: - -# vi:nowrap - diff --git a/src/stub/util/sstrip/sstrip.c b/src/stub/util/sstrip/sstrip.c index a23b2e99..5e52bc92 100644 --- a/src/stub/util/sstrip/sstrip.c +++ b/src/stub/util/sstrip/sstrip.c @@ -2,14 +2,21 @@ * General Public License. No warranty. See COPYING for details. */ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#undef EM_X8664 +#define EM_X8664 EM_X86_64 +#include +#undef u32 +#define u32 __u32 +#undef u64 +#define u64 __u64 +#include #ifndef TRUE #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, unsigned long *newsize) { - Elf32_Phdr const *phdr; + Elf_Phdr const *phdr; unsigned long size, n; - int i; + size_t i; /* Start by setting the size to include the ELF header and the * 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, unsigned long newsize) { - Elf32_Phdr *phdr; - int i; + Elf_Phdr *phdr; + size_t i; /* If the section header table is gone, then remove all references * 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 */