From c8a97fea141aec6dcab720545a21357b8a570e57 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Mon, 26 Jan 2026 09:15:05 -0500 Subject: [PATCH] Pass --drop-private-types & --headers-dir to abidw The --headers-dir option tells abidw where to find the headers for it to consider. In abidw 2.8 and later, it implies --drop-private-types, thus evaluating only ABI changes in header files, not private ABI changes. Pass it explicitly in order to support earlier versions, as well. This change requires setting the options later in execution, so that `$installdir` is available to pass as part of the --headers-dir option. Only append the --drop-private-types option if it hasn't already been specified in the `abidw_flags_list` configuration, but always pass --headers-dir, since it can be specified multiple times, and we always want to include the Postgres headers. --- PGBuild/Modules/ABICompCheck.pm | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/PGBuild/Modules/ABICompCheck.pm b/PGBuild/Modules/ABICompCheck.pm index 53b246d..dad5d3a 100644 --- a/PGBuild/Modules/ABICompCheck.pm +++ b/PGBuild/Modules/ABICompCheck.pm @@ -259,15 +259,6 @@ sub setup my $abi_compare_root = $conf->{abi_compare_root} || "$buildroot/abicheck.$conf->{animal}"; - # Configure abidw tool flags for ABI XML generation - my $abidw_flags_list = $conf->{abi_comp_check}{abidw_flags_list} - || [ - qw( - --drop-undefined-syms --no-architecture --no-comp-dir-path - --no-elf-needed --no-show-locs --type-id-style hash - ) - ]; - # the tag_for_branch is to specify a tag to compare the ABIs with in a specific branch # expected to look like { : } my $tag_for_branch = $conf->{abi_comp_check}{tag_for_branch} || {}; @@ -285,7 +276,6 @@ sub setup srcdir => $srcdir, using_meson => $using_meson, abi_compare_root => $abi_compare_root, - abidw_flags_list => $abidw_flags_list, tag_for_branch => $tag_for_branch, }; bless($self, $class); @@ -811,7 +801,21 @@ sub _generate_abidw_xml ; # either comparison ref(i.e. baseline commit/tag) OR branch name Because both are expected to have separate path for install directories my $binaries_rel_path = shift; - my $abidw_flags_str = join ' ', @{ $self->{abidw_flags_list} }; + # Configure abidw tool flags for ABI XML generation. Only evaluate types + # published in headers. --headers-dir implies --drop-private-types in + # adbidw 2.8 and higher, but not older versions, so include it explicitly. + my $abidw_flags_str; + if (my $flags = $self->{bfconf}{abi_comp_check}{abidw_flags_list}) + { + push @{ $flags }, '--drop-private-types' + unless grep { $_ eq '--drop-private-types' } @{ $flags }; + $abidw_flags_str = join ' ', @{ $flags }, qq{--headers-dir "$install_dir/include"}; + } else { + $abidw_flags_str = '--drop-undefined-syms --no-architecture ' + . '--no-comp-dir-path --no-elf-needed --no-show-locs ' + . '--type-id-style hash --drop-private-types ' + . qq{--headers-dir "$install_dir/include"}; + } # Determine if this is for a baseline or current branch my $xml_dir;