diff mbox

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

Message ID 1474977984-21182-1-git-send-email-jgross@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jürgen Groß Sept. 27, 2016, 12:06 p.m. UTC
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.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Wei Liu Sept. 27, 2016, 3:56 p.m. UTC | #1
On Tue, Sep 27, 2016 at 02:06:24PM +0200, Juergen Gross 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.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>  Makefile | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 81b936f..1d2324c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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.
Jürgen Groß Sept. 27, 2016, 4:03 p.m. UTC | #2
On 27/09/16 17:56, Wei Liu wrote:
> On Tue, Sep 27, 2016 at 02:06:24PM +0200, Juergen Gross 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.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> ---
>>  Makefile | 11 +++++++++--
>>  1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 81b936f..1d2324c 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -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.

> 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
Wei Liu Sept. 27, 2016, 4:15 p.m. UTC | #3
On Tue, Sep 27, 2016 at 06:03:28PM +0200, Juergen Gross wrote:
> On 27/09/16 17:56, Wei Liu wrote:
> > On Tue, Sep 27, 2016 at 02:06:24PM +0200, Juergen Gross 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.
> >>
> >> Signed-off-by: Juergen Gross <jgross@suse.com>
> >> ---
> >>  Makefile | 11 +++++++++--
> >>  1 file changed, 9 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/Makefile b/Makefile
> >> index 81b936f..1d2324c 100644
> >> --- a/Makefile
> >> +++ b/Makefile
> >> @@ -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.
> 
> > 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.
> 

I see

Reviewed-by: Wei Liu <wei.liu2@citrix.com>

> 
> Juergen
Samuel Thibault Sept. 27, 2016, 4:28 p.m. UTC | #4
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.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  Makefile | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 81b936f..1d2324c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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 
> -- 
> 2.6.6
>
Wei Liu Sept. 27, 2016, 4:52 p.m. UTC | #5
On Tue, Sep 27, 2016 at 06:28:10PM +0200, Samuel Thibault wrote:
> 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.
> > 
> > Signed-off-by: Juergen Gross <jgross@suse.com>
> 
> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> 

Pushed. Thanks.
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 81b936f..1d2324c 100644
--- a/Makefile
+++ b/Makefile
@@ -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