“arm-none-eabi-ld.bfd: u-boot: error: PHDR segment not covered by LOAD segment“

arm-none-eabi-ld.bfd: u-boot: error: PHDR segment not covered by LOAD segment


编译u-boot在最后链接时遇到上述错误,一般认为是编译器版本不匹配导致。但是尝试切换了好几个编译器版本还是有这个问题。网上搜索到如下链接:

error: PHDR segment not covered by LOAD segment

This isn’t a binutils bug, unless you believe that “PHDR segment not covered by LOAD segment” should not cause a link error. I think the ELF standard is quite clear: “PT_PHDR … may occur only if the program header table is part of the memory image of the program”
binutils-2.30, 2.31, 2.32 and 2.33 all generate a PHDR that isn’t loaded by any LOAD segment, but the code checking for that problem was ineffective. This needs fixing in the linker script used by the project, or since it seems like the binary being generated is never meant to run directly on a glibc system, by linking with --no-dynamic-linker

大概意思是说这个错误提示是符合ELF标准的,如果要忽略这个错误,需要修改连接脚本或者在链接时增加“–no-dynamic-linker”参数。对u-boot顶层目录的Makefile做如下修改后链接通过:

 724 LDFLAGS_u-boot += $(LDFLAGS_FINAL)
 725 LDFLAGS_u-boot += $(call ld-option, --no-dynamic-linker)
 726 ifneq ($(CONFIG_SYS_TEXT_BASE),)
 727 LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
 728 endif
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值