Patchwork trace: work around ranlib warning for 'nop' backend

login
register
mail settings
Submitter Stefan Hajnoczi
Date Jan. 24, 2013, 3:04 p.m.
Message ID <1359039871-14401-1-git-send-email-stefanha@redhat.com>
Download mbox | patch
Permalink /patch/215363/
State New
Headers show

Comments

Stefan Hajnoczi - Jan. 24, 2013, 3:04 p.m.
The 'nop' backend does not emit any C code and therefore leaves
trace/generated-tracers.c empty.  Peter Maydell
<peter.maydell@linaro.org> reports that ranlib(1) prints a warning when
it encounters object files that define no symbols:

  /usr/bin/ranlib: file: libqemuutil.a(generated-tracers.o) has no symbols

Define a dummy symbol to silence ranlib(1).  Note that it will not be
linked into the final binary since there are no dependencies on it.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
Peter: Please test this patch.  It feels a little dirty but I think it's worth
getting rid of the ranlib warning in the default build on your host.

 scripts/tracetool/format/c.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Peter Maydell - Jan. 24, 2013, 3:58 p.m.
On 24 January 2013 15:04, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> The 'nop' backend does not emit any C code and therefore leaves
> trace/generated-tracers.c empty.  Peter Maydell
> <peter.maydell@linaro.org> reports that ranlib(1) prints a warning when
> it encounters object files that define no symbols:
>
>   /usr/bin/ranlib: file: libqemuutil.a(generated-tracers.o) has no symbols
>
> Define a dummy symbol to silence ranlib(1).  Note that it will not be
> linked into the final binary since there are no dependencies on it.
>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> Peter: Please test this patch.  It feels a little dirty but I think it's worth
> getting rid of the ranlib warning in the default build on your host.

Yes, this patch silences the ranlib warning about
generated-tracers.o.

NB that there are still two other .o files that ranlib
warns about:

/usr/bin/ranlib: file: libqemuutil.a(host-utils.o) has no symbols
/usr/bin/ranlib: file: libqemuutil.a(cache-utils.o) has no symbols

thanks
-- PMM

Patch

diff --git a/scripts/tracetool/format/c.py b/scripts/tracetool/format/c.py
index 35555ae..9596e3a 100644
--- a/scripts/tracetool/format/c.py
+++ b/scripts/tracetool/format/c.py
@@ -17,4 +17,10 @@  from tracetool import out
 
 
 def begin(events):
-    out('/* This file is autogenerated by tracetool, do not edit. */')
+    out('/* This file is autogenerated by tracetool, do not edit. */',
+        '',
+        '/* Prevent backends that do not emit any C code from hitting a '
+        ' * warning in some versions of ranlib(1) because the object file '
+        ' * has no symbols.'
+        ' */',
+        'const char trace_c_unused_symbol_dummy;')