禁用汇编程序警告“.section __TEXT,__textcoal_nt,coalesced,pure_instructions” [英] Disable assembler warning ".section __TEXT,__textcoal_nt,coalesced,pure_instructions"
问题描述
当在OS X上使用MacPorts GCC并通过 -Wa,-q
引入Clang集成汇编程序时,汇编程序会为每个文件产生一串警告。下面显示了警告的一个示例(其中很多是堆栈溢出编辑器不允许我粘贴整个流)。
我发现 LLVM提交r250349,停止生成煤部分。这是代码负责,但它不清楚如何禁用警告。
+ //如果目标不是powerpc并且Section是*煤*部分,则发出警告。
+ Triple TT = getParser()。getContext()。getObjectFileInfo() - > getTargetTriple();
+ Triple :: ArchType ArchTy = TT.getArch();
+
+ if(ArchTy!= Triple :: ppc& ArchTy!= Triple :: ppc64){
+ StringRef NonCoalSection = StringSwitch< StringRef>(Section)
+ .Case(__ textcoal_nt,__text)
+ .Case(__ const_coal,__const)
+ .Case(__ datacoal_nt,__data)
+ .DEFAULT(段);
+
+ if(!Section.equals(NonCoalSection)){
+ StringRef SectionVal(Loc.getPointer());
+ size_t B = SectionVal.find(',')+ 1,E = SectionVal.find(',',B);
+ SMLoc BLoc = SMLoc :: getFromPointer(SectionVal.data()+ B);
+ SMLoc ELoc = SMLoc :: getFromPointer(SectionVal.data()+ E);
+ getParser()。Warning,(Loc,section \+ Section +\is deprecated,
+ SMRange(BLoc,ELoc));
+ getParser()。注意(Loc,将节名更改为\+ NonCoalSection +
+\,SMRange(BLoc,ELoc));
+}
+}
+
我无法重定向 2> / dev / null
,因为此时配置有点脆弱,并且会丢弃其他警告和错误。
如何禁用Clang汇编程序警告?
当GCC编译器遇到 -Wa,-q
,它使用 / opt / local / bin / clang
作为汇编程序而不是 / opt / local / bin中/作为
。这里是相关的版本。
$ b
$ / opt / local / bin / g ++ - mp- 6 --version
g ++ - mp-6(MacPorts gcc6 6.1.0_0)6.1.0
版权所有(C)2016自由软件基金会,Inc.
$ / opt / local / bin / clang --version
叮当版本3.8.0(branches / release_38 262722)
目标:x86_64-apple-darwin12.6.0
$ / opt / local / bin / as -version
Apple Inc版本cctools-877.8,GNU汇编程序版本1.38
将 -Wno-deprecated
添加到 CXXFLAGS
不会抑制警告。我也尝试过 -fno-tree-coalesce-vars
没有喜悦(这可能会损害性能)。
以下 sed
在OS X上使用 sed
或 gsed $ c $不匹配c>:
$ b
$ CXXFLAGS = - DNDEBUG -g2 -O2make CXX = / opt / local / bin / g ++ - mp-6 2>& 1 | \
gsed -e'/(__ TEXT | __DATA)/,+ 2d'
/ opt / local / bin / g ++ - mp-6 -DNDEBUG -g2 -O2 -fPIC -march = native - Wa,-q -pipe -c rijndael.cpp
stdin> 3:11:warning:section__textcoal_ntis deprecated
.section __TEXT,__ textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
:3:11:note:将节名更改为__text
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~
...
< hr>
/ opt / local / bin / g ++ - mp-6 -DNDEBUG -g2 -O2 -fPIC -march = native -Wa,-q -DMACPORTS_GCC_COMPILER = 1 -c cryptlib.cpp
stdin>:3:11:warning:section__textcoal_nt已弃用
.section __TEXT,__textcoal_nt,合并,pure_instructions
^ ~~~~~~~~~~~~~
:3:11:note:将节名更改为__text
.section __TEXT, __textcoal_nt,凝聚, pure_instructions
^ ~~~~~~~~~~~~~
stdin>:2665:11:warning:section__textcoal_ntis deprecated
.section __TEXT,__ textcoal_nt, coalesced,pure_instructions
^ ~~~~~~~~~~~~~
stdin>:2665:11:note:将节名更改为__text
.section __TEXT ,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
stdin>:3925:11:warning:section__textcoal_ntis deprecated
。 section __TEXT,__ textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~
stdin>:3925:11:note:将section name改为__text
.section __TEXT,__ textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
stdin>:3963:11:warning:section__textcoal_ntis deprecated
.section __TEXT,__ textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
.section __TEXT,__ textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
[为每个源文件省略其中的数百]
以下是相关的GCC和LLVM错误报告:
目前,您无法禁用这些警告。您应该提交一份针对FSF GCC的错误报告,让他们更新他们的codegen以使其更加合规。
您可能还想用llvm.org提交错误报告给要求有一种方法来消除这些警告或限制发布的数量,以免洪水泛滥。
When using MacPorts GCC on OS X and enlisting the Clang Integrated Assembler via -Wa,-q
, the assembler produces a stream of warnings for each file. A sampling of the warnings is shown below (so many of them, the Stack Overflow editor would not allow me to paste the entire stream).
I found LLVM Commit r250349, Stop generating coal sections. Here's the code responsible, but its not clear to me how to disable the warning.
+ // Issue a warning if the target is not powerpc and Section is a *coal* section.
+ Triple TT = getParser().getContext().getObjectFileInfo()->getTargetTriple();
+ Triple::ArchType ArchTy = TT.getArch();
+
+ if (ArchTy != Triple::ppc && ArchTy != Triple::ppc64) {
+ StringRef NonCoalSection = StringSwitch<StringRef>(Section)
+ .Case("__textcoal_nt", "__text")
+ .Case("__const_coal", "__const")
+ .Case("__datacoal_nt", "__data")
+ .Default(Section);
+
+ if (!Section.equals(NonCoalSection)) {
+ StringRef SectionVal(Loc.getPointer());
+ size_t B = SectionVal.find(',') + 1, E = SectionVal.find(',', B);
+ SMLoc BLoc = SMLoc::getFromPointer(SectionVal.data() + B);
+ SMLoc ELoc = SMLoc::getFromPointer(SectionVal.data() + E);
+ getParser().Warning(Loc, "section \"" + Section + "\" is deprecated",
+ SMRange(BLoc, ELoc));
+ getParser().Note(Loc, "change section name to \"" + NonCoalSection +
+ "\"", SMRange(BLoc, ELoc));
+ }
+ }
+
I can't redirect 2 > /dev/null
because the configuration is a bit fragile at the moment, and it discards other warnings and errors.
How do I disable the Clang assembler warning on coal sections?
When the GCC compiler encounters -Wa,-q
, it uses /opt/local/bin/clang
as the assembler rather than /opt/local/bin/as
. Here are the relevant versions.
$ /opt/local/bin/g++-mp-6 --version
g++-mp-6 (MacPorts gcc6 6.1.0_0) 6.1.0
Copyright (C) 2016 Free Software Foundation, Inc.
$ /opt/local/bin/clang --version
clang version 3.8.0 (branches/release_38 262722)
Target: x86_64-apple-darwin12.6.0
$ /opt/local/bin/as -version
Apple Inc version cctools-877.8, GNU assembler version 1.38
Adding -Wno-deprecated
to CXXFLAGS
does not suppress the warning. I also tried -fno-tree-coalesce-vars
with no joy (which may hurt performance).
And the following sed
does not match on OS X using sed
or gsed
:
$ CXXFLAGS="-DNDEBUG -g2 -O2" make CXX=/opt/local/bin/g++-mp-6 2>&1 | \
gsed -e '/(__TEXT|__DATA)/,+2d'
/opt/local/bin/g++-mp-6 -DNDEBUG -g2 -O2 -fPIC -march=native -Wa,-q -pipe -c rijndael.cpp
<stdin>:3:11: warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:3:11: note: change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
...
/opt/local/bin/g++-mp-6 -DNDEBUG -g2 -O2 -fPIC -march=native -Wa,-q -DMACPORTS_GCC_COMPILER=1 -c cryptlib.cpp
<stdin>:3:11: warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:3:11: note: change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:2665:11: warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:2665:11: note: change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:3925:11: warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:3925:11: note: change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:3963:11: warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:3963:11: note: change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
[Hundred of these ommitted for each source file]
Here are the relevant GCC and LLVM bug reports:
- GCC Issue 71767 - Endless stream of warnings when using GCC with -Wa,-q and Clang Integrated Assembler
- LLVM Issue 28427 - Endless stream of warnings when using GCC with -Wa,-q and Clang Integrated Assembler
At present, you cannot disable those warnings. You should probably file a bug report against FSF GCC to have them update their codegen to be more compliant.
You might also want to file a bug report with llvm.org to request that there be a way to silence these warnings or limit the number that are issued so as to not deluge the user.
这篇关于禁用汇编程序警告“.section __TEXT,__textcoal_nt,coalesced,pure_instructions”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!