Skip to content

compilers: Add optimization=plain option#10593

Merged
jpakkane merged 1 commit intomesonbuild:masterfrom
jtojnar:plain-no-optimization
Oct 9, 2022
Merged

compilers: Add optimization=plain option#10593
jpakkane merged 1 commit intomesonbuild:masterfrom
jtojnar:plain-no-optimization

Conversation

@jtojnar
Copy link
Contributor

@jtojnar jtojnar commented Jul 12, 2022

#9287 changed the optimization=0 to pass -O0 to the compiler. This change is reasonable by itself but unfortunately, it breaks buildtype=plain, which promises that “no extra build flags are used”.

buildtype=plain is important for distros like NixOS, which manage compiler flags for optimization and hardening themselves.

Let’s introduce a new optimization level that does nothing and set it as the default for buildtype=plain.

@codecov
Copy link

codecov bot commented Jul 12, 2022

Codecov Report

Merging #10593 (1752079) into master (4679314) will decrease coverage by 18.47%.
The diff coverage is n/a.

❗ Current head 1752079 differs from pull request most recent head 70663f6. Consider uploading reports for the commit 70663f6 to get more accurate results

@@             Coverage Diff             @@
##           master   #10593       +/-   ##
===========================================
- Coverage   68.84%   50.36%   -18.48%     
===========================================
  Files         406      203      -203     
  Lines       88000    44085    -43915     
  Branches    19546     9777     -9769     
===========================================
- Hits        60581    22203    -38378     
+ Misses      22850    19877     -2973     
+ Partials     4569     2005     -2564     
Impacted Files Coverage Δ
modules/qt5.py 0.00% <0.00%> (-100.00%) ⬇️
modules/modtest.py 0.00% <0.00%> (-100.00%) ⬇️
scripts/run_tool.py 0.00% <0.00%> (-100.00%) ⬇️
scripts/msgfmthelper.py 0.00% <0.00%> (-100.00%) ⬇️
modules/keyval.py 0.00% <0.00%> (-95.24%) ⬇️
scripts/clangtidy.py 0.00% <0.00%> (-93.34%) ⬇️
scripts/vcstagger.py 0.00% <0.00%> (-91.67%) ⬇️
modules/unstable_icestorm.py 0.00% <0.00%> (-91.67%) ⬇️
modules/sourceset.py 0.00% <0.00%> (-90.54%) ⬇️
scripts/depscan.py 0.00% <0.00%> (-83.92%) ⬇️
... and 334 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@jtojnar jtojnar force-pushed the plain-no-optimization branch from 21f9d0d to 55b99e1 Compare July 12, 2022 14:01
@eli-schwartz
Copy link
Member

@dcbaker I did say that PR was going to break things...

@dcbaker
Copy link
Member

dcbaker commented Jul 12, 2022

I mean, it was already broken with clang, which means it was broken for nix with macos anyway, it just got noticed now that gcc and clang have the same behavior :/

@dcbaker
Copy link
Member

dcbaker commented Jul 12, 2022

The change makes sense to me anyway. Should we ensure that buildtype=plain sets optimization=plain as well?

@jtojnar jtojnar force-pushed the plain-no-optimization branch from 55b99e1 to a725d49 Compare July 12, 2022 17:44
@jtojnar jtojnar force-pushed the plain-no-optimization branch from a725d49 to e8405bb Compare July 12, 2022 22:49
@jtojnar jtojnar force-pushed the plain-no-optimization branch from e8405bb to 7506511 Compare July 18, 2022 10:34
mesonbuild#9287 changed the `optimization=0`
to pass `-O0` to the compiler. This change is reasonable by itself
but unfortunately, it breaks `buildtype=plain`, which promises
that “no extra build flags are used”.

`buildtype=plain` is important for distros like NixOS,
which manage compiler flags for optimization and hardening
themselves.

Let’s introduce a new optimization level that does nothing
and set it as the default for `buildtype=plain`.
@jtojnar jtojnar force-pushed the plain-no-optimization branch from 7506511 to 70663f6 Compare August 15, 2022 22:50
@jtojnar
Copy link
Contributor Author

jtojnar commented Aug 15, 2022

Made the changelog more explicit about the breakage.

@tristan957
Copy link
Member

Cool. systemd has acknowledged the issue, and is only waiting on this PR to merge before proposing a fix.

@heftig
Copy link
Contributor

heftig commented Oct 5, 2022

only waiting on this PR to merge

Is this not going to be merged?

@jpakkane
Copy link
Member

jpakkane commented Oct 9, 2022

Test failure is unrelated.

@jpakkane jpakkane merged commit a590cfd into mesonbuild:master Oct 9, 2022
UTsweetyfish pushed a commit to UTsweetyfish/systemd that referenced this pull request Jul 14, 2023
meson 0.64 introduced optimization plain option.

Ref: systemd/systemd#25677
Ref: mesonbuild/meson#10593
UTsweetyfish added a commit to UTsweetyfish/systemd that referenced this pull request Jul 14, 2023
meson 0.64 introduced optimization plain option.

Ref: systemd/systemd#25677
Ref: mesonbuild/meson#10593
UTsweetyfish added a commit to deepin-community/systemd that referenced this pull request Jul 14, 2023
meson 0.64 introduced optimization plain option.

Ref: systemd/systemd#25677
Ref: mesonbuild/meson#10593
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants