Sky Flyer via llvm-dev
2015-Oct-13 09:19 UTC
[llvm-dev] ELF object writing from assembly file
Hi all, I have implemented AsmParser, CodeEmitter, and ELF object writing. AsmParser and CodeEmitter are tested and working fine, but I would like to see ELF objects build out of a parsed asm file. Is that possible? I tried this commands, but it didn't work corrctly: *llvm-mc -filetype=obj -arch=test file.s -o=a.o* and I think after an obj file is built, I should use this command but I am not sure! *llvm-objdump -arch=test a.o* Cheers, ES -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151013/082784f9/attachment.html>
Sky Flyer via llvm-dev
2015-Oct-13 09:21 UTC
[llvm-dev] ELF object writing from assembly file
(corrector) I think for reading obj file it should be: *llvm-readobj -arch=test a.o* On Tue, Oct 13, 2015 at 11:19 AM, Sky Flyer <skylake007 at googlemail.com> wrote:> Hi all, > > I have implemented AsmParser, CodeEmitter, and ELF object writing. > AsmParser and CodeEmitter are tested and working fine, but I would like to > see ELF objects build out of a parsed asm file. Is that possible? > > I tried this commands, but it didn't work corrctly: > > *llvm-mc -filetype=obj -arch=test file.s -o=a.o* > > and I think after an obj file is built, I should use this command but I am > not sure! > > *llvm-objdump -arch=test a.o* > > Cheers, > ES >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151013/0b97d992/attachment.html>
Tim Northover via llvm-dev
2015-Oct-13 13:02 UTC
[llvm-dev] ELF object writing from assembly file
On 13 October 2015 at 02:19, Sky Flyer via llvm-dev <llvm-dev at lists.llvm.org> wrote:> I tried this commands, but it didn't work corrctly: > > llvm-mc -filetype=obj -arch=test file.s -o=a.oThat looks right to me ("-triple test-elf" might be more robust and work if you're coding on OS X or Windows).> and I think after an obj file is built, I should use this command but I am > not sure! > > llvm-objdump -arch=test a.oEither llvm-objdump or llvm-readobj will work. llvm-readobj tends to produce lower level information, while llvm-objdump is more user-friendly. They ought to mostly work on the generic information without changes. If you want "-d" (disassemble) to work, you're going to have to implement a Disassembler in your target too. Tim.
Sky Flyer via llvm-dev
2015-Oct-15 11:38 UTC
[llvm-dev] ELF object writing from assembly file
Thanks a lot Tim. I am getting an error which says: "LLVM ERROR: unable to write nop sequence of 0 bytes" Is there any way that I can print out the Obj code (I mean bitstream representation of the assembly code which is going to be placed in the ELF file), before making any ELF file? Cheers, ES On Tue, Oct 13, 2015 at 3:02 PM, Tim Northover <t.p.northover at gmail.com> wrote:> On 13 October 2015 at 02:19, Sky Flyer via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > I tried this commands, but it didn't work corrctly: > > > > llvm-mc -filetype=obj -arch=test file.s -o=a.o > > That looks right to me ("-triple test-elf" might be more robust and > work if you're coding on OS X or Windows). > > > and I think after an obj file is built, I should use this command but I > am > > not sure! > > > > llvm-objdump -arch=test a.o > > Either llvm-objdump or llvm-readobj will work. llvm-readobj tends to > produce lower level information, while llvm-objdump is more > user-friendly. They ought to mostly work on the generic information > without changes. > > If you want "-d" (disassemble) to work, you're going to have to > implement a Disassembler in your target too. > > Tim. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151015/0b0863ae/attachment-0001.html>