Bug 10136 - can't compile systemd with GCC 7.X when optimization is on
Summary: can't compile systemd with GCC 7.X when optimization is on
Status: RESOLVED FIXED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-26 16:01 UTC by Andrey Yurovsky
Modified: 2018-01-16 23:03 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments
workaround (862 bytes, patch)
2017-07-26 16:01 UTC, Andrey Yurovsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Yurovsky 2017-07-26 16:01:08 UTC
Created attachment 7131 [details]
workaround

Building systemd will fail due to a bug in GCC if we're using the buildroot GCC 7.X toolchain and have enable optimization (-O3). That is:

BR2_OPTIMIZE_3=y
BR2_GCC_VERSION_7_X=y
BR2_GCC_VERSION="7.1.0"

The problem is with GCC's nonnull detection (there's nothing wrong with the systemd code in question) and it looks like it has been fixed upstream but we don't have the backported fix in Buildroot:
https://github.com/systemd/systemd/issues/6119

A quick workaround is to patch systemd with the attached patch but it seems that GCC should have some patches backported.
Comment 1 Thomas Petazzoni 2017-07-26 16:08:47 UTC
Thanks for the report!

Can you figure out the corresponding gcc PR, and therefore the gcc commit that fixes this ?

Thanks!
Comment 2 Andrey Yurovsky 2017-07-26 16:25:19 UTC
I'm having trouble tracking it down. From the systemd bug tracker discussion it looks like "7.1.1" addresses this but there's no such release. The Fedora package they mention is assumed to have the fix but I can't find anything in the changelog or referenced bug IDs that seems relevant. I'll keep searching.
Comment 3 Yann E. MORIN 2017-08-02 20:35:36 UTC
Ah, not a systemd bug; I relinquish it...
Comment 4 Thomas Petazzoni 2018-01-10 21:25:46 UTC
This is in systemd upstream by commit https://github.com/systemd/systemd/commit/fb1b58820fc4622a3b7f54b4096943e4768505cb, which is in systemd >= 235.

We are currently using version 234 of systemd in Buildroot, but we already have a patch in patchwork updating it to version 236. Once this patch gets merged, this bug will be fixed.
Comment 5 Yann E. MORIN 2018-01-11 17:17:45 UTC
(In reply to Thomas Petazzoni from comment #4)
> we already have a patch in patchwork updating it to version 236.
> Once this patch gets merged, this bug will be fixed.

We must also apply https://patchwork.ozlabs.org/patch/856392/
first, otherwise the gitlab-ci infra will not be able to run
the runtime tests.

Regards,
Yann E. MORIN.