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

Option 'load' registered more than once! #85

Open
IMMORTAL23 opened this issue May 14, 2023 · 1 comment
Open

Option 'load' registered more than once! #85

IMMORTAL23 opened this issue May 14, 2023 · 1 comment

Comments

@IMMORTAL23
Copy link

IMMORTAL23 commented May 14, 2023

Description:
I'm running into an error when trying to use the opt command. All the passes in the repo work fine. But when I wrote and ran my own pass code using MBASub.cpp as a template and this error produced.

I've checked my command line arguments to make sure I'm not specifying -load multiple times and my code only change the name and runOnBasicBlock function in MBASub.cpp , so I'm not sure what's causing this error. Can anyone help me troubleshoot this issue?

Steps to reproduce:

Run the opt command with opt-14 -load-pass-plugin ./lib/libIndirectJmp.so -passes=indirect-jmp -S ./inputs/input_for_mba_sub.ll -o out.ll
Observe the "Option 'load' registered more than once!" error message
Expected result:
The opt command should run successfully with the specified options.

Actual result:

opt-14: CommandLine Error: Option 'load' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: opt-14 -load-pass-plugin ./lib/libIndirectJmp.so -passes=indirect-jmp -S ./inputs/input_for_mba_sub.ll -o out.ll
#0 0x00007fae6c81aa71 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xea5a71)
#1 0x00007fae6c8187be llvm::sys::RunSignalHandlers() (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xea37be)
#2 0x00007fae6c81afa6 (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xea5fa6)
#3 0x00007fae6b4aff90 (/lib/x86_64-linux-gnu/libc.so.6+0x3bf90)
#4 0x00007fae6b4feccc __pthread_kill_implementation ./nptl/./nptl/pthread_kill.c:44:76
#5 0x00007fae6b4afef2 raise ./signal/../sysdeps/posix/raise.c:27:6
#6 0x00007fae6b49a472 abort ./stdlib/./stdlib/abort.c:81:7
#7 0x00007fae6c74f668 (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xdda668)
#8 0x00007fae6c74f486 (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xdda486)
#9 0x00007fae6c73a4e0 (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xdc54e0)
#10 0x00007fae6c72be5b llvm::cl::Option::addArgument() (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xdb6e5b)
#11 0x00007fae67bc0ec0 llvm::cl::opt<llvm::PluginLoader, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >::done() /usr/include/llvm-14/llvm/Support/CommandLine.h:1489:22
#12 0x00007fae67bc0046 llvm::cl::opt<llvm::PluginLoader, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >::opt<char [5], llvm::cl::NumOccurrencesFlag, llvm::cl::value_desc, llvm::cl::desc>(char const (&) [5], llvm::cl::NumOccurrencesFlag const&, llvm::cl::value_desc const&, llvm::cl::desc const&) /usr/include/llvm-14/llvm/Support/CommandLine.h:1513:3
#13 0x00007fae67bbd188 __static_initialization_and_destruction_0(int, int) /usr/include/llvm-14/llvm/Support/PluginLoader.h:35:5
#14 0x00007fae67bbd248 _GLOBAL__sub_I_IndirectJmp.cpp /home/kali/learnllvm/my-pass/lib/IndirectJmp.cpp:145:59
#15 0x00007fae722f4abe call_init ./elf/./elf/dl-init.c:69:21
#16 0x00007fae722f4abe call_init ./elf/./elf/dl-init.c:26:1
#17 0x00007fae722f4ba4 _dl_init ./elf/./elf/dl-init.c:116:14
#18 0x00007fae6b5c2e44 _dl_catch_exception ./elf/./elf/dl-error-skeleton.c:184:18
#19 0x00007fae722fb30e dl_open_worker ./elf/./elf/dl-open.c:812:6
#20 0x00007fae6b5c2dea _dl_catch_exception ./elf/./elf/dl-error-skeleton.c:209:18
#21 0x00007fae722fb6a8 _dl_open ./elf/./elf/dl-open.c:884:17
#22 0x00007fae6b4f92d8 dlopen_doit ./dlfcn/./dlfcn/dlopen.c:56:13
#23 0x00007fae6b5c2dea _dl_catch_exception ./elf/./elf/dl-error-skeleton.c:209:18
#24 0x00007fae6b5c2e9f _dl_catch_error ./elf/./elf/dl-error-skeleton.c:228:12
#25 0x00007fae6b4f8dc7 _dlerror_run ./dlfcn/./dlfcn/dlerror.c:145:17
#26 0x00007fae6b4f9389 dlopen_implementation ./dlfcn/./dlfcn/dlopen.c:71:51
#27 0x00007fae6b4f9389 dlopen ./dlfcn/./dlfcn/dlopen.c:81:12
#28 0x00007fae6c8052f9 llvm::sys::DynamicLibrary::getPermanentLibrary(char const*, std::__cxx11::basic_string<char, std::char_traits, std::allocator >) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe902f9)
#29 0x00007fae6f39326f llvm::PassPlugin::Load(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x3a1e26f)
#30 0x0000000000420088 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine
, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRefllvm::StringRef, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool) (/usr/lib/llvm-14/bin/opt+0x420088)
#31 0x0000000000435fb7 main (/usr/lib/llvm-14/bin/opt+0x435fb7)
#32 0x00007fae6b49b18a __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#33 0x00007fae6b49b245 call_init ./csu/../csu/libc-start.c:128:20
#34 0x00007fae6b49b245 __libc_start_main ./csu/../csu/libc-start.c:368:5
#35 0x000000000041bd8a _start (/usr/lib/llvm-14/bin/opt+0x41bd8a)
zsh: IOT instruction opt-14 -load-pass-plugin ./lib/libIndirectJmp.so -passes="indirect-jmp" -S -

Environment details:

Operating system: kali
LLVM/Clang version: 14.0.6-2
here is my source code
indirectjmp.txt

Thank you for your help!

@banach-space
Copy link
Owner

Sorry that you are experiencing this! How do you build your plugin?

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

No branches or pull requests

2 participants