Posts

Showing posts from June, 2019

Hello World!

Image
News on the GSOC project! I've been able to get "Hello world!" working! Here are my notes on the process of getting it to this point. Figuring Out the Right Approach On Sunday, I had a discussion on #moarvm with mornfall , nine , and brrt about the path forward I suggested in last week's update. Mornfall pointed out that replacing _start would likely be way more headache than it was worth. They instead suggested using objcopy to convert a text file containing the MBC bytecode into a .o file (also called relocatable ELF file), and then writing a small C program which invokes MoarVM using the bytecode packaged in the .o file. This is essentially the approach I used for my first attempt, with a few tweaks. As pointed out by nine, it currently isn't possible to directly call moar and have it execute MBC. If you try, you'll be greeted with this error message: Nine mentioned  that there is good deal of necessary setup that is done when perl6 is calle

Building an ELF File

Image
This is the next installment in my GSoC project! This week, attempting to make an ELF file! The most useful resource for me in working on this bit (besides the always helpful Linkers & Loaders by Levine) has been this  hello world ELF tutorial  which has you generate an ELF executable file and then walks you through some of its components. If you want a more general overview of ELF files before diving into the nitty gritty of that tutorial, I recommend  this guide . It doesn't go as in depth, but is a bit easier to read than the tutorial and gives you enough information to follow along easily with the next bits without having to look through an ELF file yourself. My initial approach was to use the .interp section to call perl6 to interpret arbitrary source code included in the .text section, rather than using the system's standard loader, ld-linux.so. This approach did not wind up working, but the method used to create the ELF header and program section headers will be

The Linker for Perl 6

As mentioned in my last post, I'm working on making a linker for Perl 6 user programs as part of the Google Summer of Code. I'll be making weekly progress updates here explaining what I've done and  In this post, I'm going to cover why a linker is useful/what a linker is, how I'm approaching the project, and what progress I've made so far. I'm learning a lot of this as I go, so if you see something that's confusing or incorrect, please let me know so I can fix it! What does a linker do? The TLDR version is that a linker is what takes all the object files generated by compilation, resolves the calls to functions in libraries and other files, and combines them into a single executable file. Being able to generate this single executable file is extremely useful as it means that once the program has been "translated" from whatever language it was written in into bytecode and grouped into an executable order, you can run that program over and