c - 如何解决“危险搬迁:不支持的搬迁”
问题描述
我正在编译 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的更多信息,您将了解它会抱怨,因为它无法在抱怨的地方之前解析某些内容。在这种特殊情况下,问题是__packed
返回类型(它不理解)。__packed
仅在声明结构和联合时有用。我想将函数参数用作文档是有意义的,但这不是必需的。
__packed
因此,只需从先前的函数__gsi_update_mhi_channel_scratch
返回类型中删除即可。
推荐阅读
- xcode - 我可以强制 Xcode 通过项目而不是文件调用任务控制器中的窗口吗?
- javascript - 可以使用 ES2016 代理来捕获函数的构造,但不能捕获类
- java - 不在文本视图Android中设置文本
- reactjs - 如何在 reactstrap 列表项上显示来自 restapi 的值列表
- python - 以不同格式解析 PYTHON 中的 XML 文件
- assembly - 从内存移动到寄存器。为什么我需要内存中操作数的显式前缀?
- c# - 如何在 C#.NET 中创建持久的 AesCng 密钥或 TripleDesCng 密钥?
- java - 尽管使用了我被明确告知要使用的代码,但它还是向我抛出了一个错误
- amazon-web-services - 有没有办法在 AWS CDK 中实现 SES 发送授权?
- flutter - 如何在 Dart 中找到两个时间戳对象之间的差异?