Hi all, I am doing emulation on a custom processor. For this I need hexcode for the C application program . Is there any llvm command/function that can spit out the hexcode just like objdump in gcc? Thanks -- View this message in context: http://old.nabble.com/hexcode-from-llvm-tp28612686p28612686.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
On May 19, 2010, at 12:01 PM, JayaSus wrote:> > Hi all, > > I am doing emulation on a custom processor. For this I need hexcode for the > C application program . Is there any llvm command/function that can spit out > the hexcode just like objdump in gcc? >Hi JayaSus, I'm confused by your question. Do you mean the LLVM IR "object code" or the resulting native object code generated by the assembler (after code generation) for the target platform? If the latter, then your objdump tools should work with that. -bw
Wild guess from microcontroller-land: Do you mean you need an Intel HEX file? LLVM doesn't know anything about that. Reid On Wed, May 19, 2010 at 5:53 PM, Bill Wendling <wendling at apple.com> wrote:> On May 19, 2010, at 12:01 PM, JayaSus wrote: > >> >> Hi all, >> >> I am doing emulation on a custom processor. For this I need hexcode for the >> C application program . Is there any llvm command/function that can spit out >> the hexcode just like objdump in gcc? >> > Hi JayaSus, > > I'm confused by your question. Do you mean the LLVM IR "object code" or the resulting native object code generated by the assembler (after code generation) for the target platform? If the latter, then your objdump tools should work with that. > > -bw > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Hi Bill Wendling. I am trying to get a hexcode as shown below for mips processor using llvm Disassembly of section .text: 00000000 <main>: 0: 27bdffe8 addiu sp,sp,-24 4: afbe0010 sw s8,16(sp) 8: 03a0f021 move s8,sp c: 24020004 li v0,4 10: afc20008 sw v0,8(s8) 14: 24020005 li v0,5 18: afc20004 sw v0,4(s8) 1c: 8fc30008 lw v1,8(s8) 20: 8fc20004 lw v0,4(s8) 24: 00000000 nop 28: 00621021 addu v0,v1,v0 2c: afc20000 sw v0,0(s8) 30: 03c0e821 move sp,s8 .... Is there any pass or buildin command for llvm to generate this. llvm-dis will only generate the assembly code and not the hexcode. Moreover how can I compile c code for mips using llvm-gcc? llvm-gcc -b mips t.c complains it wouldn't know the -b option. Thanks Bill Wendling-2 wrote:> > On May 19, 2010, at 12:01 PM, JayaSus wrote: > >> >> Hi all, >> >> I am doing emulation on a custom processor. For this I need hexcode for >> the >> C application program . Is there any llvm command/function that can spit >> out >> the hexcode just like objdump in gcc? >> > Hi JayaSus, > > I'm confused by your question. Do you mean the LLVM IR "object code" or > the resulting native object code generated by the assembler (after code > generation) for the target platform? If the latter, then your objdump > tools should work with that. > > -bw > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-- View this message in context: http://old.nabble.com/hexcode-from-llvm-tp28612686p28628721.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
sorry keep forgetting to send to list instead of last person who replied :( On Fri, May 21, 2010 at 1:18 PM, JayaSus <jayasnair at gmail.com> wrote:> > Hi Bill Wendling. > I am trying to get a hexcode as shown below for mips processor using llvm > > Disassembly of section .text: > > 00000000 <main>: > 0: 27bdffe8 addiu sp,sp,-24 > 4: afbe0010 sw s8,16(sp) > 8: 03a0f021 move s8,sp > c: 24020004 li v0,4 > 10: afc20008 sw v0,8(s8) > 14: 24020005 li v0,5 > 18: afc20004 sw v0,4(s8) > 1c: 8fc30008 lw v1,8(s8) > 20: 8fc20004 lw v0,4(s8) > 24: 00000000 nop > 28: 00621021 addu v0,v1,v0 > 2c: afc20000 sw v0,0(s8) > 30: 03c0e821 move sp,s8 > .... > > Is there any pass or buildin command for llvm to generate this. llvm-dis > will only generate the assembly code and not the hexcode.This is not done by llvm, you create native assembly from the llvm IR then assemble that and then you can use objdump to get your hexcode just like from gcc. LLVM does not deal with native code, it uses llvm IR, llvm-dis is simply a converter from the bitcode format of the IR to the human readable assembly text format of the IR.> > Moreover how can I compile c code for mips using llvm-gcc? llvm-gcc -b mips > t.c complains it wouldn't know the -b option. >You might want -march or other -m options...