【问题标题】:What does -fprofile-arcs linker option mean?-fprofile-arcs 链接器选项是什么意思?
【发布时间】:2014-05-07 04:10:35
【问题描述】:

我想在我的应用程序中有代码覆盖率,所以在premake.lua 我添加了以下内容:

if options["coverage"] then
    tinsert(package.buildoptions, {"-fprofile-arcs", "-ftest-coverage"})
    tinsert(package.links, "gcov") 
end

然后我运行以下命令:

premake --coverage --target gnu ; make

这在我添加以下内容之前不起作用:

 if options["coverage"] then
    tinsert(package.buildoptions, {"-fprofile-arcs", "-ftest-coverage"})
    tinsert(package.linkoptions, {"-fprofile-arcs"})
    tinsert(package.links, "gcov")
 end

这是互联网上提出的解决方案。我的问题是我在这个 -fprofile-arcs 链接器标志上找到了 0 个文档......它有什么作用?它在哪里记录?

【问题讨论】:

  • 如果您的搜索查询以 - 开头,您将无法在 Google 中找到任何内容

标签: linux gcc linker


【解决方案1】:

此选项未提供给链接器。它由编译器驱动程序(gcc,g++)解释。

编译时,这个选项只是传递给编译器(cc1,cc1plus)。

链接时,选项的效果是编译器驱动只在链接器命令行中包含-lgcov

【讨论】:

  • 不管在链接器命令行中获取-lgcov 的其他可能方式,-fprofile-arcs 在调用编译器驱动程序进行链接时都会这样做。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-08-30
  • 1970-01-01
  • 1970-01-01
  • 2013-05-31
  • 2013-11-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多