15.03.2024 00:00, Olaf Hering wrote:
ui-dbus.so is a shared library. But it is apparently handled differently
than all the other shared libraries: it is not compiled with -fPIC.

As a result it fails to link. Not sure why this happens only here.
Everything up to v7.2.9 was fine.

Looking at some random other library like libui-spice-core.a,
every object is compiled with -fPIC.

But ui/dbus-display1.c is compiled with -fPIE instead.

Is this intentional?

Olaf

ld: ui/libdbus-display1.a.p/meson-generated_.._dbus-display1.c.o: warning: 
relocation against `qemu_dbus_display1_audio_get_type' in read-only section 
`.text'

Hi!

This seems to be the following patch which I picked up for 7.2.10:

commit c172136ea3320fa285c39bfb07298bbe1a14ba5e
Author: Marc-André Lureau <marcandre.lur...@redhat.com>
Date:   Thu Aug 11 15:59:40 2022 +0400

    meson: ensure dbus-display generated code is built before other units

    It's simply by luck that dbus-display header is built first before the
    other units using it.

    With sourceset, I can't find an easier way out than declaring an extra
    dependency for dbus-display1 generate code.

    Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berra...@redhat.com>
    (cherry picked from commit 1222070e772833c6875e0ca63565db12c22df39e)
    Signed-off-by: Michael Tokarev <m...@tls.msk.ru>

This has bitten me multiple times, when dbus-display1.c isn't generated
promptly.  So I thought it's a good pick.  Apparently not :)

And indeed, on master the same issue exists now, - after the above commit,
dbus-display1.o is being built with -fPIE instead of -fPIC. Reverting this
commit makes it use -fPIC again.

Apparently we don't build with --enable-modules and with a recent enough
compiler to catch this (my gcc-12.2 on debian bookworm does not care about
this stuff).

Cc'ing Marc-André.

An interesting side-effect :)

Thanks,

/mjt

Reply via email to