Macos 分支重新定位中不支持的符号修饰符:“0”;呼叫printf@PLT&引用;

Macos 分支重新定位中不支持的符号修饰符:“0”;呼叫printf@PLT&引用;,macos,assembly,compiler-errors,clang,mach-o,Macos,Assembly,Compiler Errors,Clang,Mach O,我将使用to来计算二进制表达式的值 以下是out部件代码(保存在文件“out.s”): 当运行它时 cc-o out.s ,它抱怨道 out.s:13:2: error: unsupported symbol modifier in branch relocation call printf@PLT ^ 错误是如何发生的,如何修复 提前谢谢 附言: 我正在使用macOS Catalina 10.15.2 cc版本是 源代码是用 cc-o comp1-g cg.c expr.c gen.c

我将使用to来计算二进制表达式的值

以下是out部件代码(保存在文件“
out.s
”):

当运行它时

cc-o out.s

,它抱怨道

out.s:13:2: error: unsupported symbol modifier in branch relocation
 call printf@PLT
 ^
错误是如何发生的,如何修复

提前谢谢

附言:

  • 我正在使用macOS Catalina 10.15.2
  • cc版本是
  • 源代码是用
    cc-o comp1-g cg.c expr.c gen.c main.c scan.c tree.c

  • call\u printf
    有效。谢谢@PeterCordes


    想知道cc的错误提示。

    MacOS Mach-O对象是否使用PLT?还是只需要小写?这看起来不像MacOS的asm;在MacOS C上,符号名称的前缀是asm中的前导
    \uu
    ,如
    \u printf
    。我认为
    .s
    文件看起来像是针对Linux的。相同的x86-64 System V调用约定;不同的名称损坏惯例。
    call\u printf
    有效。谢谢@PeterCordes@PeterCordesMacOS和iOS不使用PLT@卡米尔:这个问题的答案并没有这么说。默认为不可插入符号并不意味着没有PLT。我认为你的陈述是正确的(这是为什么它不能在Mach-O上组装而不是链接失败的明显解释),但你的链接并不能直接支持这一点,除非我在评论中或在问题或答案中遗漏了一些东西。@PeterCordes我也发现了这一点,但不幸的是,没有苹果文档支持这一点。
    out.s:13:2: error: unsupported symbol modifier in branch relocation
     call printf@PLT
     ^
    
    Apple clang version 11.0.0 (clang-1100.0.33.17)
    Target: x86_64-apple-darwin19.2.0
    Thread model: posix
    InstalledDir: /Library/Developer/CommandLineTools/usr/bin