Closed zyt755 closed 1 year ago
Please share the error being encountered.
Please share the error being encountered.
I receive expected unqualifield-id error.
/home/llvm-mctoll/llvm/tools/llvm-mctoll/Raiser/IncludedFileInfo.cpp:51:11: error: expected unqualified-id
llvm::setCurrentDebugType(DEBUG_TYPE);
/home/llvm-mctoll/llvm/include/llvm/Support/Debug.h:70:32: note: expanded from macro 'setCurrentDebugType'
#define setCurrentDebugType(X) do { (void)(X); } while (false)
/home/llvm-mctoll/llvm/tools/llvm-mctoll/Raiser/IncludedFileInfo.cpp:47:22: warning: private field 'Context' is not used [-Wunused-private-field]
clang::ASTContext &Context;
^
1 warning and 1 error generated.
gmake[3]: *** [tools/llvm-mctoll/Raiser/CMakeFiles/mctollRaiser.dir/build.make:90: tools/llvm-mctoll/Raiser/CMakeFiles/mctollRaiser.dir/IncludedFileInfo.cpp.o] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:81628: tools/llvm-mctoll/Raiser/CMakeFiles/mctollRaiser.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:81490: tools/llvm-mctoll/CMakeFiles/llvm-mctoll.dir/rule] Error 2
gmake: *** [Makefile:18376: llvm-mctoll] Error 2
I comment the line and get the same error in another place. And I comment it again.
/home/llvm-mctoll/llvm/tools/llvm-mctoll/llvm-mctoll.cpp:1589:9: error: expected unqualified-id
llvm::setCurrentDebugType(DEBUG_TYPE);
^
/home/llvm-mctoll/llvm/include/llvm/Support/Debug.h:70:32: note: expanded from macro 'setCurrentDebugType'
#define setCurrentDebugType(X) do { (void)(X); } while (false)
^
1 warning and 1 error generated.
gmake[3]: *** [tools/llvm-mctoll/CMakeFiles/llvm-mctoll.dir/build.make:76: tools/llvm-mctoll/CMakeFiles/llvm-mctoll.dir/llvm-mctoll.cpp.o] Error 1
gmake[3]: *** Waiting for unfinished jobs....
gmake[2]: *** [CMakeFiles/Makefile2:81483: tools/llvm-mctoll/CMakeFiles/llvmmctoll.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:81490: tools/llvm-mctoll/CMakeFiles/llvm-mctoll.dir/rule] Error 2
gmake: *** [Makefile:18376: llvm-mctoll] Error 2
In the end, I get following result.
[100%] Linking CXX executable ../../bin/llvm-mctoll
/usr/bin/ld: ../../lib/libmctollX86Raiser.a(X86MachineInstructionRaiser.cpp.o): in function `llvm::mctoll::X86MachineInstructionRaiser::raiseBinaryOpRegToRegMachineInstr(llvm::MachineInstr const& )':
X86MachineInstructionRaiser.cpp:(.text._ZN4llvm6mctoll27X86MachineInstructionRaiser33raiseBinaryOpRegToRegMachineInstrERKNS_12MachineInstrE+0x26ec): undefined reference to `llvm::MachineInstr::dump() const' /usr/bin/ld: X86MachineInstructionRaiser.cpp:(.text._ZN4llvm6mctoll27X86MachineInstructionRaiser33raiseBinaryOpRegToRegMachineInstrERKNS_12MachineInstrE+0x2895): undefined reference to `llvm::Mac
hineInstr::dump() const'
/usr/bin/ld: X86MachineInstructionRaiser.cpp:(.text._ZN4llvm6mctoll27X86MachineInstructionRaiser33raiseBinaryOpRegToRegMachineInstrERKNS_12MachineInstrE+0x289d): undefined reference to `llvm::Mac
hineInstr::dump() const'
/usr/bin/ld: ../../lib/libmctollX86Raiser.a(X86MachineInstructionRaiser.cpp.o): in function `llvm::mctoll::X86MachineInstructionRaiser::raiseBinaryOpMemToRegInstr(llvm::MachineInstr const&, llvm::Value*)':X86MachineInstructionRaiser.cpp:(.text._ZN4llvm6mctoll27X86MachineInstructionRaiser26raiseBinaryOpMemToRegInstrERKNS_12MachineInstrEPNS_5ValueE+0x199a): undefined reference to `llvm::MachineInstr
::dump() const'
/usr/bin/ld: ../../lib/libmctollX86Raiser.a(X86MachineInstructionRaiser.cpp.o): in function `llvm::mctoll::X86MachineInstructionRaiser::raiseCallMachineInstr(llvm::MachineInstr const&)':
X86MachineInstructionRaiser.cpp:(.text._ZN4llvm6mctoll27X86MachineInstructionRaiser21raiseCallMachineInstrERKNS_12MachineInstrE+0x1603): undefined reference to `llvm::Type::dump() const'
/usr/bin/ld: ../../lib/libmctollX86Raiser.a(X86MachineInstructionRaiserSSE.cpp.o): in function `llvm::mctoll::X86MachineInstructionRaiser::raiseSSEConvertPrecisionMachineInstr(llvm::MachineInstr const&)':
X86MachineInstructionRaiserSSE.cpp:(.text._ZN4llvm6mctoll27X86MachineInstructionRaiser36raiseSSEConvertPrecisionMachineInstrERKNS_12MachineInstrE+0x282): undefined reference to `llvm::MachineInstr::dump() const'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [tools/llvm-mctoll/CMakeFiles/llvm-mctoll.dir/build.make:258: bin/llvm-mctoll] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:81483: tools/llvm-mctoll/CMakeFiles/llvm-mctoll.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:81490: tools/llvm-mctoll/CMakeFiles/llvm-mctoll.dir/rule] Error 2
gmake: *** [Makefile:18376: llvm-mctoll] Error 2
Thanks. I'll take a look as soon as I get a chance. In the meantime, can you make sure that the tip of your llvm-project
tree matches the commit listed in llvm-project-git-commit-to-use.txt
.
Thanks. I'll take a look as soon as I get a chance. In the meantime, can you make sure that the tip of your
llvm-project
tree matches the commit listed inllvm-project-git-commit-to-use.txt
.
Thanks. Yes, I'm sure llvm-project
tree matches the commit listed in llvm-project-git-commit-to-use.txt
because I compiled the mctoll project many times and only failed when disable assertions.
Can you please try
diff --git a/Raiser/IncludedFileInfo.cpp b/Raiser/IncludedFileInfo.cpp
index 9b9e1e9..e3d4ca2 100644
--- a/Raiser/IncludedFileInfo.cpp
+++ b/Raiser/IncludedFileInfo.cpp
@@ -48,7 +48,9 @@ class FuncDeclVisitor : public clang::RecursiveASTVisitor<FuncDeclVisitor> {
public:
FuncDeclVisitor(clang::ASTContext &Context) : Context(Context) {
+#ifndef NDEBUG
llvm::setCurrentDebugType(DEBUG_TYPE);
+#endif
}
bool VisitFunctionDecl(clang::FunctionDecl *FuncDecl) {
diff --git a/llvm-mctoll.cpp b/llvm-mctoll.cpp
index ecea0fb..77c5a3a 100644
--- a/llvm-mctoll.cpp
+++ b/llvm-mctoll.cpp
@@ -1585,8 +1584,9 @@ int main(int argc, char **argv) {
// Disassemble contents of .text section.
Disassemble = true;
FilterSections.push_back(".text");
-
+#ifndef NDEBUG
llvm::setCurrentDebugType(DEBUG_TYPE);
+#endif
std::for_each(InputFNames.begin(), InputFNames.end(), dumpInput);
return EXIT_SUCCESS;
cmake -S llvm -B <build-dir> -G "Ninja" \
-DLLVM_TARGETS_TO_BUILD="X86;ARM" \
-DLLVM_ENABLE_PROJECTS="clang;lld" \
-DCLANG_DEFAULT_PIE_ON_LINUX=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_DUMP=true
Thanks!
Can you please try
- applying the following patch
diff --git a/Raiser/IncludedFileInfo.cpp b/Raiser/IncludedFileInfo.cpp index 9b9e1e9..e3d4ca2 100644 --- a/Raiser/IncludedFileInfo.cpp +++ b/Raiser/IncludedFileInfo.cpp @@ -48,7 +48,9 @@ class FuncDeclVisitor : public clang::RecursiveASTVisitor<FuncDeclVisitor> { public: FuncDeclVisitor(clang::ASTContext &Context) : Context(Context) { +#ifndef NDEBUG llvm::setCurrentDebugType(DEBUG_TYPE); +#endif } bool VisitFunctionDecl(clang::FunctionDecl *FuncDecl) { diff --git a/llvm-mctoll.cpp b/llvm-mctoll.cpp index ecea0fb..77c5a3a 100644 --- a/llvm-mctoll.cpp +++ b/llvm-mctoll.cpp @@ -1585,8 +1584,9 @@ int main(int argc, char **argv) { // Disassemble contents of .text section. Disassemble = true; FilterSections.push_back(".text"); - +#ifndef NDEBUG llvm::setCurrentDebugType(DEBUG_TYPE); +#endif std::for_each(InputFNames.begin(), InputFNames.end(), dumpInput); return EXIT_SUCCESS;
- followed by configuring the build using the following command?
cmake -S llvm -B <build-dir> -G "Ninja" \ -DLLVM_TARGETS_TO_BUILD="X86;ARM" \ -DLLVM_ENABLE_PROJECTS="clang;lld" \ -DCLANG_DEFAULT_PIE_ON_LINUX=OFF \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_DUMP=true
Thanks!
THX a lot! It works!
Hi, I want to compile mctoll without assertions. However, I tried many times and all failed. Is it possible to compile without assertions?