Skip to content
Snippets Groups Projects
Commit df7627ac authored by Guillem Jover's avatar Guillem Jover
Browse files

Dpkg::Vendor::Ubuntu: Handle LTO by default using new feature overrides

parent 372d2a73
No related branches found
No related tags found
1 merge request!4Update crimson to version from bookworm
......@@ -24,6 +24,8 @@ use warnings;
our $VERSION = '0.01';
use List::Util qw(any);
use Dpkg::ErrorHandling;
use Dpkg::Gettext;
use Dpkg::Control::Types;
......@@ -115,6 +117,10 @@ sub set_build_features {
require Dpkg::Arch;
my $arch = Dpkg::Arch::get_host_arch();
if (any { $_ eq $arch } qw(amd64 arm64 ppc64el s390x)) {
$flags->set_feature('optimize', 'lto', 1);
}
if ($arch eq 'ppc64el' && $flags->get_option_value('optimize-level') != 0) {
$flags->set_option_value('optimize-level', 3);
}
......
......@@ -16,7 +16,7 @@
use strict;
use warnings;
use Test::More tests => 16;
use Test::More tests => 18;
BEGIN {
use_ok('Dpkg::BuildFlags');
......@@ -33,6 +33,15 @@ sub test_optflag
}
}
sub test_ltoflag
{
my $bf = shift;
# Test the LTO flags enabled by default on some arches.
ok($bf->get('LDFLAGS') =~ m/-flto=auto -ffat-lto-objects/,
"LDFLAGS contains LTO flags on $ENV{DEB_HOST_ARCH}");
}
my $bf;
# Force loading the Dpkg::Vendor::Ubuntu module.
......@@ -43,6 +52,7 @@ $ENV{DEB_HOST_ARCH} = 'amd64';
$bf = Dpkg::BuildFlags->new();
test_optflag($bf, '-O2');
test_ltoflag($bf);
# Test the overlaid Ubuntu-specific linker flag.
ok($bf->get('LDFLAGS') =~ m/-Wl,-Bsymbolic-functions/,
......@@ -53,5 +63,6 @@ $ENV{DEB_HOST_ARCH} = 'ppc64el';
$bf = Dpkg::BuildFlags->new();
test_optflag($bf, '-O3');
test_ltoflag($bf);
1;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment