Skip to contentSkip to conversation

Include qemu-timer-common.o in trace-obj-y

PATCH New Lluís 6 participants 7 messages Aug 24, 2011 – Sep 2, 2011 Kbuild

lore
Share & tools
lore

Lluís

author
#0 lore raw

PATCH 1/1 Include qemu-timer-common.o in trace-obj-y

Helper programs like qemu-ga use tracing primitives, but qemu-timer-common.o (also used by simpletrace.o) is not necessarily included in the linkage line.

This currently produces a warning when linking the *-softmmu programs.

---
 Makefile.objs |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile.objs +1 -1
index d1f3e5d..44d7238 100644
@@ -380,7 +380,7 @@ else
 trace-obj-y = trace.o
 ifeq ($(TRACE_BACKEND),simple)
 trace-obj-y += simpletrace.o
-user-obj-y += qemu-timer-common.o
+trace-obj-y += qemu-timer-common.o
 endif
 endif
 
#1 lore raw

PATCH 1/1 build: sort objects to remove duplicates for link

Avoid duplicate object files during the link. There are legitimate cases where a link command-line would include duplicate object files because two independent subsystems both depend on common infrastructure.

Use GNU make's $(sort) function to remove duplicate object files from the link command-line.

---
Your patch seems fine but we need to avoid duplicate object files during the link phase. Otherwise we run into linker warnings because qemu-timer-common.o is linked multiple times. Please include this patch and resend the two together with this patch as 1/2 and yours as 2/2.

 rules.mak |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
rules.mak +1 -1
index 884d421..04a9198 100644
@@ -31,7 +31,7 @@ endif
 %.o: %.m
 	$(call quiet-command,$(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
 
-LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(LIBS),"  LINK  $(TARGET_DIR)$@")
+LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(sort $(1)) $(LIBS),"  LINK  $(TARGET_DIR)$@")
 
 %$(EXESUF): %.o
 	$(call LINK,$^)
Signature · 1 line
1.7.5.4
#2 lore raw

Re: [Qemu-devel] [PATCH] build: sort objects to remove duplicates for link

Quoted 8 lines · Stefan Hajnoczi

Avoid duplicate object files during the link. There are legitimate cases where a link command-line would include duplicate object files because two independent subsystems both depend on common infrastructure.

Use GNU make's $(sort) function to remove duplicate object files from the link command-line.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 22 lines

---
Your patch seems fine but we need to avoid duplicate object files during the link phase. Otherwise we run into linker warnings because qemu-timer-common.o is linked multiple times. Please include this patch and resend the two together with this patch as 1/2 and yours as 2/2.

  rules.mak |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
rules.mak +1 -1
index 884d421..04a9198 100644
@@ -31,7 +31,7 @@ endif
  %.o: %.m
  	$(call quiet-command,$(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
 
-LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(LIBS),"  LINK  $(TARGET_DIR)$@")
+LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(sort $(1)) $(LIBS),"  LINK  $(TARGET_DIR)$@")
 
  %$(EXESUF): %.o
  	$(call LINK,$^)
#3 lore raw

Re: [Qemu-devel] [PATCH] build: sort objects to remove duplicates for link

Quoted 5 lines · Anthony Liguori
Quoted 4 lines · Stefan Hajnoczi

Avoid duplicate object files during the link. There are legitimate cases where a link command-line would include duplicate object files because two independent subsystems both depend on common infrastructure.

Quoted 8 lines
Quoted 4 lines

Use GNU make's $(sort) function to remove duplicate object files from the link command-line.

Applied. Thanks.

Regards,

AFAIK, this patch is unnecessary once commit e03b41d47708744669aaa51e781021c3dc380198 in Stefan's repo is merged into upstream (which, according to the list, you just pulled).

The reason is that $(sort) is unnecessary when passing $^ to the LINK function ($^ already eliminates repeats, while keeping the order intact). The patch fixes the QEMU_PROG rule, which was the only one not using $^.

Thanks,
Lluis

Signature · 4 lines
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth
#4 lore raw

Re: [Qemu-devel] [PATCH] build: sort objects to remove duplicates for link

In reply to Anthony Liguori
Quoted 5 lines · Anthony Liguori
Quoted 4 lines · Stefan Hajnoczi

Avoid duplicate object files during the link. There are legitimate cases where a link command-line would include duplicate object files because two independent subsystems both depend on common infrastructure.

Quoted 7 lines
Quoted 4 lines

Use GNU make's $(sort) function to remove duplicate object files from the link command-line.

Applied. Thanks.

Don't think it'll hurt to have both, but "[PATCH 01/15] build: Fix linkage of QEMU_PROG" from Stefan's tracing pull request has the more elegant fix for this.

Quoted 33 lines

Regards,

Anthony Liguori

Quoted 27 lines

---
Your patch seems fine but we need to avoid duplicate object files during the
link phase. Otherwise we run into linker warnings because qemu-timer-common.o
is linked multiple times. Please include this patch and resend the two together with this patch as 1/2 and yours as 2/2.

rules.mak | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
rules.mak +0 -0
index 884d421..04a9198 100644
@@ -31,7 +31,7 @@ endif

%.o: %.m
$(call quiet-command,$(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@")

rules.mak +1 -3
-LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS)
-o $@ $(1) $(LIBS)," LINK $(TARGET_DIR)$@")
+LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS)
-o $@ $(sort $(1)) $(LIBS)," LINK $(TARGET_DIR)$@")

%$(EXESUF): %.o
$(call LINK,$^)

#5 lore raw

Re: [Qemu-devel] [PATCH] build: sort objects to remove duplicates for link

2011/9/1 Michael Roth <[email protected]>:

Quoted 11 lines · Anthony Liguori
Quoted 10 lines · Stefan Hajnoczi
Quoted 8 lines

Avoid duplicate object files during the link. There are legitimate cases where a link command-line would include duplicate object files because two independent subsystems both depend on common infrastructure.

Use GNU make's $(sort) function to remove duplicate object files from the link command-line.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Applied. Thanks.

Don't think it'll hurt to have both, but "[PATCH 01/15] build: Fix linkage of QEMU_PROG" from Stefan's tracing pull request has the more elegant fix for this.

Agreed, it doesn't hurt to take this one but the $^ fix is nicer and already merged.

Anthony: Do you want to revert this patch? It's not necessary.

Stefan

#6 lore raw

Re: [Qemu-devel] [PATCH] build: sort objects to remove duplicates for link

Quoted 17 lines · Stefan Hajnoczi

2011/9/1 Michael Roth<[email protected]>:

Quoted 16 lines · Anthony Liguori
Quoted 14 lines · Stefan Hajnoczi
Quoted 9 lines

Avoid duplicate object files during the link. There are legitimate cases where a link command-line would include duplicate object files because two independent subsystems both depend on common infrastructure.

Use GNU make's $(sort) function to remove duplicate object files from the link command-line.

Applied. Thanks.

Quoted 8 lines
Quoted 3 lines

Don't think it'll hurt to have both, but "[PATCH 01/15] build: Fix linkage of QEMU_PROG" from Stefan's tracing pull request has the more elegant fix for this.

Agreed, it doesn't hurt to take this one but the $^ fix is nicer and already merged.

Anthony: Do you want to revert this patch? It's not necessary.

If someone wants to send a patch, I can apply it, but I don't see the motivation to revert.

Regards,

Anthony Liguori

Quoted 3 lines

Stefan