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>
Tim Northover via llvm-dev
2015-Oct-15 16:14 UTC
[llvm-dev] ELF object writing from assembly file
On 15 October 2015 at 04:38, Sky Flyer <skylake007 at googlemail.com> wrote:> I am getting an error which says: "LLVM ERROR: unable to write nop sequence > of 0 bytes"Sounds like you need to implement "writeNopData" from the AsmBackend.> 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?I think it's only really produced on demand while writing the ELF file. You might look at the output of "llc -debug", which shows some of the intermediate data structures, none of them are really just the instruction bits. Cheers. Tim.
Sky Flyer via llvm-dev
2015-Oct-19 09:13 UTC
[llvm-dev] ELF object writing from assembly file
Hello Tim, In the writeNopData, I changed the return value to true, and now everything is fine! Thanks a lot for your help. Cheers, ES On Thu, Oct 15, 2015 at 6:14 PM, Tim Northover <t.p.northover at gmail.com> wrote:> On 15 October 2015 at 04:38, Sky Flyer <skylake007 at googlemail.com> wrote: > > I am getting an error which says: "LLVM ERROR: unable to write nop > sequence > > of 0 bytes" > > Sounds like you need to implement "writeNopData" from the AsmBackend. > > > 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? > > I think it's only really produced on demand while writing the ELF > file. You might look at the output of "llc -debug", which shows some > of the intermediate data structures, none of them are really just the > instruction bits. > > Cheers. > > Tim. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151019/064e6d81/attachment.html>