编译ARM版Prelink

 

编译ARM版Prelink

 

转载时请注明出处和作者联系方式:http://blog.csdn.net/absurd

作者联系方式:李先静<xianjimli at hotmail dot com>

更新时间:2007-4-10

 

为了加快应用程序的起动过程和降低进程之间非共享内存,花好了几天时间折腾prelink,虽然效果不太明显,还是有一定的效果。这里介绍一下编译ARMprelink的方法:

 

1.         下载elfutils-0.125.tar.gz

 

2.         配置elfutils

tar zxvf elfutils-0.125.tar.gz

cd elfutils-0.125

./configure --host=arm-linux $PREFIX_USR_LOCAL;

 

3.         修改 src/findtextrel.c:491

size_t nsegments, struct segments segments[nsegments],

-->

size_t nsegments, struct segments* segments,

 

4.         修改src/ranlib.c

#include <string.h>

 

5.         修改libelf/common.h

#define CONVERT(Var) /

  (Var) = (sizeof (Var) == 1                              /

       ? (unsigned char) (Var)                        /

       : (sizeof (Var) == 2                           /

          ? (Elf32_Half)bswap_16 (Var)                            /

          : (sizeof (Var) == 4                        /

         ? (Elf32_Word)bswap_32 (Var)                         /

         : (Elf32_Xword)bswap_64 (Var))))

à 

#define CONVERT_TO(Dst, Var) /

  (Dst) = (sizeof (Var) == 1                              /

       ? (unsigned char) (Var)                        /

       : (sizeof (Var) == 2                           /

          ? (Elf32_Half)bswap_16 (Var)                            /

          : (sizeof (Var) == 4                        /

         ? (Elf32_Word)bswap_32 (Var)                         /

         : (Elf32_Xword)bswap_64 (Var))))

 

6.         修改src/strings.c

#include <asm/mman.h>

         

7.         编译安装elfutils

make;make install

 

8.         下载prelink-20060712.tar.bz2

tar jxf prelink-20060712.tar.bz2

 

9.         修改src/Makefile.am

删除 arch-ppc.c arch-ppc64.c

prelink_LDFLAGS = -all-static $(LIBGELF)

 

10.     配置prelink

aclocal -I ./m4 ;automake;autoconf; libtoolize --force

echo ac_cv_header_libelf_h=yes >arm-linux.cache

       /configure --host=arm-linux $PREFIX_USR_LOCAL --cache-file=arm-linux.cache;

 

11.     修改 prelink.h

#define PT_GNU_STACK    (PT_LOOS + 0x474e551)

 

12.     编译安装prelink

make;make install

 

~~end~~

 

 

 

你可能感兴趣的:(struct,header,DST)