Skip to contentSkip to conversation

build-sys: Exclude empty object files when linking libqemuutil.a

PATCH In review Fam Zheng 4 participants 9 messages Sep 3, 2014 – Sep 10, 2014

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

cover build-sys: Exclude empty object files when linking libqemuutil.a

On Mac OS X, ranlib complains on a few empty objects:

AR libqemuutil.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(generated-tracers.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(host-utils.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(getauxval.o) has no symbols

This series fixes the warnings.

Fam

Fam Zheng (3):
trace: Only link generated-tracers.o with "simple" backend
util: Move general qemu_getauxval to util/getauxval.c
util: Don't link host-utils.o if it's empty

 include/qemu/osdep.h | 4 ----
 trace/Makefile.objs  | 3 +--
 util/Makefile.objs   | 3 ++-
 util/getauxval.c     | 8 ++++++++
 util/host-utils.c    | 2 --
 5 files changed, 11 insertions(+), 9 deletions(-)
Signature · 1 line
2.1.0.27.g96db324
author
#1 lore raw

PATCH 1/3 trace: Only link generated-tracers.o with "simple" backend

In any other cases the object file is effectively empty, which is disliked by ranlib and nm on Mac OS X.

---
 trace/Makefile.objs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
trace/Makefile.objs +1 -2
index 387f191..46de95c 100644
@@ -140,8 +140,7 @@ $(obj)/generated-tcg-tracers.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/
 ######################################################################
 # Backend code
 
-util-obj-$(CONFIG_TRACE_SIMPLE) += simple.o
+util-obj-$(CONFIG_TRACE_SIMPLE) += simple.o generated-tracers.o
 util-obj-$(CONFIG_TRACE_FTRACE) += ftrace.o
 util-obj-$(CONFIG_TRACE_UST) += generated-ust.o
 util-obj-y += control.o
-util-obj-y += generated-tracers.o
Signature · 1 line
2.1.0.27.g96db324
Reviewed-by on v1 1/3
#2 lore raw

Re: [Qemu-devel] [PATCH 1/3] trace: Only link generated-tracers.o with "simple" backend

Quoted 8 lines · Fam Zheng

In any other cases the object file is effectively empty, which is disliked by ranlib and nm on Mac OS X.

---
 trace/Makefile.objs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

If another trace backend uses generate_c() there will be a link error so they'll figure out they need to add it in the makefile.

author
#3 lore raw

PATCH 2/3 util: Move general qemu_getauxval to util/getauxval.c

In reply to Fam Zheng

So that we won't have an empty getauxval.o which is disliked by ranlib.

---
 include/qemu/osdep.h | 4 ----
 util/getauxval.c     | 8 ++++++++
 2 files changed, 8 insertions(+), 4 deletions(-)
include/qemu/osdep.h +0 -4
index 9dd43fc..1565404 100644
@@ -246,11 +246,7 @@ char *qemu_get_exec_dir(void);
  * Search the auxiliary vector for @type, returning the value
  * or 0 if @type is not present.
  */
-#if defined(CONFIG_GETAUXVAL) || defined(__linux__)
 unsigned long qemu_getauxval(unsigned long type);
-#else
-static inline unsigned long qemu_getauxval(unsigned long type) { return 0; }
-#endif
 
 void qemu_set_tty_echo(int fd, bool echo);
 
util/getauxval.c +8 -0
index 25f48e5..1732ace 100644
@@ -98,4 +98,12 @@ unsigned long qemu_getauxval(unsigned long type)
 
     return 0;
 }
+
+#else
+
+unsigned long qemu_getauxval(unsigned long type)
+{
+    return 0;
+}
+
 #endif
Signature · 1 line
2.1.0.27.g96db324
author
#4 lore raw

PATCH 3/3 util: Don't link host-utils.o if it's empty

In reply to Fam Zheng
---
 util/Makefile.objs | 3 ++-
 util/host-utils.c  | 2 --
 2 files changed, 2 insertions(+), 3 deletions(-)
util/Makefile.objs +2 -1
index 6b3c83b..cb8862b 100644
@@ -1,7 +1,8 @@
 util-obj-y = osdep.o cutils.o unicode.o qemu-timer-common.o
 util-obj-$(CONFIG_WIN32) += oslib-win32.o qemu-thread-win32.o event_notifier-win32.o
 util-obj-$(CONFIG_POSIX) += oslib-posix.o qemu-thread-posix.o event_notifier-posix.o qemu-openpty.o
-util-obj-y += envlist.o path.o host-utils.o module.o
+util-obj-y += envlist.o path.o module.o
+util-obj-$(call lnot,$(CONFIG_INT128)) += host-utils.o
 util-obj-y += bitmap.o bitops.o hbitmap.o
 util-obj-y += fifo8.o
 util-obj-y += acl.o
util/host-utils.c +0 -2
index ee57ef5..102e5bf 100644
@@ -28,7 +28,6 @@
 #include "qemu/host-utils.h"
 
 /* Long integer helpers */
-#ifndef CONFIG_INT128
 static inline void mul64(uint64_t *plow, uint64_t *phigh,
                          uint64_t a, uint64_t b)
 {
@@ -161,4 +160,3 @@ int divs128(int64_t *plow, int64_t *phigh, int64_t divisor)
     return overflow;
 }
 
-#endif /* !CONFIG_INT128 */
Signature · 1 line
2.1.0.27.g96db324
#5 lore raw
In reply to Fam Zheng

Il 03/09/2014 05:44, Fam Zheng ha scritto:

Quoted 19 lines

On Mac OS X, ranlib complains on a few empty objects:

AR libqemuutil.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(generated-tracers.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(host-utils.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(getauxval.o) has no symbols

This series fixes the warnings.

Fam

Fam Zheng (3):
trace: Only link generated-tracers.o with "simple" backend
util: Move general qemu_getauxval to util/getauxval.c
util: Don't link host-utils.o if it's empty

Quoted 7 lines
 include/qemu/osdep.h | 4 ----
 trace/Makefile.objs  | 3 +--
 util/Makefile.objs   | 3 ++-
 util/getauxval.c     | 8 ++++++++
 util/host-utils.c    | 2 --
 5 files changed, 11 insertions(+), 9 deletions(-)

Thanks, looks good. Stefan, can you ack the first patch?

Paolo

author
#6 lore raw
Quoted 28 lines · Paolo Bonzini

Il 03/09/2014 05:44, Fam Zheng ha scritto:

Quoted 19 lines

On Mac OS X, ranlib complains on a few empty objects:

AR libqemuutil.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(generated-tracers.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(host-utils.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(getauxval.o) has no symbols

This series fixes the warnings.

Fam

Fam Zheng (3):
trace: Only link generated-tracers.o with "simple" backend
util: Move general qemu_getauxval to util/getauxval.c
util: Don't link host-utils.o if it's empty

Quoted 7 lines
 include/qemu/osdep.h | 4 ----
 trace/Makefile.objs  | 3 +--
 util/Makefile.objs   | 3 ++-
 util/getauxval.c     | 8 ++++++++
 util/host-utils.c    | 2 --
 5 files changed, 11 insertions(+), 9 deletions(-)
Quoted 2 lines

Thanks, looks good. Stefan, can you ack the first patch?

Paolo,

Since Stefan reviewed the first patch, would you apply this series?

Fam

#7 lore raw

Il 10/09/2014 08:19, Fam Zheng ha scritto:

Quoted 3 lines

Paolo,

Since Stefan reviewed the first patch, would you apply this series?

Yes, pull request coming soon.

Paolo

Reviewed-by on the v1 series
#8 lore raw
In reply to Fam Zheng
Quoted 10 lines · Fam Zheng

On Mac OS X, ranlib complains on a few empty objects:

AR libqemuutil.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(generated-tracers.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(host-utils.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(getauxval.o) has no symbols

Quoted 8 lines

This series fixes the warnings.

Fam

Fam Zheng (3):
trace: Only link generated-tracers.o with "simple" backend
util: Move general qemu_getauxval to util/getauxval.c
util: Don't link host-utils.o if it's empty

Series

This fixes both the ranlib warnings and the ones from nm that your new patch was producing. Thanks!

-- PMM