On 27 May 2015 at 10:12, Martin Lucina <[email protected]> wrote: >> How hard can it be? We replace ld with a script that: >> 1) records the parameters passed to it to the target file >> 2) calls real_ld with those arguments with a minimal component >> config to test that the "userspace" side links, and throws away the >> result >> >> And, for real linking (rumpbake) we look up the arguments from the >> file and use the full component configuration for the target. >> Anyway, I need to play around with it. I already forgot why I >> haven't done so yet. > > *Inspiration* I thought about throwing away the result, not sure why I > discarded that option. That might work. > > I've played around briefly. What I think we want is: > > 1) two sets of compiler specs, "ferment" and "bake". > 2) the userspace ld (well, gcc) uses the "ferment" specs and performs the > following steps: > a) ld -r -o <target file> <userspace objects and libraries> > b) real_ld -o /tmp/whatever <target file> <minimal rump components> > c) if b) failed, stop. > 3) rumpbake performs the following steps: > a) real_ld (using "bake" specs) -o <unikernel image> <target file from > step 2a> <selected rump components> ... > > For step 2b) to work correctly we'll need to make some parts of > librumprun_base weak (at least _rumprun_(de)config) and link in stubs to > avoid pulling in -lrumpnet*. > > The reason step 2a) uses ld -r is that otherwise in step 3a) we'd need to > be sure that all of the application object files and libraries are still > present and identical. > > For additional kudos, step 2a) can link in some kind of fake object file > describing the output so that rumpbake can tell whether or not what you're > baking is compatible with what you fermented :) > > From the user's point of view the process would look like this: > > i686-rumprun-netbsdelf-gcc -o hello hello.c > rumpbake -T i686-generic -o hello.bin hello > rumprun kvm ./hello.bin
What is the case for not just having a linker that accepts more options like -Wl,--rumprun-xen or -Wl,--rumprun-kvm in order to decide what to do? Justin
