Mir

Merge lp:~alan-griffiths/mir/fix-1617865 into lp:mir

Proposed by Alan Griffiths
Status: Rejected
Rejected by: Alan Griffiths
Proposed branch: lp:~alan-griffiths/mir/fix-1617865
Merge into: lp:mir
Diff against target: 72 lines (+43/-0)
1 file modified
src/common/dispatch/readable_fd.cpp (+43/-0)
To merge this branch: bzr merge lp:~alan-griffiths/mir/fix-1617865
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Alan Griffiths Disapprove
Brandon Schaefer (community) Approve
Review via email: mp+306123@code.launchpad.net

Commit message

Fix the accidental move of mir::dispatch::ReadableFd symbols from MIR_COMMON_5.1 to MIR_COMMON_0.24 (LP:1617865)

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

+1

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Ooh! This might be a problem...

16:30:48 cd /<<BUILDDIR>>/mir-0.25.0+xenial2257bzr3711/obj-x86_64-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /<<BUILDDIR>>/mir-0.25.0+xenial2257bzr3711 /<<BUILDDIR>>/mir-0.25.0+xenial2257bzr3711/tests/mir_test_doubles /<<BUILDDIR>>/mir-0.25.0+xenial2257bzr3711/obj-x86_64-linux-gnu /<<BUILDDIR>>/mir-0.25.0+xenial2257bzr3711/obj-x86_64-linux-gnu/tests/mir_test_doubles /<<BUILDDIR>>/mir-0.25.0+xenial2257bzr3711/obj-x86_64-linux-gnu/tests/mir_test_doubles/CMakeFiles/mir-test-doubles-platform-static.dir/DependInfo.cmake --color=
16:30:48 [ 48%] Built target mirclientrpc
16:30:48 make -f examples/CMakeFiles/mir_demo_server.dir/build.make examples/CMakeFiles/mir_demo_server.dir/depend
16:30:48 /tmp/cchcbiRQ.s: Assembler messages:
16:30:48 /tmp/cchcbiRQ.s:345: Error: multiple versions [`_ZN3mir8dispatch10ReadableFdD0Ev@@@MIR_COMMON_5.1'|`_ZN3mir8dispatch10ReadableFdD0Ev@MIR_COMMON_0.24'] for symbol `_ZN3mir8dispatch10ReadableFdD0Ev'
16:30:48 /tmp/cchcbiRQ.s:346: Error: multiple versions [`_ZTVN3mir8dispatch10ReadableFdE@@@MIR_COMMON_5.1'|`_ZTVN3mir8dispatch10ReadableFdE@MIR_COMMON_0.24'] for symbol `_ZTVN3mir8dispatch10ReadableFdE'
16:30:48 /tmp/cchcbiRQ.s:347: Error: multiple versions [`_ZN3mir8dispatch10ReadableFdC2ENS_2FdERKSt8functionIFvvEE@@@MIR_COMMON_5.1'|`_ZN3mir8dispatch10ReadableFdC2ENS_2FdERKSt8functionIFvvEE@MIR_COMMON_0.24'] for symbol `_ZN3mir8dispatch10ReadableFdC2ENS_2FdERKSt8functionIFvvEE'
16:30:48 /tmp/cchcbiRQ.s:773: Error: multiple versions [`_ZNK3mir8dispatch10ReadableFd8watch_fdEv@@@MIR_COMMON_5.1'|`_ZNK3mir8dispatch10ReadableFd8watch_fdEv@MIR_COMMON_0.24'] for symbol `_ZNK3mir8dispatch10ReadableFd8watch_fdEv'
16:30:48 /tmp/cchcbiRQ.s:806: Error: multiple versions [`_ZN3mir8dispatch10ReadableFd8dispatchEj@@@MIR_COMMON_5.1'|`_ZN3mir8dispatch10ReadableFd8dispatchEj@MIR_COMMON_0.24'] for symbol `_ZN3mir8dispatch10ReadableFd8dispatchEj'
16:30:48 /tmp/cchcbiRQ.s:854: Error: multiple versions [`_ZNK3mir8dispatch10ReadableFd15relevant_eventsEv@@@MIR_COMMON_5.1'|`_ZNK3mir8dispatch10ReadableFd15relevant_eventsEv@MIR_COMMON_0.24'] for symbol `_ZNK3mir8dispatch10ReadableFd15relevant_eventsEv'
16:30:48 src/common/CMakeFiles/mircommon.dir/build.make:113: recipe for target 'src/common/CMakeFiles/mircommon.dir/dispatch/readable_fd.cpp.o' failed
16:30:48 make[3]: *** [src/common/CMakeFiles/mircommon.dir/dispatch/readable_fd.cpp.o] Error 1
16:30:48 make[3]: Leaving directory '/<<BUILDDIR>>/mir-0.25.0+xenial2257bzr3711/obj-x86_64-linux-gnu'
16:30:48 CMakeFiles/Makefile2:2791: recipe for target 'src/common/CMakeFiles/mircommon.dir/all' failed
16:30:48 make[2]: *** [src/common/CMakeFiles/mircommon.dir/all] Error 2
16:30:48 make[2]: *** Waiting for unfinished jobs....

https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2231/console

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> Ooh! This might be a problem...
>
It is. clang "does the right thing" but gcc doesn't understand this approach.

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I wish you luck.

Isn't @@@ meant to be just @@ ?

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> I wish you luck.
>
> Isn't @@@ meant to be just @@ ?

I thought so too. But I found the symbol wasn't exported with that and needed to be @@@ - like the example in doc/dso_versioning_guide.md.

What I overlooked was that I was using clang - which behaves differently to gcc. I need to RTFM.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Hmm...

    Honestly, this is an assembler bug, but we've been working around
    it for years. Here you have to jump though silly hoops, and create
    an alternate base symbol via an alias. E.g.

    weak_alias (__mcount, __mcount1)
    versioned_symbol (libc, __mcount, _mcount, GLIBC_2_18)
    versioned_symbol (libc, __mcount1, mcount, GLIBC_2_18)

    There are other examples in the source base for similar if you go
    grepping...

https://sourceware.org/ml/libc-alpha/2013-07/msg00480.html

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3712
https://mir-jenkins.ubuntu.com/job/mir-ci/1771/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/2219
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2282
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2273
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2273
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2273
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2247
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2247/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2247
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2247/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2247
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2247/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2247
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2247/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2247
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2247/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1771/rebuild

review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

This is weird. After the gcc assembler complaining about them in the last iteration it is now failing to emit the versioned symbols.

This seems to be specific to C++ symbols - I tried cut & paste of some incantations from Mir-0.13 and that works.

Maybe this approach only works with clang?

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Showing it to CI, but the gcc version still doesn't publish the versioned aliases from libmircommon.

review: Disapprove
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3715
https://mir-jenkins.ubuntu.com/job/mir-ci/1773/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/2221
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2284
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2275
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2275
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2275
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2250
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2250/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2250
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2250/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2250
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2250/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2250
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2250/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2250
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2250/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1773/rebuild

review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Maybe symbols.map is conflicting/overriding this...

Maybe also consider using two separate compilation units (cpp files) with just a different symbol version in each.

lp:~alan-griffiths/mir/fix-1617865 updated
3716. By Alan Griffiths

Code cleanup

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

The problem appear to be that for C++ symbols the gcc assembler exports the unversioned symbols as well as the versioned ones whereas the clang assembler just exports the versioned aliases.

With gcc the linker then resolves to the unversioned symbols (and ignores the versioned ones).

Marking the unversioned symbol names .local doesn't help.

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3716
https://mir-jenkins.ubuntu.com/job/mir-ci/1780/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/2230
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2293
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2284
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2284
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2284
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2258
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2258/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2258
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2258/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2258
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2258/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2258
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2258/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2258
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2258/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1780/rebuild

review: Approve (continuous-integration)

Unmerged revisions

3716. By Alan Griffiths

Code cleanup

3715. By Alan Griffiths

Incantation for the vtab

3714. By Alan Griffiths

Delete test code

3713. By Alan Griffiths

Get the versioned aliases into the .o. (Shame about the .so)

3712. By Alan Griffiths

Work around undocumented behaviour of gcc and clang toolchains

3711. By Alan Griffiths

Provide mir::dispatch::ReadableFd symbols in both MIR_COMMON_5.1 and MIR_COMMON_0.24

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/common/dispatch/readable_fd.cpp'
2--- src/common/dispatch/readable_fd.cpp 2015-08-29 11:33:37 +0000
3+++ src/common/dispatch/readable_fd.cpp 2016-09-21 10:45:32 +0000
4@@ -18,17 +18,47 @@
5
6 #include "mir/dispatch/readable_fd.h"
7
8+// Fix for lp:1617865
9+//
10+// "Accidental libmircommon.so.6 ABI break in Mir 0.24: mir::dispatch::ReadableFd*
11+// moved version stanzas
12+//
13+// "So for example server-mesa-x11.so.9 can no longer load because it expects from
14+// libmircommon.so.6:
15+// ZN3mir8dispatch10ReadableFdC1ENS_2FdERKSt8functionIFvvEE@MIR_COMMON_5.1
16+// but actually in Mir 0.24.0 that got duplicated and changed to:
17+// ZN3mir8dispatch10ReadableFdC1ENS_2FdERKSt8functionIFvvEE@MIR_COMMON_0.24"
18+//
19+// Move the default symbol back to MIR_COMMON_5.1 and also provide MIR_COMMON_0.24
20+
21+// NB Neither the gcc nor clang toolchain behaves as I read the documentation, but,
22+// in practice, these incantations work around the differences. ~ alan_g
23+#if defined(__clang__)
24+#define MIR_DOUBLE_ENTRY(symbol)\
25+__asm__(".symver " #symbol "," #symbol "@MIR_COMMON_0.24");\
26+__asm__(".symver " #symbol "," #symbol "@@@MIR_COMMON_5.1")
27+#elif defined(__GNUC__)
28+#define MIR_DOUBLE_ENTRY(symbol)\
29+extern "C" __attribute__ ((alias(#symbol))) void _X##symbol();\
30+__asm__(".symver _X" #symbol "," #symbol "@MIR_COMMON_0.24");\
31+__asm__(".symver " #symbol "," #symbol "@@MIR_COMMON_5.1")
32+#endif
33+
34+MIR_DOUBLE_ENTRY(_ZN3mir8dispatch10ReadableFdC1ENS_2FdERKSt8functionIFvvEE);
35+MIR_DOUBLE_ENTRY(_ZN3mir8dispatch10ReadableFdC2ENS_2FdERKSt8functionIFvvEE);
36 mir::dispatch::ReadableFd::ReadableFd(Fd fd, std::function<void()> const& on_readable) :
37 fd{fd},
38 readable{on_readable}
39 {
40 }
41
42+MIR_DOUBLE_ENTRY(_ZNK3mir8dispatch10ReadableFd8watch_fdEv);
43 mir::Fd mir::dispatch::ReadableFd::watch_fd() const
44 {
45 return fd;
46 }
47
48+MIR_DOUBLE_ENTRY(_ZN3mir8dispatch10ReadableFd8dispatchEj);
49 bool mir::dispatch::ReadableFd::dispatch(FdEvents events)
50 {
51 if (events & FdEvent::error)
52@@ -40,7 +70,20 @@
53 return true;
54 }
55
56+MIR_DOUBLE_ENTRY(_ZNK3mir8dispatch10ReadableFd15relevant_eventsEv);
57 mir::dispatch::FdEvents mir::dispatch::ReadableFd::relevant_events() const
58 {
59 return FdEvent::readable;
60 }
61+
62+#if !defined(__clang__) && defined(__GNUC__)
63+#undef MIR_DOUBLE_ENTRY
64+#define MIR_DOUBLE_ENTRY(symbol)\
65+__asm__(".weakref _X" #symbol "," #symbol);\
66+__asm__(".symver _X" #symbol "," #symbol "@MIR_COMMON_0.24");\
67+__asm__(".symver " #symbol "," #symbol "@@MIR_COMMON_5.1")
68+#endif
69+
70+MIR_DOUBLE_ENTRY(_ZTVN3mir8dispatch10ReadableFdE); // vtable for mir::dispatch::ReadableFd
71+MIR_DOUBLE_ENTRY(_ZTIN3mir8dispatch10ReadableFdE); // typeinfo for mir::dispatch::ReadableFd
72+MIR_DOUBLE_ENTRY(_ZTSN3mir8dispatch10ReadableFdE); // typeinfo name for mir::dispatch::ReadableFd

Subscribers

People subscribed via source and target branches