Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvm 5.0 support #99

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

llvm 5.0 support #99

wants to merge 10 commits into from

Conversation

frederich
Copy link

See individual commits for details.

- move CryptoUtils.h to Obfuscation headers
- replace std::string copies
- fix clang-format
- unified include guard pattern
- remove declaration without definition
- no using namespace in header files please!
- show Obfuscation headers in Visual Studio project section
- no using namespace std!
@frederich
Copy link
Author

Known issue with -bcf

t2.cpp
`
#include <iostream

int main() {
std::cout << "Starting..." << std::endl;
return 0;
}
`

`
C:\devenv\ollvm-5.0.0-20171214-dbg\bin\clang-cl.exe /nologo /DWIN32 /D_WINDOWS /W3 /GR /EHsc /D_WIN32_WINNT=0x600 /MT /O2 /Ob2 /DNDEBUG -mllvm -bcf -c t2.cpp

Assertion failed: UnwindDest->getFirstNonPHI()->isEHPad() && "unexpected BasicBlock!", file F:\d\1\ollvm\lib\Transforms\Utils\InlineFunction.cpp, line 614
Wrote crash dump file "C:\F\TEMP\clang-cl.exe-eaeb73.dmp"
#0 0x00007ff7d07da1ec HandleAbort f:\d\1\ollvm\lib\support\windows\signals.inc:405:0
#1 0x00007ffc5d778201 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x68201)
#2 0x00007ffc5d779d89 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x69d89)
#3 0x00007ffc5d77f885 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x6f885)
#4 0x00007ffc5d77f3d7 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x6f3d7)
#5 0x00007ffc5d77d461 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x6d461)
#6 0x00007ffc5d77fc6f (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x6fc6f)
#7 0x00007ff7d09e6ea3 HandleInlinedEHPad f:\d\1\ollvm\lib\transforms\utils\inlinefunction.cpp:614:0
#8 0x00007ff7d09e3751 llvm::InlineFunction(class llvm::CallSite,class llvm::InlineFunctionInfo &,class llvm::AAResults *,bool) f:\d\1\ollvm\lib\transforms\utils\inlinefunction.cpp:1916:0
#9 0x00007ff7cff8b0c9 InlineCallIfPossible f:\d\1\ollvm\lib\transforms\ipo\inliner.cpp:247:0
#10 0x00007ff7cff8d3b8 inlineCallsImpl f:\d\1\ollvm\lib\transforms\ipo\inliner.cpp:570:0
#11 0x00007ff7cff89ace llvm::LegacyInlinerBase::inlineCalls(class llvm::CallGraphSCC &) f:\d\1\ollvm\lib\transforms\ipo\inliner.cpp:649:0
#12 0x00007ff7cff8933c llvm::LegacyInlinerBase::runOnSCC(class llvm::CallGraphSCC &) f:\d\1\ollvm\lib\transforms\ipo\inliner.cpp:428:0
#13 0x00007ff7cfed5a98 anonymous namespace'::SimpleInliner::runOnSCC f:\d\1\ollvm\lib\transforms\ipo\inlinesimple.cpp:111:0 #14 0x00007ff7cf33c4c3 anonymous namespace'::CGPassManager::RunPassOnSCC f:\d\1\ollvm\lib\analysis\callgraphsccpass.cpp:125:0
#15 0x00007ff7cf33c1e6 anonymous namespace'::CGPassManager::RunAllPassesOnSCC f:\d\1\ollvm\lib\analysis\callgraphsccpass.cpp:418:0 #16 0x00007ff7cf33ba74 anonymous namespace'::CGPassManager::runOnModule f:\d\1\ollvm\lib\analysis\callgraphsccpass.cpp:474:0
#17 0x00007ff7cfb44cd2 anonymous namespace'::MPPassManager::runOnModule f:\d\1\ollvm\lib\ir\legacypassmanager.cpp:1591:0 #18 0x00007ff7cfb455e1 llvm::legacy::PassManagerImpl::run(class llvm::Module &) f:\d\1\ollvm\lib\ir\legacypassmanager.cpp:1694:0 #19 0x00007ff7cfb3e336 llvm::legacy::PassManager::run(class llvm::Module &) f:\d\1\ollvm\lib\ir\legacypassmanager.cpp:1726:0 #20 0x00007ff7d0e77c62 anonymous namespace'::EmitAssemblyHelper::EmitAssembly f:\d\1\ollvm\tools\clang\lib\codegen\backendutil.cpp:786:0
#21 0x00007ff7d0e74f38 clang::EmitBackendOutput(class clang::DiagnosticsEngine &,class clang::HeaderSearchOptions const &,class clang::CodeGenOptions const &,class clang::TargetOptions const &,class clang::LangOptions const &,class llvm::DataLayout const &,class llvm::Module *,enum clang::BackendAction,class std::unique_ptr<class llvm::raw_pwrite_stream,struct std::default_delete >) f:\d\1\ollvm\tools\clang\lib\codegen\backendutil.cpp:1138:0
#22 0x00007ff7d574f2ba clang::BackendConsumer::HandleTranslationUnit(class clang::ASTContext &) f:\d\1\ollvm\tools\clang\lib\codegen\codegenaction.cpp:265:0
#23 0x00007ff7d2faebd1 clang::ParseAST(class clang::Sema &,bool,bool) f:\d\1\ollvm\tools\clang\lib\parse\parseast.cpp:161:0
#24 0x00007ff7d169246b clang::ASTFrontendAction::ExecuteAction(void) f:\d\1\ollvm\tools\clang\lib\frontend\frontendaction.cpp:1005:0
#25 0x00007ff7d5745022 clang::CodeGenAction::ExecuteAction(void) f:\d\1\ollvm\tools\clang\lib\codegen\codegenaction.cpp:993:0
#26 0x00007ff7d1691ec7 clang::FrontendAction::Execute(void) f:\d\1\ollvm\tools\clang\lib\frontend\frontendaction.cpp:906:0
#27 0x00007ff7d15fb4d1 clang::CompilerInstance::ExecuteAction(class clang::FrontendAction &) f:\d\1\ollvm\tools\clang\lib\frontend\compilerinstance.cpp:981:0
#28 0x00007ff7d183d1b6 clang::ExecuteCompilerInvocation(class clang::CompilerInstance *) f:\d\1\ollvm\tools\clang\lib\frontendtool\executecompilerinvocation.cpp:251:0
#29 0x00007ff7cd64ff34 cc1_main(class llvm::ArrayRef<char const *>,char const *,void *) f:\d\1\ollvm\tools\clang\tools\driver\cc1_main.cpp:221:0
#30 0x00007ff7cd637fdd ExecuteCC1Tool f:\d\1\ollvm\tools\clang\tools\driver\driver.cpp:306:0
#31 0x00007ff7cd63888c main f:\d\1\ollvm\tools\clang\tools\driver\driver.cpp:387:0
#32 0x00007ff7d54c8db4 invoke_main f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:79:0
#33 0x00007ff7d54c8c67 __scrt_common_main_seh f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283:0
#34 0x00007ff7d54c8b2e __scrt_common_main f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:326:0
#35 0x00007ff7d54c8e49 mainCRTStartup f:\dd\vctools\crt\vcstartup\src\startup\exe_main.cpp:17:0
#36 0x00007ffc9c151fe4 (C:\WINDOWS\System32\KERNEL32.DLL+0x11fe4)
#37 0x00007ffc9e4aef91 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x6ef91)
clang-cl.exe: error: clang frontend command failed due to signal (use -v to see invocation)
Obfuscator-LLVM clang version 5.0.1 (branches/release_50) (based on Obfuscator-LLVM 5.0.1)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\devenv\ollvm-5.0.0-20171214-dbg\bin
clang-cl.exe: note: diagnostic msg: PLEASE submit a bug report to http://o-llvm.org and include the crash backtrace, preprocessed source, and associated run script.
clang-cl.exe: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-cl.exe: note: diagnostic msg: C:\F\TEMP\t2-a17770.cpp
clang-cl.exe: note: diagnostic msg: C:\F\TEMP\t2-a17770.sh
clang-cl.exe: note: diagnostic msg:
`

@frederich
Copy link
Author

Known issue with -mllvm -split:

`
#include <iostream

int main() {
std::cout << "Starting..." << std::endl;
return 0;
}
`

`
Microsoft (R) Program Maintenance Utility Version 14.11.25547.0
Copyright (C) Microsoft Corporation. All rights reserved.

    C:\devenv\ollvm-5.0.0-20171214-dbg\bin\clang-cl.exe /nologo  /DWIN32 /D_WINDOWS /W3 /GR /EHsc /D_WIN32_WINNT=0x600 /MT /O2 /Ob2 /DNDEBUG -mllvm -split -c t2.cpp

Wrote crash dump file "C:\F\TEMP\clang-cl.exe-e26308.dmp"
#0 0x00007ffc8662f806 (C:\WINDOWS\SYSTEM32\MSVCP140D.dll+0x2f806)
#1 0x00007ff7cdc45d2d std::vector<int,class std::allocator >::operator[](unsigned __int64) c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.11.25503\include\vector:1796:0
#2 0x00007ff7d20f3bb6 anonymous namespace'::SplitBasicBlock::split f:\d\1\ollvm\lib\transforms\obfuscation\splitbasicblocks.cpp:112:0 #3 0x00007ff7d20f3823 anonymous namespace'::SplitBasicBlock::runOnFunction f:\d\1\ollvm\lib\transforms\obfuscation\splitbasicblocks.cpp:64:0
#4 0x00007ff7cfb435be llvm::FPPassManager::runOnFunction(class llvm::Function &) f:\d\1\ollvm\lib\ir\legacypassmanager.cpp:1514:0
#5 0x00007ff7cfb43805 llvm::FPPassManager::runOnModule(class llvm::Module &) f:\d\1\ollvm\lib\ir\legacypassmanager.cpp:1535:0
#6 0x00007ff7cfb44cd2 anonymous namespace'::MPPassManager::runOnModule f:\d\1\ollvm\lib\ir\legacypassmanager.cpp:1591:0 #7 0x00007ff7cfb455e1 llvm::legacy::PassManagerImpl::run(class llvm::Module &) f:\d\1\ollvm\lib\ir\legacypassmanager.cpp:1694:0 #8 0x00007ff7cfb3e336 llvm::legacy::PassManager::run(class llvm::Module &) f:\d\1\ollvm\lib\ir\legacypassmanager.cpp:1726:0 #9 0x00007ff7d0e77c62 anonymous namespace'::EmitAssemblyHelper::EmitAssembly f:\d\1\ollvm\tools\clang\lib\codegen\backendutil.cpp:786:0
#10 0x00007ff7d0e74f38 clang::EmitBackendOutput(class clang::DiagnosticsEngine &,class clang::HeaderSearchOptions const &,class clang::CodeGenOptions const &,class clang::TargetOptions const &,class clang::LangOptions const &,class llvm::DataLayout const &,class llvm::Module *,enum clang::BackendAction,class std::unique_ptr<class llvm::raw_pwrite_stream,struct std::default_delete >) f:\d\1\ollvm\tools\clang\lib\codegen\backendutil.cpp:1138:0
#11 0x00007ff7d574f2ba clang::BackendConsumer::HandleTranslationUnit(class clang::ASTContext &) f:\d\1\ollvm\tools\clang\lib\codegen\codegenaction.cpp:265:0
#12 0x00007ff7d2faebd1 clang::ParseAST(class clang::Sema &,bool,bool) f:\d\1\ollvm\tools\clang\lib\parse\parseast.cpp:161:0
#13 0x00007ff7d169246b clang::ASTFrontendAction::ExecuteAction(void) f:\d\1\ollvm\tools\clang\lib\frontend\frontendaction.cpp:1005:0
#14 0x00007ff7d5745022 clang::CodeGenAction::ExecuteAction(void) f:\d\1\ollvm\tools\clang\lib\codegen\codegenaction.cpp:993:0
#15 0x00007ff7d1691ec7 clang::FrontendAction::Execute(void) f:\d\1\ollvm\tools\clang\lib\frontend\frontendaction.cpp:906:0
#16 0x00007ff7d15fb4d1 clang::CompilerInstance::ExecuteAction(class clang::FrontendAction &) f:\d\1\ollvm\tools\clang\lib\frontend\compilerinstance.cpp:981:0
#17 0x00007ff7d183d1b6 clang::ExecuteCompilerInvocation(class clang::CompilerInstance *) f:\d\1\ollvm\tools\clang\lib\frontendtool\executecompilerinvocation.cpp:251:0
#18 0x00007ff7cd64ff34 cc1_main(class llvm::ArrayRef<char const *>,char const *,void *) f:\d\1\ollvm\tools\clang\tools\driver\cc1_main.cpp:221:0
#19 0x00007ff7cd637fdd ExecuteCC1Tool f:\d\1\ollvm\tools\clang\tools\driver\driver.cpp:306:0
#20 0x00007ff7cd63888c main f:\d\1\ollvm\tools\clang\tools\driver\driver.cpp:387:0
#21 0x00007ff7d54c8db4 invoke_main f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:79:0
#22 0x00007ff7d54c8c67 __scrt_common_main_seh f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283:0
#23 0x00007ff7d54c8b2e __scrt_common_main f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:326:0
#24 0x00007ff7d54c8e49 mainCRTStartup f:\dd\vctools\crt\vcstartup\src\startup\exe_main.cpp:17:0
#25 0x00007ffc9c151fe4 (C:\WINDOWS\System32\KERNEL32.DLL+0x11fe4)
#26 0x00007ffc9e4aef91 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x6ef91)
clang-cl.exe: error: clang frontend command failed due to signal (use -v to see invocation)
Obfuscator-LLVM clang version 5.0.1 (branches/release_50) (based on Obfuscator-LLVM 5.0.1)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\devenv\ollvm-5.0.0-20171214-dbg\bin
clang-cl.exe: note: diagnostic msg: PLEASE submit a bug report to http://o-llvm.org and include the crash backtrace, preprocessed source, and associated run script.
clang-cl.exe: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-cl.exe: note: diagnostic msg: C:\F\TEMP\t2-907184.cpp
clang-cl.exe: note: diagnostic msg: C:\F\TEMP\t2-907184.sh
clang-cl.exe: note: diagnostic msg:


NMAKE : fatal error U1077: 'C:\devenv\ollvm-5.0.0-20171214-dbg\bin\clang-cl.exe' : return code '0x1'
`

@heroims
Copy link

heroims commented Dec 19, 2017

@frederich Xcode 9 can't build.

clang-5.0: error: cannot specify -o when generating multiple output files
Command /obfuscator/bin/clang failed with exit code 1

@frederich
Copy link
Author

@heroims, please send me a patch with the fix if you want it fixed. I don't have an Apple computer.

@heroims
Copy link

heroims commented Dec 19, 2017

Sorry,I forgot disable index-while-building.It can build in Xcode9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants