unikraft / static-pie-apps

Built Linux applications (static-pie) for Unikraft binary compatibility mode
7 stars 40 forks source link

Add dlang helloworld static PIE example #7

Open RazorBest opened 2 years ago

RazorBest commented 2 years ago

This requires the DMD compiler to run. Statically linked with the phobos runtime library and pthread.

Phobos needed the __tls_get_addr symbol, so that was substituted by a dummy.

RazorBest commented 2 years ago

I wasn't able to replicate your setup. Please add a README.md file documenting how dmd and and libphobos2 should be installed. I installed dmd but wasn't able to install libphobos2.

I did make everything work using just gdc:

gdc -fPIC -static-pie -o helloworld helloworld.d dummy.c

Is there a reason why you didn't go for the gdc option?

I installed dmd and phobos by downloading the package from the oficial website. After looking at the verbose output when linking with dmd, it showed that it was using libphobos2 on my system.

As to why I was using dmd, it seemed to be more documented on the main page. But I'll change the Makefile to use gdc.