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

Dpkg::Vendor::Debian: Add new lto feature in new optimize area

This new setting, disabled by default, enables the Link Time
Optimization.

Closes: #940571
parent c5d2358a
No related branches found
No related tags found
1 merge request!4Update crimson to version from bookworm
......@@ -354,6 +354,24 @@ B<LDFLAGS> set to B<-Wl,-z,deb-canary->I<random-id>.
=back
=head2 optimize
Several compile-time options (detailed below) can be used to help optimize
a resulting binary (since dpkg 1.21.0).
B<Note>: enabling B<all> these options can result in unreproducible binary
artifacts.
=over
=item lto
This setting (since dpkg 1.21.0; disabled by default) enables
Link Time Optimization by adding B<-flto=auto -ffat-lto-objects> to
B<CFLAGS>, B<CXXFLAGS>, B<OBJCFLAGS>, B<OBJCXXFLAGS>, B<GCJFLAGS>,
B<FFLAGS>, B<FCFLAGS> and B<LDFLAGS>.
=back
=head2 sanitize
Several compile-time options (detailed below) can be used to help sanitize
......
......@@ -108,6 +108,9 @@ sub _add_build_flags {
fixfilepath => 1,
fixdebugpath => 1,
},
optimize => {
lto => 0,
},
sanitize => {
address => 0,
thread => 0,
......@@ -268,6 +271,13 @@ sub _add_build_flags {
$flags->append($_, $map) foreach @compile_flags;
}
## Area: optimize
if ($use_feature{optimize}{lto}) {
my $flag = '-flto=auto -ffat-lto-objects';
$flags->append($_, $flag) foreach (@compile_flags, 'LDFLAGS');
}
## Area: sanitize
# Handle logical feature interactions.
......
......@@ -16,7 +16,7 @@
use strict;
use warnings;
use Test::More tests => 26;
use Test::More tests => 28;
BEGIN {
$ENV{DEB_BUILD_ARCH} = 'amd64';
......@@ -71,6 +71,9 @@ my %known_features = (
fixfilepath
timeless
) ],
optimize => [ qw(
lto
) ],
sanitize => [ qw(
address
leak
......
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