Mir

Merge lp:~vorlon/mir/explicit-gcc-version-and-g++4.9-compatibility into lp:mir/ubuntu

Proposed by Steve Langasek
Status: Rejected
Rejected by: Daniel van Vugt
Proposed branch: lp:~vorlon/mir/explicit-gcc-version-and-g++4.9-compatibility
Merge into: lp:mir/ubuntu
Diff against target: 67 lines (+14/-3)
4 files modified
debian/control (+4/-0)
debian/rules (+7/-0)
src/shared/graphics/android/syncfence.cpp (+1/-1)
tests/unit-tests/graphics/android/test_sync_fence.cpp (+2/-2)
To merge this branch: bzr merge lp:~vorlon/mir/explicit-gcc-version-and-g++4.9-compatibility
Reviewer Review Type Date Requested Status
Daniel van Vugt Disapprove
Cemil Azizoglu (community) Needs Resubmitting
Chris Halse Rogers Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+226563@code.launchpad.net

Commit message

Explicitly select g++-4.9 to prevent from ABI breaks. (LP: #1329089)

Description of the change

Explicitly select g++-4.9 to prevent from ABI breaks. (LP: #1329089)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote :

This looks reasonable to me.

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

Two issues here...

(1) The path to archive is preferably to land things in the stable maintenance branch first: lp:mir/0.4 . Unfortunately lp:mir points to an archive-only branch that represents neither the active development branch nor our stable maintenance branch.

(2) If we did land this in lp:mir/0.4 then that's kind of an ABI break of sorts, which isn't meant to happen in stable maintenance branches because it just breaks things and confuses everyone.

I think if you want bug 1329089 fixed in Ubuntu then the cleanest way to do it is wait until we've bumped Ubuntu up to the 0.5 series. Ubuntu should be on 0.4 for the foreseeable future which means no binary compatibility changes occur:
  https://launchpad.net/ubuntu/+source/mir

But there's an argument that changing the C++ ABI dependency is not a libmir* ABI change. Land at your own risk I guess. Things may explode.

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

I think this needs more discussion. There's a risk that the ABI changes from g++ 4.8 to 4.9 directly changes the libmirserver C++ ABI also. If so, we would have to defer the change until the next major release 0.5.

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

Alright, my hypothetical concerns are probably less important than fixing the bug. But we should land it in the upstream stable maintenance branch instead --> lp:mir/0.4
and then it will go into the next utopic update.

review: Needs Resubmitting
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

We are starting a 0.5.0 release very soon. Please generate this MP against devel.

review: Needs Resubmitting
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

> We are starting a 0.5.0 release very soon. Please generate this MP against
> devel.

Scratch that. These changes are already part of devel. We'll be landing on trunk in a day or two.

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

Yep, we're working on getting Mir 0.5 into archive, which means this fix will land in Ubuntu archive soon anyway. It's probably not useful re-proposing to the 0.4 series.

review: Disapprove

Unmerged revisions

1730. By Alexandros Frantzis

android,tests: Fix g++ 4.9 build

It seems that g++ 4.9 has become more aggressive about constant folding of
expressions that use sizeof(), thus triggering warnings/errors related to
constant overflows that didn't occur with g++ 4.8.

For example, g++-4.8 warns about overflowing i3, but not i4, whereas g++-4.9
warns about both i3 and i4:

#define VALUE1 0x70000000UL
#define VALUE2 (VALUE1 >> sizeof(unsigned char))
#define VALUE3 0x80000000UL
#define VALUE4 (VALUE1 << sizeof(unsigned char))

int main()
{
    int i1 = VALUE1;
    int i2 = VALUE2;
    int i3 = VALUE3;
    int i4 = VALUE4;
}

This affects our ioctl() wrapper calls because we use 'int' for the request
parameter, whereas the request numbers produced by the kernel macros (using
sizeof() in the calculation) are 'unsigned long'. This MP fixes the problem by
casting the request numbers to 'int', which is a safe conversion since the
request numbers are constrained to 32 bits by design.

Note that we don't have a problem with all ioctl request numbers, although they
are produced by the same set of macros, because almost all of them don't have
the high bit set (like VALUE2 above) and don't trigger the overflow error. The
one we have a problem with, SYNC_IOC_MERGE, has the high bit set (like VALUE4
above).

Also note that the glibc ioctl() function signature uses 'unsigned long'
instead of 'int' for the request number. So, alternatively, we could fix the
problem by changing our wrappers to use 'unsigned long', too. However, the
glibc signature goes against POSIX and there have been discussions about
switching it back. See https://sourceware.org/bugzilla/show_bug.cgi?id=14362 .

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-06-27 06:10:24 +0000
3+++ debian/control 2014-07-12 06:22:08 +0000
4@@ -10,6 +10,10 @@
5 doxygen,
6 xsltproc,
7 graphviz,
8+# We rely on C++11 features, and to prevent from ABI breaks
9+# in libstdc++ causing us issues, we explicitly select a G++
10+# version.
11+ g++-4.9,
12 libboost-dev,
13 libboost-chrono-dev,
14 libboost-date-time-dev,
15
16=== modified file 'debian/rules'
17--- debian/rules 2014-04-15 17:11:14 +0000
18+++ debian/rules 2014-07-12 06:22:08 +0000
19@@ -6,6 +6,13 @@
20
21 export DPKG_GENSYMBOLS_CHECK_LEVEL = 4
22
23+include /usr/share/dpkg/default.mk
24+
25+# Explicitly selecting a G{CC,++}-version here to avoid accidental
26+# ABI breaks introduced by toolchain updates.
27+export CC=$(DEB_HOST_GNU_TYPE)-gcc-4.9
28+export CXX=$(DEB_HOST_GNU_TYPE)-g++-4.9
29+
30 %:
31 dh $@ --parallel --fail-missing
32
33
34=== modified file 'src/shared/graphics/android/syncfence.cpp'
35--- src/shared/graphics/android/syncfence.cpp 2014-03-06 06:05:17 +0000
36+++ src/shared/graphics/android/syncfence.cpp 2014-07-12 06:22:08 +0000
37@@ -65,7 +65,7 @@
38 {
39 //both fences were valid, must merge
40 struct sync_merge_data data { merge_fd, "mirfence", infinite_timeout };
41- ops->ioctl(fence_fd, SYNC_IOC_MERGE, &data);
42+ ops->ioctl(fence_fd, static_cast<int>(SYNC_IOC_MERGE), &data);
43 ops->close(fence_fd);
44 ops->close(merge_fd);
45 fence_fd = data.fence;
46
47=== modified file 'tests/unit-tests/graphics/android/test_sync_fence.cpp'
48--- tests/unit-tests/graphics/android/test_sync_fence.cpp 2014-03-06 06:05:17 +0000
49+++ tests/unit-tests/graphics/android/test_sync_fence.cpp 2014-07-12 06:22:08 +0000
50@@ -107,7 +107,7 @@
51
52 struct sync_merge_data expected_data_in { dummy_fd2, "name", 0 };
53
54- EXPECT_CALL(*mock_fops, ioctl(dummy_fd, SYNC_IOC_MERGE, MergeMatches(expected_data_in)))
55+ EXPECT_CALL(*mock_fops, ioctl(dummy_fd, static_cast<int>(SYNC_IOC_MERGE), MergeMatches(expected_data_in)))
56 .Times(1)
57 .WillOnce(Invoke(&setter, &IoctlSetter::merge_setter));
58
59@@ -119,7 +119,7 @@
60 TEST_F(SyncSwTest, sync_merge_with_invalid_fd)
61 {
62 using namespace testing;
63- EXPECT_CALL(*mock_fops, ioctl(dummy_fd, SYNC_IOC_MERGE, _))
64+ EXPECT_CALL(*mock_fops, ioctl(dummy_fd, static_cast<int>(SYNC_IOC_MERGE), _))
65 .Times(0);
66
67 mga::SyncFence fence1(mock_fops, invalid_fd);

Subscribers

People subscribed via source and target branches