Skip to contentSkip to conversation

minios: make mini-os_app.o depend on included xen libraries

PATCH In review Juergen Gross 3 participants 6 messages Sep 27, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 minios: make mini-os_app.o depend on included xen libraries

When building Mini-OS with an app which is using xen libraries like libxenguest.a let mini-os_app.o depend on the library binaries as it is statically linked with them.

While at it add "-T" before app.lds for linking mini-os_app.o to avoid a linker warning.

---
 Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
Makefile +9 -2
index 81b936f..1d2324c 100644
@@ -125,11 +125,18 @@ OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS))
 ifeq ($(libc),y)
 ifeq ($(CONFIG_XC),y)
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog -whole-archive -lxentoollog -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog/libxentoollog.a
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn -whole-archive -lxenevtchn -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn/libxenevtchn.a
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab -whole-archive -lxengnttab -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab/libxengnttab.a
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call -whole-archive -lxencall -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call/libxencall.a
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/foreignmemory -whole-archive -lxenforeignmemory -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/foreignmemory/libxenforeignmemory.a
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH) -whole-archive -lxenguest -lxenctrl -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)/libxenctrl.a
+LIBS += $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)/libxenguest.a
 endif
 APP_LDLIBS += -lpci
 APP_LDLIBS += -lz
@@ -141,8 +148,8 @@ ifneq ($(APP_OBJS)-$(lwip),-y)
 OBJS := $(filter-out $(OBJ_DIR)/daytime.o, $(OBJS))
 endif
 
-$(OBJ_DIR)/$(TARGET)_app.o: $(APP_OBJS) app.lds
-	$(LD) -r -d $(LDFLAGS) -\( $^ -\) $(APP_LDLIBS) --undefined main -o $@
+$(OBJ_DIR)/$(TARGET)_app.o: $(APP_OBJS) app.lds $(LIBS)
+	$(LD) -r -d $(LDFLAGS) -\( $(APP_OBJS) -T app.lds -\) $(APP_LDLIBS) --undefined main -o $@
 
 ifneq ($(APP_OBJS),)
 APP_O=$(OBJ_DIR)/$(TARGET)_app.o 
Signature · 7 lines
2.6.6


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 17 lines · Juergen Gross

When building Mini-OS with an app which is using xen libraries like libxenguest.a let mini-os_app.o depend on the library binaries as it is statically linked with them.

While at it add "-T" before app.lds for linking mini-os_app.o to avoid a linker warning.

---
 Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
Makefile +0 -0
index 81b936f..1d2324c 100644

Makefile OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS)) · line 128

Quoted 4 lines
Makefile +1 -0
@@ -125,11 +125,18 @@ OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS))
 ifeq ($(libc),y)
 ifeq ($(CONFIG_XC),y)
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog -whole-archive -lxentoollog -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog/libxentoollog.a

I don't follow. Why is the original APP_LDLIBS not enough?

The new dependency doesn't seem to generate any new rules. What do I miss?

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 13 lines · Wei Liu
Quoted 12 lines · Juergen Gross

When building Mini-OS with an app which is using xen libraries like libxenguest.a let mini-os_app.o depend on the library binaries as it is statically linked with them.

While at it add "-T" before app.lds for linking mini-os_app.o to avoid a linker warning.

---
 Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
Quoted 11 lines

Makefile OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS)) · line 128

Quoted 9 lines
Makefile +1 -0
index 81b936f..1d2324c 100644
@@ -125,11 +125,18 @@ OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS))
 ifeq ($(libc),y)
 ifeq ($(CONFIG_XC),y)
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog -whole-archive -lxentoollog -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog/libxentoollog.a

I don't follow. Why is the original APP_LDLIBS not enough?

This just adds the parameters for ld to use the libs.

Quoted 2 lines

The new dependency doesn't seem to generate any new rules. What do I miss?

You snipped:

+$(OBJ_DIR)/$(TARGET)_app.o: $(APP_OBJS) app.lds $(LIBS)

which adds a dependency on the libs. Now mini-os_app.o will be relinked if any of the libs changed. That was not the case before. I realized that a modification of libxc wouldn't make it into pvgrub if I didn't do a "make clean" and pvgrub was built before.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by
#3 lore raw
Quoted 31 lines · Juergen Gross
Quoted 13 lines · Wei Liu
Quoted 12 lines · Juergen Gross

When building Mini-OS with an app which is using xen libraries like libxenguest.a let mini-os_app.o depend on the library binaries as it is statically linked with them.

While at it add "-T" before app.lds for linking mini-os_app.o to avoid a linker warning.

---
 Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
Quoted 11 lines

Makefile OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS)) · line 128

Quoted 9 lines
Makefile +1 -0
index 81b936f..1d2324c 100644
@@ -125,11 +125,18 @@ OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS))
 ifeq ($(libc),y)
 ifeq ($(CONFIG_XC),y)
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog -whole-archive -lxentoollog -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog/libxentoollog.a

I don't follow. Why is the original APP_LDLIBS not enough?

This just adds the parameters for ld to use the libs.

Quoted 2 lines

The new dependency doesn't seem to generate any new rules. What do I miss?

Quoted 9 lines

You snipped:

+$(OBJ_DIR)/$(TARGET)_app.o: $(APP_OBJS) app.lds $(LIBS)

which adds a dependency on the libs. Now mini-os_app.o will be relinked if any of the libs changed. That was not the case before. I realized that a modification of libxc wouldn't make it into pvgrub if I didn't do a "make clean" and pvgrub was built before.

I see

Quoted 2 lines

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v1 1/1
#4 lore raw
In reply to Juergen Gross
Quoted 8 lines · Juergen Gross, on Tue 27 Sep 2016 14:06:24 +0200, wrote:

When building Mini-OS with an app which is using xen libraries like libxenguest.a let mini-os_app.o depend on the library binaries as it is statically linked with them.

While at it add "-T" before app.lds for linking mini-os_app.o to avoid a linker warning.

Quoted 41 lines
---
 Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
Makefile +9 -2
index 81b936f..1d2324c 100644
@@ -125,11 +125,18 @@ OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS))
 ifeq ($(libc),y)
 ifeq ($(CONFIG_XC),y)
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog -whole-archive -lxentoollog -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog/libxentoollog.a
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn -whole-archive -lxenevtchn -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn/libxenevtchn.a
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab -whole-archive -lxengnttab -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab/libxengnttab.a
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call -whole-archive -lxencall -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call/libxencall.a
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/foreignmemory -whole-archive -lxenforeignmemory -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/foreignmemory/libxenforeignmemory.a
 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH) -whole-archive -lxenguest -lxenctrl -no-whole-archive
+LIBS += $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)/libxenctrl.a
+LIBS += $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)/libxenguest.a
 endif
 APP_LDLIBS += -lpci
 APP_LDLIBS += -lz
@@ -141,8 +148,8 @@ ifneq ($(APP_OBJS)-$(lwip),-y)
 OBJS := $(filter-out $(OBJ_DIR)/daytime.o, $(OBJS))
 endif
 
-$(OBJ_DIR)/$(TARGET)_app.o: $(APP_OBJS) app.lds
-	$(LD) -r -d $(LDFLAGS) -\( $^ -\) $(APP_LDLIBS) --undefined main -o $@
+$(OBJ_DIR)/$(TARGET)_app.o: $(APP_OBJS) app.lds $(LIBS)
+	$(LD) -r -d $(LDFLAGS) -\( $(APP_OBJS) -T app.lds -\) $(APP_LDLIBS) --undefined main -o $@
 
 ifneq ($(APP_OBJS),)
 APP_O=$(OBJ_DIR)/$(TARGET)_app.o 
Signature · 1 line
2.6.6
Signature · 10 lines
Samuel
#ifndef I_WISH_WORLD_WERE_PERFECT
/* It is not :-( All the routers (except for Linux) return only
...
 -+- linux/net/ipv4/ipip.c -+-

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#5 lore raw
Quoted 5 lines · Samuel Thibault
Quoted 4 lines · Juergen Gross, on Tue 27 Sep 2016 14:06:24 +0200, wrote:

When building Mini-OS with an app which is using xen libraries like libxenguest.a let mini-os_app.o depend on the library binaries as it is statically linked with them.

Quoted 7 lines
Quoted 4 lines

While at it add "-T" before app.lds for linking mini-os_app.o to avoid a linker warning.

Pushed. Thanks.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel