新闻中心

EEPW首页 > 医疗电子 > 构建带内存错误检查的gcc

构建带内存错误检查的gcc

——
作者:时间:2007-04-18来源:http://blog.csdn.net/absurd/收藏
1.         下载gcc,本文使用的版本是3.4.2。

http://gcc.gnu.org/

 

2.         下载gcc扩展boundschecking。

http://sourceforge.net/projects/boundschecking/

 

3.         给gcc打上补丁。

[root@localhost toolchain]# tar jxvf /mnt/hgfs/linux/gcc-3.4.2.tar.bz2

[root@localhost toolchain]# bzip2 -d bounds-checking-gcc-3.4.2-1.00.patch.bz2

[root@localhost toolchain]# cd gcc-3.4.2/

[root@localhost gcc-3.4.2]# patch -p1 -s < ../bounds-checking-gcc-3.4.2-1.00.patch

 

4.         编译

[root@localhost gcc-3.4.2]# cd ..

[root@localhost toolchain]# mkdir build

[root@localhost toolchain]# cd build/

[root@localhost build]# ../gcc-3.4.2/configure --prefix=/opt/gcc-3.4.2-bc

[root@localhost build]# make;make install

 

5.         使用

编译时加”-g -fbounds-checking”,-g是为了让bounds-cheking能找到符号表,报告 出现错误的源代码位置。如果是编译共享库,还要链接libbounscheking.a库。

 

~~end~~



评论


相关推荐

技术专区

关闭