diff options
author | Guillem Jover <guillem@debian.org> | 2018-12-08 00:28:57 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2019-01-15 03:42:39 +0100 |
commit | 75afd33e320ebb31f0e974b227d714b049a67808 (patch) | |
tree | a40eaef09c9e4ad0c8eb13b98313aee1c65262f9 /scripts/Dpkg | |
parent | 39eb793a685273f520b25179bf118f8845ece0f6 (diff) | |
download | dpkg-75afd33e320ebb31f0e974b227d714b049a67808.tar.gz |
Dpkg::Vendor::Ubuntu: Fix buildflags override after default setting move
The default buildflags got moved from the Dpkg::BuildFlags module to
the Dpkg::Vendor::Debian, but this module was not adapted to match.
Instead of running the Debian hooks after the Ubuntu buildflags are set
up, run them first, and then modify/prepend the bits we need to change.
This fixes compiler optimization on ppc64el, and makes setting it more
future proof.
Fixes: commit d5374bc618310917557daa9c9ac2f4930515a0b2
Closes: #915881
Co-Author: Iain Lane <laney@ubuntu.com>
Co-Author: Adam Conrad <adconrad@ubuntu.com>
Diffstat (limited to 'scripts/Dpkg')
-rw-r--r-- | scripts/Dpkg/Vendor/Ubuntu.pm | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/scripts/Dpkg/Vendor/Ubuntu.pm b/scripts/Dpkg/Vendor/Ubuntu.pm index eb2dffefe..e6335c204 100644 --- a/scripts/Dpkg/Vendor/Ubuntu.pm +++ b/scripts/Dpkg/Vendor/Ubuntu.pm @@ -98,6 +98,9 @@ sub run_hook { } elsif ($hook eq 'update-buildflags') { my $flags = shift @params; + # Run the Debian hook to add hardening flags + $self->SUPER::run_hook($hook, $flags); + require Dpkg::BuildOptions; my $build_opts = Dpkg::BuildOptions->new(); @@ -109,15 +112,14 @@ sub run_hook { if (Dpkg::Arch::debarch_eq($arch, 'ppc64el')) { for my $flag (qw(CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS GCJFLAGS FFLAGS FCFLAGS)) { - $flags->set($flag, '-g -O3', 'vendor'); + my $value = $flags->get($flag); + $value =~ s/-O[0-9]/-O3/; + $flags->set($flag, $value); } } } # Per https://wiki.ubuntu.com/DistCompilerFlags - $flags->set('LDFLAGS', '-Wl,-Bsymbolic-functions', 'vendor'); - - # Run the Debian hook to add hardening flags - $self->SUPER::run_hook($hook, $flags); + $flags->prepend('LDFLAGS', '-Wl,-Bsymbolic-functions'); } else { return $self->SUPER::run_hook($hook, @params); } |