gpt4 book ai didi

c - 如何修复 "dangerous relocation: unsupported relocation"

转载 作者:行者123 更新时间:2023-12-03 21:00:07 26 4
gpt4 key购买 nike

我正在编译 linux-4.19(gcc-8.2 bintutils-2.31),但是它总是失败并出现如下错误:

aarch64-oe-linux-ld.bfd: drivers/platform/gsi/gsi.o: relocation R_AARCH64_ABS32 against `__crc_gsi_write_channel_scratch' can not be used when making a shared object
aarch64-oe-linux-ld.bfd: drivers/platform/gsi/gsi.o:/usr/src/kernel/drivers/platform/gsi/gsi.c:4383:(.data+0x0): dangerous relocation: unsupported relocation
aarch64-oe-linux-ld.bfd: drivers/platform/gsi/gsi.o:(.data+0x28): dangerous relocation: unsupported relocation
aarch64-oe-linux-ld.bfd: drivers/platform/gsi/gsi.o:(.data+0x50): dangerous relocation: unsupported relocation
aarch64-oe-linux-ld.bfd: drivers/platform/gsi/gsi.o:(__verbose+0x0): dangerous relocation: unsupported relocation
aarch64-oe-linux-ld.bfd: drivers/platform/gsi/gsi.o:(__verbose+0x8): dangerous relocation: unsupported relocation

我尝试了以下解决方案,但这些都不起作用。
  • 添加 -fPIC给司机的标志
  • 使用 gcc-7.3 (binutils-2.31)
  • 使用 binutils-2.33 (gcc-8.2)
  • 最佳答案

    问题不是重定位,是下面的警告(应该出现在错误之前)

    WARNING: EXPORT symbol "gsi_write_channel_scratch" [vmlinux] version generation failed, symbol will not be versioned.
    如果您阅读有关 genksyms 的更多信息 here你会明白它提示是因为它无法在它提示的地方之前解析某些东西。在这种特殊情况下,问题是 __packed返回类型(它不理解)。 __packed仅在声明结构和 union 时有用。我想将函数参数用作文档是有意义的,但这不是必需的。
    所以只需放下 __packed来自上一个函数 __gsi_update_mhi_channel_scratch返回类型,你就设置好了。

    关于c - 如何修复 "dangerous relocation: unsupported relocation",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58689931/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com