[LLVMdev] Unable to generate obj file using llc for bpf

Xiaochu Liu xiaochu1122 at gmail.com
Sun Aug 2 18:47:39 PDT 2015


Hi Alexei,

I haven't tried to run code yet. The clang frontend can generate machine
code for bpf but llc does not do the job.

When i use : llc -march bpf -filetype=obj arith.bc

It has this error message:

Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible
type!"), function cast, file
/Users/xil174/Experiments/vcore_tool/llvm/include/llvm/Support/Casting.h,
line 237.

0  llc                      0x00000001052318ce
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 46

1  llc                      0x0000000105233199
PrintStackTraceSignalHandler(void*) + 25

2  llc                      0x000000010522fe89
llvm::sys::RunSignalHandlers() + 425

3  llc                      0x000000010523351e SignalHandler(int) + 366

4  libsystem_platform.dylib 0x00007fff8f363f1a _sigtramp + 26

5  llc                      0x000000010566fb75 (anonymous
namespace)::RewriteSymbols::ID + 40849

6  llc                      0x00000001052331bb raise + 27

7  llc                      0x0000000105233272 abort + 18

8  llc                      0x0000000105233251 __assert_rtn + 129

9  llc                      0x0000000104dd593e
llvm::cast_retty<llvm::MCSectionMachO, llvm::MCSection*>::ret_type
llvm::cast<llvm::MCSectionMachO, llvm::MCSection>(llvm::MCSection*) + 110

10 llc                      0x0000000104dcecdb (anonymous
namespace)::MCMachOStreamer::ChangeSection(llvm::MCSection*, llvm::MCExpr
const*) + 75

11 llc                      0x0000000104de9c2d
llvm::MCStreamer::SwitchSection(llvm::MCSection*, llvm::MCExpr const*) + 797

12 llc                      0x0000000104de5300
llvm::MCStreamer::InitSections(bool) + 80

13 llc                      0x00000001044f02b6
llvm::AsmPrinter::doInitialization(llvm::Module&) + 182

14 llc                      0x0000000104c5e683
llvm::FPPassManager::doInitialization(llvm::Module&) + 99

15 llc                      0x0000000104c5ee65 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&) + 997

16 llc                      0x0000000104c5e896
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 310

17 llc                      0x0000000104c5f771
llvm::legacy::PassManager::run(llvm::Module&) + 33

18 llc                      0x0000000104279403 compileModule(char**,
llvm::LLVMContext&) + 10755

19 llc                      0x0000000104276996 main + 230

20 libdyld.dylib            0x00007fff907f25c9 start + 1

Stack dump:

0. Program arguments: ../build/Debug/bin/llc -march bpf -filetype=obj
arith.bc

Illegal instruction: 4




On Sun, Aug 2, 2015 at 5:57 PM Alexei Starovoitov <
alexei.starovoitov at gmail.com> wrote:

> On Sun, Aug 2, 2015 at 12:24 AM, Xiaochu Liu <xiaochu1122 at gmail.com>
> wrote:
> > Dear there,
> >
> > I wasn't able to generate obj file for bpf using llc:
> >
> > llc -march bpf -filetype=obj foo.bc
> >
> > Anyone knows what is the missing part in their backend? I want to make it
> > work for my project.
>
> what do you mean exactly?
> Is there some error message or foo.o is rejected by kernel?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150803/ba3abf13/attachment.html>


More information about the llvm-dev mailing list