[llvm-dev] How to convert assembly code to executable

Balasaheb Dabhade via llvm-dev llvm-dev at lists.llvm.org
Wed May 4 06:33:12 PDT 2016


Thanks a lot Paulr !!


On Mon, May 2, 2016 at 11:16 PM, Robinson, Paul <paul.robinson at sony.com>
wrote:

> Please make sure to "reply all" so the whole email conversation appears on
> the list.
>
>
>
> The [additional library locations] and [additional include location]
> specify where your Alpha-target headers and libraries are. I can't help you
> find those places; they don't come with clang/LLVM.  If you don't specify
> them, you should also leave out the preceding –L and –I options.  In fact
> you shouldn't need –I at all if you are compiling assembler source.
>
> You can look at gcc documentation for help with these options if you are
> unfamiliar with them; they work exactly the same way in clang.
>
> Not sure where you got "-mllvm –Wall" that looks very odd and you don't
> really need it.
>
> I wouldn't bother with –g when trying to compile assembler source.
>
> That leaves us with:
>
>
>
> clang matrix.s –L. –Wl,pie –o matrix.out
>
>
>
> Assuming you have an appropriate linker, that might be enough.  If your
> linker can't handle Alpha objects, you will need to find one; I can't help
> you there.
>
> --paulr
>
>
>
> *From:* Balasaheb Dabhade [mailto:dabhadebalasaheb at gmail.com]
> *Sent:* Monday, May 02, 2016 10:27 AM
> *To:* Robinson, Paul
> *Subject:* Re: [llvm-dev] How to convert assembly code to executable
>
>
>
> Thanks Paulr,
>
>
>
> Yes, I am using old version of LLVM(2.8) for alpha target. I wanted to do
> some analysis on assembly code and then generate executable
> from assembly code.
>
>
>
> I was looking for exact command to generate executable for assembly code.
> I got following commands from stackoverflow:
>
> clang matrix.s -L [additional library locations] -mllvm -Wall -g -L. -Wl,-pie -I. -I[additional include locations] -o [executable output]
>
> but I am not sure what to put in place of library location, I tried
> following command
>
> (matrix.s is my assembly code file) :
>
>
>
> #clang matrix.s -L -mllvm -Wall -g -L. -Wl,-pie -I. -I -o matrix.out
>
>
>
> getting below error :
>
> clang: error: no such file or directory: 'matrix.out'
>
>
>
> Could you please let me know the exact commands to generate assembly code
> to executable for alpha target which include linking as well?
>
>
>
> Thanks,
>
> Bala
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Mon, May 2, 2016 at 9:24 PM, Robinson, Paul <paul.robinson at sony.com>
> wrote:
>
> If you add "-filetype=obj" to your llc command, I'd expect you to get an
> object file instead of assembly source.
>
> After that you would need to run it through a linker for your alpha target.
>
>
>
> (The last LLVM release with an Alpha target was 3.0, I guess you are using
> a really old version of LLVM? Or maintaining it as an out-of-tree target?)
>
> --paulr
>
>
>
>
>
> *From:* llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] *On Behalf Of *Balasaheb
> Dabhade via llvm-dev
> *Sent:* Monday, May 02, 2016 7:27 AM
> *To:* llvm-dev at lists.llvm.org
> *Subject:* [llvm-dev] How to convert assembly code to executable
>
>
>
> Hello All,
>
>
>
> I have converted c program into assembly code for alpha target using
> following commands
>
> clang -emit-llvm matrix.c -c -o matrix.bc
>
> llc -march=alpha matrix.bc -o matrix.s
>
> Now how to convert matrix.s assembly file into executable file of alpha
> target?
>
> Any help is appreciated
>
> Thanks in advance !!
>
> Thanks,
>
> Bala
>
>
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160504/8ad01fc9/attachment-0001.html>


More information about the llvm-dev mailing list