如何修复“危险的重定位:不支持的重定位”

时间:2019-11-04 08:54:35

标签: c linux gcc

我正在编译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

我尝试了以下解决方案,但这些方法均无效。

  1. 向驱动程序添加-fPIC标志
  2. 使用gcc-7.3(binutils-2.31)
  3. 使用binutils-2.33(gcc-8.2)

1 个答案:

答案 0 :(得分:0)

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

PS> Publish-Module -NuGetApiKey xxx -Path .\bin\MyModule.0.1.0.nupkg
Publish-Module: The specified path '.\bin\MyModule.0.1.0.nupkg' is not a valid directory.

PS> Publish-Module -NuGetApiKey xxx -Path .\bin\
Publish-Module: The specified module with path '.\bin' was not published because no valid module was found with that path.

PS> Publish-Module -NuGetApiKey xxx -Name .\bin\MyModule.0.1.0.nupkg
Get-Module: C:\Users\bport\Documents\PowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:10630
 Line |
10630 |  …   $module = Microsoft.PowerShell.Core\Get-Module -ListAvailable -Name …
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      | The specified module 'D:\workarea\bin\MyModule.0.1.0.nupkg'
      | was not found. Update the Name parameter to point to a valid path, and then try again.

Publish-Module: The specified module '.\bin\MyModule.0.1.0.nupkg' was not published because no module with that name was found in any module directory.

PS> dotnet nuget push .\bin\MyModule.0.1.0.nupkg --api-key xxx --source https://www.powershellgallery.com/api/v2
Pushing MyModule.0.1.0.nupkg to 'https://www.powershellgallery.com/api/v2'...
  PUT https://www.powershellgallery.com/api/v2/
  MethodNotAllowed https://www.powershellgallery.com/api/v2/ 580ms
error: Response status code does not indicate success: 405 (Method Not Allowed).

如果您阅读有关 genksyms here 的更多信息,您会明白它会抱怨,因为它无法在它抱怨的地方之前解析某些内容。在这种特殊情况下,问题是 WARNING: EXPORT symbol "gsi_write_channel_scratch" [vmlinux] version generation failed, symbol will not be versioned. 返回类型(它不理解)。 __packed 仅在声明结构体和联合体时有用。我想将函数参数用作文档是有意义的,但这不是必需的。

因此,只需从前一个函数 __packed 返回类型中删除 __packed 即可。