libjit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libjit] Does libjit assume gnu binutils objdump available?


From: Jakob Löw
Subject: Re: [Libjit] Does libjit assume gnu binutils objdump available?
Date: Tue, 19 Feb 2019 09:10:55 +0100

Hey,

the corresponding function is in jit-dump.c [0].
objdump and as are used to disassemble the instructions. On windows the
instructions are first written to C:/tmp/libjit-dump.s then assembled
to C:/tmp/libjit-dump.o, sou you could just run
   objdump C:/tmp/libjit-dump.o
however these files are unlinked before the function exits, so maybe
you want to modify the function instead.

the --adjust-vma= option simply makes the outputted addresses match the
actual in-memory addresses.

- Jakob

[0] http://git.savannah.gnu.org/cgit/libjit.git/tree/jit/jit-dump.c#n68
3

On Tue, 2019-02-19 at 00:46 -0600, Peng Yu wrote:
> Hi,
> 
> I got the following error when I run the following libjit test
> program. My objdump is from LLVM (as the OS is Mac OS X.) Does libjit
> assume objdump is from gnu binutils?
> 
> Where is the tempfile of the binary code that feeds to objdump? Maybe
> I can disassemble myself with the appropriate command on Mac OS X?
> 
> $ .main.exe
> function F [uncompiled](i1 : int, i2 : int) : int
>       incoming_reg(i1, rdi)
>       incoming_reg(i2, rsi)
> .L:
>       i5 = i1 + i2
>       return_int(i5)
>       ends_in_dead
> .L:
> .L:
> end
> 
> function F [compiled](int, int) : int
> objdump: Unknown command line argument '--adjust-vma=4419748168'.
> Try: 'objdump -help'
> objdump: Did you mean '-dsym=4419748168'?
> 
> end
> 
> $ objdump  --help |head -n 1
> OVERVIEW: llvm object file dumper
> 
> 
> #include <stdio.h>
> #include <jit/jit.h>
> #include <jit/jit-dump.h>
> #include <stdlib.h>
> 
> int main(int argc, char *argv[]) {
>       jit_context_t context = jit_context_create();
>       jit_context_build_start(context);
> 
>       jit_type_t params[2];
>       params[0] = jit_type_int;
>       params[1] = jit_type_int;
>       unsigned int num_params = 2;
>       int incref = 1;
>       jit_type_t signature = jit_type_create_signature(jit_abi_cdecl,
> jit_type_int, params, num_params, incref);
> 
>       jit_function_t F = jit_function_create(context, signature);
>       jit_type_free(signature);
> 
>       jit_value_t x = jit_value_get_param(F, 0);
>       jit_value_t y = jit_value_get_param(F, 1);
>       jit_value_t r = jit_insn_add(F, x, y);
>       jit_insn_return(F, r);
> 
>       jit_dump_function(stdout, F, "F [uncompiled]");
>       jit_function_compile(F);
>       jit_dump_function(stdout, F, "F [compiled]");
> 
>       jit_context_build_end(context);
> 
>       jit_context_destroy(context);
> 
>       return 0;
> }
> 
> 
> 

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]