DreamSoule / ollvm17

Obfuscation LLVM 17
230 stars 37 forks source link

‘llvm::Function::BasicBlockListType& llvm::Function::getBasicBlockList()’ is private within this context #2

Closed k1gen closed 10 months ago

k1gen commented 10 months ago
FAILED: lib/Passes/CMakeFiles/LLVMPasses.dir/Obfuscation/IPObfuscationContext.cpp.o 
/usr/lib/ccache/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D_LIBCPP_ENABLE_HARDENED_MODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/olk/documents/maldev/stuff/ollvm/llvm-project/build/lib/Passes -I/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Passes -I/home/olk/documents/maldev/stuff/ollvm/llvm-project/build/include -I/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT lib/Passes/CMakeFiles/LLVMPasses.dir/Obfuscation/IPObfuscationContext.cpp.o -MF lib/Passes/CMakeFiles/LLVMPasses.dir/Obfuscation/IPObfuscationContext.cpp.o.d -o lib/Passes/CMakeFiles/LLVMPasses.dir/Obfuscation/IPObfuscationContext.cpp.o -c /home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Passes/Obfuscation/IPObfuscationContext.cpp
/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Passes/Obfuscation/IPObfuscationContext.cpp: In member function ‘llvm::Function* llvm::IPObfuscationContext::InsertSecretArgument(llvm::Function*)’:
/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Passes/Obfuscation/IPObfuscationContext.cpp:232:30: error: ‘llvm::Function::BasicBlockListType& llvm::Function::getBasicBlockList()’ is private within this context
  232 |         NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList());
      |         ~~~~~~~~~~~~~~~~~~~~~^~
In file included from /home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/include/llvm/IR/Module.h:25,
                 from /home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Passes/Obfuscation/IPObfuscationContext.h:4,
                 from /home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Passes/Obfuscation/IPObfuscationContext.cpp:9:
/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/include/llvm/IR/Function.h:738:29: note: declared private here
  738 |         BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
      |                             ^~~~~~~~~~~~~~~~~
/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Passes/Obfuscation/IPObfuscationContext.cpp:232:73: error: ‘llvm::Function::BasicBlockListType& llvm::Function::getBasicBlockList()’ is private within this context
  232 |         NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList());
      |                                                     ~~~~~~~~~~~~~~~~~~~~^~
/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/include/llvm/IR/Function.h:738:29: note: declared private here
  738 |         BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
      |                             ^~~~~~~~~~~~~~~~~
[2784/4964] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/Obfuscation/Flattening.cpp.o
/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Passes/Obfuscation/Flattening.cpp: In member function ‘bool llvm::FlatteningPass::flatten(llvm::Function&)’:
/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Passes/Obfuscation/Flattening.cpp:213:1: warning: control reaches end of non-void function [-Wreturn-type]
  213 | }
      | ^
[2789/4964] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilderPipelines.cpp.o
In file included from /home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Passes/PassBuilderPipelines.cpp:115:
/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/include/llvm/Transforms/Scalar/SROA.h:96:7: warning: ‘llvm::SROAPass’ declared with greater visibility than the type of its field ‘llvm::SROAPass::SelectsToRewrite’ [-Wattributes]
   96 | class SROAPass : public PassInfoMixin<SROAPass> {
      |       ^~~~~~~~
[2790/4964] Building CXX object lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/X86ISelLowering.cpp.o
In file included from /home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h:37,
                 from /home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Target/X86/X86ISelLowering.h:18,
                 from /home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:14:
In member function ‘void llvm::SelectionDAG::setFlagInserter(FlagInserter*)’,
    inlined from ‘llvm::SelectionDAG::FlagInserter::FlagInserter(llvm::SelectionDAG&, llvm::SDNodeFlags)’ at /home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/include/llvm/CodeGen/SelectionDAG.h:370:27,
    inlined from ‘llvm::SDValue llvm::X86TargetLowering::LowerINTRINSIC_WO_CHAIN(llvm::SDValue, llvm::SelectionDAG&) const’ at /home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:27935:63:
/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/include/llvm/CodeGen/SelectionDAG.h:491:53: warning: storing the address of local variable ‘FlagsInserter’ in ‘*DAG.llvm::SelectionDAG::Inserter’ [-Wdangling-pointer=]
  491 |   void setFlagInserter(FlagInserter *FI) { Inserter = FI; }
      |                                            ~~~~~~~~~^~~~
/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp: In member function ‘llvm::SDValue llvm::X86TargetLowering::LowerINTRINSIC_WO_CHAIN(llvm::SDValue, llvm::SelectionDAG&) const’:
/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:27935:30: note: ‘FlagsInserter’ declared here
27935 |   SelectionDAG::FlagInserter FlagsInserter(DAG, Op->getFlags());
      |                              ^~~~~~~~~~~~~
/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:27891:66: note: ‘DAG’ declared here
27891 |                                                    SelectionDAG &DAG) const {
      |                                                    ~~~~~~~~~~~~~~^~~
[2791/4964] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
In file included from /home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/lib/Passes/PassBuilder.cpp:215:
/home/olk/documents/maldev/stuff/ollvm/llvm-project/llvm/include/llvm/Transforms/Scalar/SROA.h:96:7: warning: ‘llvm::SROAPass’ declared with greater visibility than the type of its field ‘llvm::SROAPass::SelectsToRewrite’ [-Wattributes]
   96 | class SROAPass : public PassInfoMixin<SROAPass> {
      |       ^~~~~~~~
ninja: build stopped: subcommand failed.

what I did:

  1. git clone -b llvmorg-17.0.2 git@github.com:llvm/llvm-project.git
  2. git clone git@github.com:DreamSoule/ollvm17.git
  3. cp -r ollvm17/llvm-project/llvm llvm-project/
  4. cd llvm-project
  5. cmake -S llvm -B build -G Ninja -DLLVM_ENABLE_PROJECTS='clang;lld' -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_USE_LINKER=lld
  6. ninja -C build

@DreamSoule, I can't fix this without you, please reply

DreamSoule commented 10 months ago

(LLVM17.0.1 & 17.0.2): ...\llvm-project\llvm\include\llvm\IR\Function.h:722

just delete private type or modify to public

:)