Khi sử dụng MacPorts GCC trên OS X và đưa Enang Integrated Assembler qua -Wa,-q
, trình tạo ra một luồng cảnh báo cho mỗi tệp. Một mẫu các cảnh báo được hiển thị bên dưới (rất nhiều trong số chúng, trình soạn thảo Stack Overflow sẽ không cho phép tôi dán toàn bộ luồng).Vô hiệu hóa cảnh báo bộ ghép ".section __TEXT, __ textcoal_nt, coalesced, pure_instructions"
Tôi tìm thấy LLVM Commit r250349, Stop generating coal sections. Đây là mã chịu trách nhiệm, nhưng nó không rõ ràng với tôi làm thế nào để vô hiệu hóa các cảnh báo.
+ // 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));
+ }
+ }
+
tôi không thể chuyển hướng 2 > /dev/null
vì cấu hình là một chút mong manh vào lúc này, và nó loại bỏ các cảnh báo và các lỗi khác.
Làm cách nào để tắt cảnh báo trình kết hợp Clang trên phần than?
Khi trình biên dịch GCC gặp -Wa,-q
, nó sử dụng /opt/local/bin/clang
như lắp ráp chứ không phải /opt/local/bin/as
. Dưới đây là các phiên bản có liên quan.
$ /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
Thêm -Wno-deprecated
để CXXFLAGS
không ngăn chặn cảnh báo. Tôi cũng đã cố gắng -fno-tree-coalesce-vars
mà không có niềm vui (có thể làm tổn thương hiệu suất).
Và sed
sau đây không phù hợp trên OS X sử dụng sed
hoặc 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]
Sau đây là các báo cáo lỗi LLVM GCC có liên quan và:
- 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
Không phải là câu trả lời tôi muốn nghe nhưng cảm ơn bạn. – jww
Cảm ơn Jeremy lần nữa. Các báo cáo lỗi đã được thêm vào câu hỏi. Ngoài ra, nếu tôi bỏ qua '-g2 -O2' thì vấn đề sẽ biến mất. Nhưng nó không phải là rất hữu ích để có một chương trình chưa được tối ưu hóa mà không có biểu tượng. – jww