Package: dpkg
Version: 1.19.2
Followup-For: Bug #915881
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu disco ubuntu-patch



In Ubuntu, the attached patch was applied to achieve the following:

  * scripts/Dpkg/Vendor/Ubuntu.pm: Instead of running the Debian hooks after
    the Ubuntu buildflags are set up, run them first, and then strip/prepend
    the bits we need to change. This fixes compiler optimisation on ppc64el.

This is vaguely similar to Laney's patch, but produces more pleasant output,
and is also what I uploaded to Ubuntu just now to solve the problem.

... Adam

-- System Information:
Debian Release: buster/sid
  APT prefers disco
  APT policy: (500, 'disco')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-11-lowlatency (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_CA:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru dpkg-1.19.2ubuntu1/debian/control dpkg-1.19.2ubuntu2/debian/control
--- dpkg-1.19.2ubuntu1/debian/control   2018-11-27 11:28:33.000000000 -0700
+++ dpkg-1.19.2ubuntu2/debian/control   2018-12-07 10:51:35.000000000 -0700
@@ -1,8 +1,7 @@
 Source: dpkg
 Section: admin
 Priority: required
-Maintainer: Ubuntu Developers <ubuntu-devel-disc...@lists.ubuntu.com>
-XSBC-Original-Maintainer: Dpkg Developers <debian-d...@lists.debian.org>
+Maintainer: Dpkg Developers <debian-d...@lists.debian.org>
 Uploaders: Guillem Jover <guil...@debian.org>
 Origin: debian
 Bugs: debbugs://bugs.debian.org
diff -Nru dpkg-1.19.2ubuntu1/scripts/Dpkg/Vendor/Ubuntu.pm 
dpkg-1.19.2ubuntu2/scripts/Dpkg/Vendor/Ubuntu.pm
--- dpkg-1.19.2ubuntu1/scripts/Dpkg/Vendor/Ubuntu.pm    2018-10-07 
16:05:11.000000000 -0600
+++ dpkg-1.19.2ubuntu2/scripts/Dpkg/Vendor/Ubuntu.pm    2018-12-07 
10:51:28.000000000 -0700
@@ -98,6 +98,9 @@
     } 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,13 @@
             if (Dpkg::Arch::debarch_eq($arch, 'ppc64el')) {
                for my $flag (qw(CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS GCJFLAGS
                                 FFLAGS FCFLAGS)) {
-                   $flags->set($flag, '-g -O3', 'vendor');
+                   $flags->strip($flag, '-g -O2', 'vendor');
+                   $flags->prepend($flag, '-g -O3', 'vendor');
                }
            }
        }
        # 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', 'vendor');
     } else {
         return $self->SUPER::run_hook($hook, @params);
     }

Reply via email to