llvm - llc: unsupported relocation on symbol -
problem
llc
giving me following error:
llvm error: unsupported relocation on symbol
detailed compilation flow
i implementing llvm frontend middle-level ir (mir) of compiler, , after convert various methods many bitcode files, link them (llvm-link
), optimize them (opt
), convert them machine code (llc
), make them shared library (clang
it's linker wrapper), , dynamically load them. llc
step fails of methods compiling!
step 1: llvm-link
: merge many bitcode files
i may have many functions calling each other, llvm-link
different bitcode files might interact each other. step has no issues. example:
llvm-link function1.bc function2.bc -o lnk.bc
step 2: opt
: run optimization passes
for using following:
opt -o3 lnk.bc -o opt.bc
this step proceeds no issues, that's 1 causes problem! also, it's necessary because in future need step pass passes, e.g. loop-unroll
step 3: llc
: generate machine code (pic)
i using following command:
llc -march=thumb -arm-reserve-r9 -mcpu=cortex-a9 -filetype=obj -relocation-model pic opt.bc -o obj.o
i have kept arch specific flags i've set in case contribute issue. using position independent code
because on next step building shared object
. command fails error i've written on top of answer.
step 4: clang
: generate shared object
for cases step 3
fails, step isn't reached. if llc
succeeds, step succeed too!
additional information
configuration
the following run on llvm3.6, runs on arm
device.
things i've noticed
- if omit
-o3
(or other level)opt
step,llc
work. - if don't, , instead omit them
llc
,llc
still fail. makes me thinkopt -o<level>
causing issue. - if use
llc
directly work, won't able run specific passesopt
allows me, not option me. - i've faced issue only 2 functions i've compiled far (from original mir), use loops. others produce working code!
- if don't use
pic
model @llc
, can generateobj.o
, i'll have problems creating.so
it!
questions
why happening??!!
why
opt
has-relocation-model
option? isn't supposedllc
thing? i've tried setting both @opt
,llc
pic
, still fails.i using
clang
because has wrapper linker the.so
. there way step llvm tool instead?
first of all, not use neither llc nor opt. these developer-side tools should never used in production environment. instead of this, implement own proper optimization , codegeneration runtime via llvm libraries.
as particular bug - thumb codegenerator might contain bugs. please reduce problem , report it. or don't use thumb mode @ :)
Comments
Post a Comment