Can I generate LLVM bytecode with Rubinius and run it with lli? - llvm

I've tried running rbx compile but I am not quite sure what to do with the output. I would like to run it with lli, but I get the following error.
$ lli hello.rbc
lli: hello.rbc:2:1: error: expected '=' here
18185007515559028006
^

You don't run Rubinius byte-compiled code with lli because the .rbc file isn't an LLVM executable. Instead, you run it with a special Rubinius method call that handles pre-compiled bytecode for the Rubinius virtual machine. For example:
rbx -I. -e "Rubinius::CodeLoader.require_compiled 'hello'"
See Running Ruby With No Ruby for more details.

Related

Problem with the Tool Flags during the c++ module compilation

I'm trying to compile the module in Eclipse and generate the additional output disassembles
I've added these Tool Flags
-fverbose-asm -Wa,-adhln -save-temps=obj > %OutFile%.asm
But I receive this error
clang: error: unsupported argument '-adhln' to option 'Wa,'
Does anybody had a similar issue? If so please help
Many Thanks
OK so the target was to generate the assemblies with the instructions HEX and relative addresses
I was not able to do that using Eclipse >> Tool Flags so I simply left one flag:
-save-temps=obj
Which generates AT&T systax assemblies but without details like (instruction Hex or relative address)
But I've managed to generate INTEL syntax assemblies with all the details I need to debug my problem using objdump
objdump -d -M intel -S DMAProcesor.o > DMAProcessor.asm

How to use the -pgo-instr-gen arguments with llvm opt

I want to test the PGO with llvm and I find most of the tutorial in the internet uses clang with argument -fprofile-instr-use to enable PGO instrumentation. However, what I have is an llvm bitcode file instead of the source code and I want to apply PGO to these bitcode files. I noticed the opt tool has the argument -pgo-instr-gen.
However, after I applied it to my bitcode like:
opt -pgo-instr-gen input.ll -o output.ll
and then tried to run the output.ll with lli, I got a segmentation fault. So, what is the correct way to enable PGO in such cases?

GDB list shows nothing

A program compiled with arm-linux-gnueabi-gcc -g3 main.c .
$ gdb a.out
$ l
$ main.c: No such file or directory.
It is unable to display program lines with line number. let me know If i am missing something ?
However I am able to run program , with run command even backtrace I am able to get.
My issue is same as gdb can not load source file?
but , GDB version 7.8.
GDB needs source code to be present on same machine as in where binary been run.
mine was cross compilation , I was running program on different host . That's why I had that issue.

OCaml memory profiling with Memprof - TypeRex Utility

My program uses all of available memory, so I wanted to check which functions and abstracts are spoiling my project. I decided to use Memprof, so I installed their compiler and compiled my code with command
ocamlfind ocamlopt -package xml-light unix.cmxa str.cmxa -c -g NKJPxmlbasics.ml NKJP.mli NKJP.ml test.ml
and then run as suggested in tutorial
ocp-memprof --exec ./test
But there is error instead of result:
Error: no memory profiling information found. Possible causes:
- the application was not compiled with memory profiling support;
- the application exited before any major garbage collection was performed.
I even managed once to make it work but I have no idea how it happened
http://memprof.typerex.org/users/97beffbaec332eb7b2a048b94f7a38cf/2015-12-15_17-33-50_ab17218e800fe0a68fc2cfa54c13bfa6_16194/index.html
Is there any way to use this tool properly in this situation? What am I missing?
ocamlfind ... -c ... does not generate any executable. So, the ./test that you are running was probably generated by a previous command, probably without the memprof switch.

OCaml compiler build failure

I checkout the latest OCaml source code and try to build on my OS X 10.10 machine
with gcc 4.9.2. I use the following command as suggested here.
$ ./configure && make world
Build gets no error but when I tried the compiler I just build by doing $ ./ocamlc, I get the following error:
Fatal error: unknown C primitive `caml_add_debug_info'
I believe this happens when you use the old bytecode interpreter to run the new compiler. Make sure you're using the new bytecode interpreter (ocamlrun).