This provides a functional rumpdisk and rumpusbdisk
with or without static linkage of librump.

TESTED:
  - opens usb stick with both dynamic and static rumpusbdisk.
  - boots off ahci with static rumpdisk

---
 Makeconf          |  4 ++--
 rumpdisk/Makefile | 18 +++++++++++++-----
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/Makeconf b/Makeconf
index 7585260d..288e7daa 100644
--- a/Makeconf
+++ b/Makeconf
@@ -349,7 +349,7 @@ $(progtarg): %$(target-suffix): $(BUGADDR)
 
 $(addsuffix .static,$(progtarg)): %$(target-suffix).static: $(BUGADDR)
        $(link-executable) -static \
-             '-Wl,-(' $(patsubst %.so,%.a,$^) $($*-LDLIBS) $(LDLIBS) \
+             '-Wl,-(' $(patsubst %.so,%.a,$^) $($*.static-LDLIBS) $(LDLIBS) \
              '-Wl,-)' \
              $(and $(filter %/libstore_part.a,$^), $(PARTED_LIBS))
 endif
@@ -359,7 +359,7 @@ $(addsuffix .prof,$(progtarg)): %$(target-suffix).prof: 
$(BUGADDR)
        $(CC) -pg $(CFLAGS) $($*-CFLAGS) $(LDFLAGS) $($*-LDFLAGS) \
                $(BUGADDR_REF) -static \
                -o $@ \
-               '-Wl,-(' $^ $($*-LDLIBS) $(LDLIBS) \
+               '-Wl,-(' $^ $($*.static-LDLIBS) $(LDLIBS) \
                '-Wl,-)'
 
 ifeq ($(makemode),library)
diff --git a/rumpdisk/Makefile b/rumpdisk/Makefile
index a0f6d1ac..de33c65d 100644
--- a/rumpdisk/Makefile
+++ b/rumpdisk/Makefile
@@ -26,8 +26,11 @@ ifneq (,$(wildcard ../config.make))
  include ../config.make
 endif
 
+# TODO: install .so version of rumpvfs_nofifofs so we don't have to do this!
 ifeq ($(HAVE_LIBRUMP_VFSNOFIFO),yes)
-RUMPLIBS += rumpvfs_nofifofs
+RUMPSTATIC=-Wl,--whole-archive -lrumpvfs_nofifofs_pic -Wl,--no-whole-archive
+else
+RUMPSTATIC=
 endif
 
 dir := rumpdisk
@@ -37,19 +40,24 @@ SRCS = main.c block-rump.c
 LCLHDRS = block-rump.h ioccom-rump.h
 targets = rumpdisk rumpusbdisk
 HURDLIBS = machdev ports trivfs shouldbeinlibc iohelp ihash fshelp irqhelp
-LDLIBS += -lpthread -lpciaccess -ldl $(RUMPEXTRA:%=-l%_pic) \
-         -Wl,--whole-archive $(RUMPLIBS:%=-l%_pic) -Wl,--no-whole-archive
+LDLIBS += -lpthread -lpciaccess -ldl -lz
 
 %.disk.o: %.c
        $(CC) $(CFLAGS) $(CPPFLAGS) -D_RUMP_SATA -c $< -o $@
 rumpdisk-OBJS = $(SRCS:.c=.disk.o)
-rumpdisk-LDLIBS += -Wl,--whole-archive $(RUMPSATA:%=-l%_pic) 
-Wl,--no-whole-archive $(HURDLIBS:%=-l%)
+rumpdisk-LDLIBS += $(HURDLIBS:%=-l%) $(RUMPSTATIC) $(RUMPEXTRA:%=-l%) \
+               -Wl,--no-as-needed $(RUMPSATA:%=-l%) $(RUMPLIBS:%=-l%) 
-Wl,--as-needed
+rumpdisk.static-LDLIBS += $(HURDLIBS:%=-l%) $(RUMPSTATIC) 
$(RUMPEXTRA:%=-l%_pic) \
+               -Wl,--whole-archive $(RUMPSATA:%=-l%_pic) $(RUMPLIBS:%=-l%_pic) 
-Wl,--no-whole-archive
 rumpdisk rumpdisk.static: $(rumpdisk-OBJS)
 
 %.usb.o: %.c
        $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
 rumpusbdisk-OBJS = $(SRCS:.c=.usb.o)
-rumpusbdisk-LDLIBS += -Wl,--whole-archive $(RUMPUSB:%=-l%_pic) 
-Wl,--no-whole-archive $(HURDLIBS:%=-l%)
+rumpusbdisk-LDLIBS += $(HURDLIBS:%=-l%) $(RUMPSTATIC) \
+               -Wl,--no-as-needed $(RUMPUSB:%=-l%) $(RUMPLIBS:%=-l%) 
-Wl,--as-needed
+rumpusbdisk.static-LDLIBS += $(HURDLIBS:%=-l%) $(RUMPSTATIC) \
+               -Wl,--whole-archive $(RUMPUSB:%=-l%_pic) $(RUMPLIBS:%=-l%_pic) 
-Wl,--no-whole-archive
 rumpusbdisk rumpusbdisk.static: $(rumpusbdisk-OBJS)
 
 include ../Makeconf
-- 
2.45.2



Reply via email to