From: Mark Wielaard <mark@klomp.org>
To: libabigail@sourceware.org
Cc: Dodji Seketeli <dodji@seketeli.org>, Mark Wielaard <mark@klomp.org>
Subject: [PATCH 2/2] Add --drop-private-types to abidw.
Date: Sun, 12 Apr 2020 03:47:57 +0200 [thread overview]
Message-ID: <20200412014757.30688-2-mark@klomp.org> (raw)
In-Reply-To: <20200412014757.30688-1-mark@klomp.org>
To create smaller abi XML files it is useful to be able to drop
the private types from the representation.
* tools/abidw.cc (options): Add drop_private_types bool.
(display_usage): Add --drop-private-types.
(parse_command_line): Parse --drop-private-types, set opts.
(set_suppressions): Call set_drops_artifact_from_ir when
drop_private_types set.
* doc/manuals/abidw.rst: Document --drop-private-types.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
doc/manuals/abidw.rst | 8 ++++++++
tools/abidw.cc | 13 +++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/doc/manuals/abidw.rst b/doc/manuals/abidw.rst
index 8f6c3c39..05a90003 100644
--- a/doc/manuals/abidw.rst
+++ b/doc/manuals/abidw.rst
@@ -138,6 +138,14 @@ Options
that the tool has to consider. The tool will thus filter out
types that are not defined in public headers.
+ * ``--drop-private-types``
+
+ This option is to be used with the ``--headers-dir`` and/or
+ ``header-file`` options. With this option, types that are *NOT*
+ defined in the headers are entirely dropped from the internal
+ representation build by Libabigail to represent the ABI and will
+ not end up in the abi XML file.
+
* ``--no-linux-kernel-mode``
Without this option, if abipkgiff detects that the binaries it is
diff --git a/tools/abidw.cc b/tools/abidw.cc
index a8b9ad32..8b163ccd 100644
--- a/tools/abidw.cc
+++ b/tools/abidw.cc
@@ -109,6 +109,7 @@ struct options
bool abidiff;
bool annotate;
bool do_log;
+ bool drop_private_types;
options()
: display_version(),
@@ -126,7 +127,8 @@ struct options
show_locs(true),
abidiff(),
annotate(),
- do_log()
+ do_log(),
+ drop_private_types(false)
{}
~options()
@@ -158,6 +160,7 @@ display_usage(const string& prog_name, ostream& out)
<< " --no-corpus-path do not take the path to the corpora into account\n"
<< " --no-show-locs do not show location information\n"
<< " --short-locs only print filenames rather than paths\n"
+ << " --drop-private-types drop private types from representation\n"
<< " --no-comp-dir-path do not show compilation path information\n"
<< " --check-alternate-debug-info <elf-path> check alternate debug info "
"of <elf-path>\n"
@@ -294,6 +297,8 @@ parse_command_line(int argc, char* argv[], options& opts)
}
else if (!strcmp(argv[i], "--load-all-types"))
opts.load_all_types = true;
+ else if (!strcmp(argv[i], "--drop-private-types"))
+ opts.drop_private_types = true;
else if (!strcmp(argv[i], "--no-linux-kernel-mode"))
opts.linux_kernel_mode = false;
else if (!strcmp(argv[i], "--abidiff"))
@@ -403,7 +408,11 @@ set_suppressions(read_context& read_ctxt, options& opts)
abigail::tools_utils::gen_suppr_spec_from_headers(opts.headers_dir,
opts.header_files);
if (suppr)
- supprs.push_back(suppr);
+ {
+ if (opts.drop_private_types)
+ suppr->set_drops_artifact_from_ir(true);
+ supprs.push_back(suppr);
+ }
using abigail::tools_utils::gen_suppr_spec_from_kernel_abi_whitelists;
const suppressions_type& wl_suppr =
--
2.18.2
next prev parent reply other threads:[~2020-04-12 1:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-05 14:38 Surprising behavior of suppress_type drop = yes Mark Wielaard
2020-04-06 17:15 ` Dodji Seketeli
2020-04-08 14:32 ` Mark Wielaard
2020-04-09 13:52 ` Dodji Seketeli
2020-04-12 1:44 ` Mark Wielaard
2020-04-12 1:47 ` [PATCH 1/2] Add --header-file option to add individual public header files Mark Wielaard
2020-04-12 1:47 ` Mark Wielaard [this message]
2020-04-14 15:37 ` [PATCH 2/2] Add --drop-private-types to abidw Dodji Seketeli
2020-04-14 15:19 ` [PATCH 1/2] Add --header-file option to add individual public header files Dodji Seketeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200412014757.30688-2-mark@klomp.org \
--to=mark@klomp.org \
--cc=dodji@seketeli.org \
--cc=libabigail@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).