Skip to content

alexchandel/ld9

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ld9

A crude cross-linker from OS X to Plan 9.

It reads a Mach-O into memory, checks that it isn't dynamically linked, and blindly copies bytes into a Plan 9 executable.

The goal of this is to provide a means to targeting Plan 9 with Rust, similar to how Rust targets Android. Ideally, Plan 9 support will be added to mahkoh's rlibc, allowing most of libstd to be ported to Plan 9.

Build

Run the commands:

cargo build --release

The executable will be placed at target/release/ld9

Example

Using the following file, named crt0.s:

.globl start

start:
    mov     $8, %eax
    int     $0x40
    jmp start

Run the commands:

clang -static -fPIC -c crt.s
ld -static -o main crt.o
ld9

This will produce a Plan 9 executable called aout9 that, when run on Plan 9, immediately calls exits.

Todo

  • ELF support. I used Mach-O because that's what I'm running, but this should work for static ELFs too.

About

The outline of a cross-linker from OS X to Plan 9.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages