[LLVMdev] can't run the Hello Pass: either not registered or registered multiple times, what is the problem?

653 views
Skip to first unread message

Chuck Zhao

unread,
Jun 2, 2010, 4:52:28 PM6/2/10
to LLVM Developers Mailing List
I am trying to run the HELLO LLVM Pass under WinXP/MinGW, by following
the precise steps available at
http://www.llvm.org/docs/WritingAnLLVMPass.html.
The pass failed to run, giving me the following error:

opt -load Release/lib/Hello.dll -hello < ./hello.bc > /dev/null
opt.exe: Unknown command line argument '-hello'. Try:
'C:\MSYS\opt\llvm-2.7\bin\opt.exe -help'
make: *** [run] Error 1

Basically, it can't find the hello pass.

However, when I was trying to run the same code under Debian4-i386, I
got a totally opposite error: "Passes registered multiple times"
opt -load Release/lib/Hello.so -hello < test.bc > /dev/null
opt:
/autofs/steffan/a/a0/czhao/ResearchTools/LLVM/2.7/llvm-2.7/lib/VMCore/Pass.cpp:234:
void<unnamed>::PassRegistrar::RegisterPass(const llvm::PassInfo&):
Assertion `Inserted && "Pass registered multiple times!"' failed.
0 opt 0x085e6809
Stack dump:
0. Program arguments: opt -load Release/lib/Hello.so -hello
/bin/sh: line 1: 28292 Aborted opt -load
Release/lib/Hello.so -hello <test.bc >/dev/null
make: *** [run] Error 134


I think there is something very tricky here, but I can't figure out where.

Could somebody give me a hint?


Thank you

Chuck

_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Anton Korobeynikov

unread,
Jun 2, 2010, 5:28:00 PM6/2/10
to Chuck Zhao, LLVM Developers Mailing List
Hello

> opt -load Release/lib/Hello.dll -hello < ./hello.bc > /dev/null
> opt.exe: Unknown command line argument '-hello'. Try:
>

> Could somebody give me a hint?

Loadable modules (e.g. passes) are not supported on windows. And will
probably never be.

--
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University

John Criswell

unread,
Jun 2, 2010, 5:32:30 PM6/2/10
to Anton Korobeynikov, Chuck Zhao, LLVM Developers Mailing List
Anton Korobeynikov wrote:
> Hello
>
>
>> opt -load Release/lib/Hello.dll -hello < ./hello.bc > /dev/null
>> opt.exe: Unknown command line argument '-hello'. Try:
>>
>> Could somebody give me a hint?
>>
> Loadable modules (e.g. passes) are not supported on windows. And will
> probably never be.
>
>

As an alternative, you can either:

1) Modify the opt program to statically link in the library implementing
your pass.
2) Create a new program (based on opt) that runs your pass on a
specified bitcode file.

SAFECode has done the latter; you can see what we did by checkout out
the SAFECode source code
(http://safecode.cs.illinois.edu/downloads.html) and looking at
tools/Sc/sc.cpp.

-- John T.

Chuck Zhao

unread,
Jun 2, 2010, 7:17:00 PM6/2/10
to Anton Korobeynikov, cris...@uiuc.edu, LLVM Developers Mailing List
Anton and John,

Thank you for the valuable info.

I guess the MinGW/Cygwin path is dead, at least for now.

How about the problem of registering the pass multiple times under Linux (Debian4-i386)?


opt -load Release/lib/Hello.so -hello < test.bc > /dev/null
opt: /autofs/steffan/a/a0/czhao/ResearchTools/LLVM/2.7/llvm-2.7/lib/VMCore/Pass.cpp:234: void<unnamed>::PassRegistrar::RegisterPass(const llvm::PassInfo&): Assertion `Inserted && "Pass registered multiple times!"' failed.
0  opt 0x085e6809
Stack dump:
0.    Program arguments: opt -load Release/lib/Hello.so -hello
/bin/sh: line 1: 28292 Aborted                 opt -load Release/lib/Hello.so -hello <test.bc >/dev/null
make: *** [run] Error 134

I can't seem to figure out the reason of the strange behavior, other than believing it is (possibly) a mis-compilation problem.

A few known-to-miscompile compiler versions are given in the getting started guide (http://llvm.org/docs/GettingStarted.html), I wonder if the LLVM Team can publish instead at least 1 GOOD build compiler (the version) on a supported platform, in addition to the broken ones.

And, is there a way to check whether a current LLVM build is miscompiled or not, by running some simple tests or scripts?

Any suggestion(s)?

Thank you

Chuck

Anton Korobeynikov

unread,
Jun 3, 2010, 6:39:06 AM6/3/10
to Chuck Zhao, cris...@uiuc.edu, LLVM Developers Mailing List
> I can't seem to figure out the reason of the strange behavior, other than
> believing it is (possibly) a mis-compilation problem.
Make sure you haven't linked the LLVM libraries twice (e.g. to opt &
to your loadable module)

> And, is there a way to check whether a current LLVM build is miscompiled or
> not, by running some simple tests or scripts?

4.2.4 works fine for me

Reply all
Reply to author
Forward
0 new messages