编译binutil包

2.15版本的binutil包有一个小BUG,编译时会报这个错误:
gcc -DHAVE_CONFIG_H -I. -Ihttp://www.cnblogs.com/binutils-2.15/gas -I. -D_GNU_SOURCE -I. -Ihttp://www.cnblogs.com/binutils-2.15/gas -I../bfd -Ihttp://www.cnblogs.com/binutils-2.15/gas/config -Ihttp://www.cnblogs.com/binutils-2.15/gas/../include -Ihttp://www.cnblogs.com/binutils-2.15/gas/.. -Ihttp://www.cnblogs.com/binutils-2.15/gas/../bfd -Ihttp://www.cnblogs.com/binutils-2.15/gas/../intl -I../intl -DLOCALEDIR="\"/home/public/study/binutils/target_x86/build/share/locale\""   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -c http://www.cnblogs.com/binutils-2.15/gas/app.c
In file included from ./targ-cpu.h:1,
                 from http://www.cnblogs.com/binutils-2.15/gas/config/obj-elf.h:42,
                 from ./obj-format.h:1,
                 from http://www.cnblogs.com/binutils-2.15/gas/config/te-linux.h:4,
                 from ./targ-env.h:1,
                 from http://www.cnblogs.com/binutils-2.15/gas/as.h:626,
                 from http://www.cnblogs.com/binutils-2.15/gas/app.c:30:
http://www.cnblogs.com/binutils-2.15/gas/config/tc-i386.h:451: error: array type has incomplete element type
make[3]: *** [app.o] Error 1
make[3]: Leaving directory `/home/public/study/binutils/target_x86/gas'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/public/study/binutils/target_x86/gas'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/public/study/binutils/target_x86/gas'
make: *** [all-gas] Error 2
jimmy@linux-jimmy:/home/public/study/binutils/target_x86>

修改方法:
(1)、把../binutils-2.15/gas/config/tc-i386.h文件第451行:
extern const struct relax_type md_relax_table[];
修改为:
extern const struct relax_type * md_relax_table;

把../binutils-2.15/gas/config/tc-i386.c中对应的数据结构修改为:const struct relax_type md_relax_table_ex[];


著名:这里和作者所写有点偏差,改后make就编译通过。

把../binutils-2.15/gas/config/tc-i386.c中对应的数据结构修改为:const struct relax_type *md_relax_table_ex;



添加:const struct relax_type * md_relax_table = md_relax_table_ex;

补丁: diff -Nur binutils-2.15 binutils-2.15.jimmy/
diff -Nur binutils-2.15/gas/config/tc-i386.c binutils-2.15.jimmy/gas/config/tc-i386.c
--- binutils-2.15/gas/config/tc-i386.c  2004-05-18 03:36:09.000000000 +0800
+++ binutils-2.15.jimmy/gas/config/tc-i386.c    2010-02-22 21:29:41.000000000 +0800
@@ -363,7 +363,7 @@
    prefix), and doesn't work, unless the destination is in the bottom
    64k of the code segment (The top 16 bits of eip are zeroed).  */

-const relax_typeS md_relax_table[] =
+const relax_typeS md_relax_table_ex[] =
 {
   /* The fields are:
      1) most positive reach of this state,
@@ -402,6 +402,8 @@
   {0, 0, 4, 0}
 };

+const relax_typeS * md_relax_table = md_relax_table_ex;
+
 static const arch_entry cpu_arch[] = {
   {"i8086",    Cpu086 },
   {"i186",     Cpu086|Cpu186 },
diff -Nur binutils-2.15/gas/config/tc-i386.h binutils-2.15.jimmy/gas/config/tc-i386.h
--- binutils-2.15/gas/config/tc-i386.h  2004-05-18 03:36:09.000000000 +0800
+++ binutils-2.15.jimmy/gas/config/tc-i386.h    2010-02-22 21:26:12.000000000 +0800
@@ -448,7 +448,7 @@

 #define md_operand(x)

-extern const struct relax_type md_relax_table[];
+extern const struct relax_type * md_relax_table;
 #define TC_GENERIC_RELAX_TABLE md_relax_table

 extern int optimize_align_code;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值