[llvm-dev] How to generate .bc file using configure && make on Mac OS X?

Jakub (Kuba) Kuderski via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 28 10:23:17 PST 2019


I did a sanity check and run some of the bitcode I complied with gllvm and
it seems to work fine under lli. The only issues is to make sure you load
all the (external) libraries the bitcode needs. I highly suggest you run a
debug version of lli under a debugger and see what exactly happens.

On Mon, Jan 28, 2019 at 12:45 PM Peng Yu <pengyu.ut at gmail.com> wrote:

> It seems that it does not really work. When I run the generated .bc
> file, it gives me the following error. Do you what is wrong?
>
> $ lli bash.bc
> Stack dump:
> 0.    Program arguments: lli bash.bc
> 0  lli                      0x0000000105153922
> llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
> 1  lli                      0x0000000105153d26 SignalHandler(int) + 200
> 2  libsystem_platform.dylib 0x00007fff7d6daf5a _sigtramp + 26
> 3  libsystem_platform.dylib 0x00007ffeeb06cb20 _sigtramp + 1838750688
> 4  lli                      0x0000000104ed5045
> llvm::MCJIT::runFunction(llvm::Function*,
> llvm::ArrayRef<llvm::GenericValue>) + 535
> 5  lli                      0x0000000104e67ae7
> llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*,
> std::__1::vector<std::__1::basic_string<char,
> std::__1::char_traits<char>, std::__1::allocator<char> >,
> std::__1::allocator<std::__1::basic_string<char,
> std::__1::char_traits<char>, std::__1::allocator<char> > > > const&,
> char const* const*) + 1159
> 6  lli                      0x0000000104b94b84 main + 9104
> 7  libdyld.dylib            0x00007fff7d3cc015 start + 1
> Segmentation fault: 11
>
> On Mon, Jan 28, 2019 at 10:40 AM Jakub (Kuba) Kuderski
> <kubakuderski at gmail.com> wrote:
> >>
> >> but doesn't emit optnone and nounwind attributes
> >
> > s/nounwind/noinline
> >
> > On Mon, Jan 28, 2019 at 11:35 AM Jakub (Kuba) Kuderski <
> kubakuderski at gmail.com> wrote:
> >>
> >> As far as I understand, gllvm doesn't run LTO pipeline or any
> cross-module optimization, and the optimization level provided is only used
> to compile each Translation Unit separately.
> >> If you want to have LTO-like build, you can first run gllvm with `-O3
> -Xclang -disable-llvm-optzns` (builds code with no optimizations, but
> doesn't emit optnone and nounwind attributes) and later run opt on the
> final bitcode. Note that the results might not be the same as running a
> proper LTO build because of different pass manager pipelines.
> >>
> >> On Mon, Jan 28, 2019 at 11:24 AM Peng Yu <pengyu.ut at gmail.com> wrote:
> >>>
> >>> This works great.
> >>>
> >>> > You can also try using the gllvm wrapper:
> https://github.com/SRI-CSL/gllvm ; it's quite reliable and easy to use in
> my experience.
> >>>
> >>> Just to be sure. Only one version of bc file will be generated that
> >>> corresponds to the compiler options provide at configure?
> >>>
> >>> The original approach using ld.gold will provide several .bc files
> >>> that correspond to different stages of the optimization.
> >>>
> >>> I think using gllvm, I need to specify the corresponding -O? option to
> >>> the correct optimization stage of the bc file? Thanks.
> >>>
> >>> --
> >>> Regards,
> >>> Peng
> >>
> >>
> >>
> >> --
> >> Jakub Kuderski
> >
> >
> >
> > --
> > Jakub Kuderski
>
>
>
> --
> Regards,
> Peng
>


-- 
Jakub Kuderski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190128/96112ac6/attachment.html>


More information about the llvm-dev mailing list