FROM : http://blog.tianya.cn/blogger/trackback.asp?BlogID=420361&PostID=5366553 

编译 u-boot1.1.3时:

我在论坛中找到一位老兄的贴子,问的正好是该问题
对方的给的提示是:
这是因为你用的编译的版本不一致,
你的uboot里面指定了 -msoft-float 编译选项, 是软浮点的,
但是你连接的gcc库是用的硬浮点的,
解决办法
把uboot里面的Makefile里面的 “-msoft-float”去掉;
或者
2,换一个soft float软浮点的 工具链;
I know there is a link error happened when the arm-linux ld want to link two different types of libs.

编译使用的是arm-linux-gcc-3.4.1.tar.bz2,可能由于glibc使用Hardware FP,而U-boot使用的是
Software FP,所以无法正确链接,可能要将glibc用Software FP的方法重新编译,怎样重新编译呢?

有人建议编译u-boot的时候用2.95.3 编译内核时用3.4.1
在网上找google 了一会,发现什么patch to fix the problem,可惜看 不懂这个补丁。
无奈之下只好grep R_ARM_PLT32 -r u-boot根目录,就是找不到哪个文件里有这个参数

e get this error from stock GCC 3.3.2 and GCC 3.4.0. We listed this as
a bug to CodeSourcery and they responded with a patch to fix the
problem. Apparently it has not been applied to every tree variant.

---------------------- from
CodeSourcry-----------------------------------
The following patch should fix this problem. It will be included in
future
releases.

Paul

--- bfd/elf32-arm.h.orig 2004-04-22 22:11:15.000000000 -0400
+++ bfd/elf32-arm.h 2004-04-22 22:28:37.000000000 -0400
@@ -2229,6 +2229,8 @@ elf32_arm_relocate_section (output_bfd,
 case R_ARM_PC24:
 case R_ARM_ABS32:
 case R_ARM_THM_PC22:
+ case R_ARM_PLT32:
+
 if (info->shared
 && (
 (!info->symbolic && h->dynindx != -1)
@@ -2262,11 +2264,6 @@ elf32_arm_relocate_section (output_bfd,
 relocation = 0;
 break;

- case R_ARM_PLT32:
- if (h->plt.offset != (bfd_vma)-1)
- relocation = 0;
- break;
-
 default:
 if (unresolved_reloc)
 _bfd_error_handler
-------------------------------------- end patch ----------------------
Regards,
伤心之后,我换了u-boot-1.1.4.tar
Make smdk2410_config
Make
出现了以下问题
make[1]: Entering directory `/home/534/u-boot-1.1.4/tools'
ln -s ../common/environment.c environment.c
ln -s ../lib_generic/crc32.c crc32.c
gcc -M -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x33F80000 -DUSE_HOSTCC environment.c img2srec.c mkimage.c crc32.c envcrc.c gen_eth_addr.c bmp_logo.c > .depend
make[1]: Leaving directory `/home/534/u-boot-1.1.4/tools'
make[1]: Entering directory `/home/534/u-boot-1.1.4/tools'
make[1]: `.depend' is up to date.
make[1]: Leaving directory `/home/534/u-boot-1.1.4/tools'
make[1]: Entering directory `/home/534/u-boot-1.1.4/examples'
arm-linux-gcc -M -g -Os -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x33F80000 -I/home/534/u-boot-1.1.4/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/include -pipe -DCONFIG_ARM -D__ARM__ -march=armv4 -mabi=apcs-gnu -Wall -Wstrict-prototypes hello_world.c stubs.c > .depend
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
make[1]: *** [.depend] Error 1
make[1]: Leaving directory `/home/534/u-boot-1.1.4/examples'
make[1]: Entering directory `/home/534/u-boot-1.1.4/post'
arm-linux-gcc -M -g -Os -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x33F80000 -I/home/534/u-boot-1.1.4/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/include -pipe -DCONFIG_ARM -D__ARM__ -march=armv4 -mabi=apcs-gnu -Wall -Wstrict-prototypes cache_8xx.S cache.c codec.c cpu.c dsp.c ether.c i2c.c memory.c post.c rtc.c spr.c sysmon.c tests.c uart.c usb.c watchdog.c > .depend
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
make[1]: *** [.depend] Error 1
make[1]: Leaving directory `/home/534/u-boot-1.1.4/post'
make[1]: Entering directory `/home/534/u-boot-1.1.4/post/cpu'
arm-linux-gcc -M -g -Os -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x33F80000 -I/home/534/u-boot-1.1.4/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/include -pipe -DCONFIG_ARM -D__ARM__ -march=armv4 -mabi=apcs-gnu -Wall -Wstrict-prototypes asm.S cmp.c cmpi.c two.c twox.c three.c threex.c threei.c andi.c srawi.c rlwnm.c rlwinm.c rlwimi.c store.c load.c cr.c b.c multi.c string.c complex.c > .depend
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
cc1: error: invalid option `abi=apcs-gnu'
make[1]: *** [.depend] Error 1
make[1]: Leaving directory `/home/534/u-boot-1.1.4/post/cpu'
make: *** [depend] Error 2
看来是处处伏有危险哈。
以后搜索到的
以下摘自 http://sourceforge.net/mailarchive/message.php?msg

> I'm using the GCC 3.2 toolchain for building U-Boot (current head of git) for an ARM
target.
 > I get the following error:
 > cc1: invalid option 'abi=apcs-gnu'
 >
 > This option (correct me if I'm wrong) was introduced with a recent
 > patch by Peter Pearse. Digging a bit in gcc.gnu.org it appears that
 > this option comes only with GCC 4.0!

 That's true but the cc-option checker should use -mapcs-32 if it is
 available, otherwise it will fall back to -mabi=apcs-gnu. It looks
 like your compiler doesn't support the first option either. In this
 case, I'm not sure it worked before Peter's patch. What CPU is it?

 You could try the following in your config.mk but you should
 investigate why -mapcs-32 doesn't work:

 PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu,))
再把#PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))的-mshort-load-bytes还是出现上面的问题。唉..
再换2.95的编译器,vi /cpu/arm920t/config.mk
注意修改成如下所示,就能成功编译,在u-boot根目录下就会出现u-boot.bin,u-boot,u-boot.srec,u-boot.map等文件
 PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8
 PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4
小小地庆祝一下………..
还有一事不明,/work/crosstool-0.27/build/arm-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/gcc/config
/arm /lib1funcs.asm:795: relocation truncated to fit: R_ARM_PLT32 __div0 ,在编译出错的时候,为什么我用find –path / -name lib1funcs.* 找不到这个文件呢,真是奇怪….。不知道是不是这个文件是在调用glibc的时候临时生成的?…………

Logo

更多推荐