diff options
author | Matthias Maennich <maennich@google.com> | 2020-03-11 22:34:24 +0100 |
---|---|---|
committer | Matthias Maennich <maennich@google.com> | 2020-03-11 22:34:24 +0100 |
commit | 8953dff594fea43fa1c51a0ea321314f0e647816 (patch) | |
tree | f983b7e8f1628d1f7f155139ece5040d46bb69ec | |
parent | 657789df0679ff19758a57ff2c3bbd9b2a2a0e09 (diff) | |
download | build-8953dff594fea43fa1c51a0ea321314f0e647816.tar.gz |
abi: extract_symbols: add --skip-module-grouping option
Add the --skip-module-grouping option to abi/extract_symbols to allow
creating whitelists without symbols grouped by requiring module.
This option is reducing maintainability of the whitelists, but might
create the preferred format for the SoC/vendor.
Bug: 151133259
Signed-off-by: Matthias Maennich <maennich@google.com>
Change-Id: Ib7b57888b692cc6f5fa71a95452bc1777a4696e1
-rwxr-xr-x | abi/extract_symbols | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/abi/extract_symbols b/abi/extract_symbols index 5409889e..0c1ff0cb 100755 --- a/abi/extract_symbols +++ b/abi/extract_symbols @@ -116,7 +116,7 @@ def report_missing(module_symbols, exported): symbol, module)) -def create_whitelist(whitelist, undefined_symbols, exported): +def create_whitelist(whitelist, undefined_symbols, exported, module_grouping): """Create a symbol whitelist for libabigail.""" symbol_counter = collections.Counter( itertools.chain.from_iterable(undefined_symbols.values())) @@ -126,12 +126,14 @@ def create_whitelist(whitelist, undefined_symbols, exported): common_wl_section = symbol_sort([ symbol for symbol, count in symbol_counter.items() - if count > 1 and symbol in exported + if (count > 1 or not module_grouping) and symbol in exported ] + _ALWAYS_WHITELISTED) # write the header wl.write("[abi_whitelist]\n") - wl.write("# commonly used symbols\n ") + if module_grouping: + wl.write("# commonly used symbols\n") + wl.write(" ") wl.write("\n ".join(common_wl_section)) wl.write("\n") @@ -178,6 +180,13 @@ def main(): default="/dev/stdout", help="The whitelist to create") + parser.add_argument( + "--skip-module-grouping", + action="store_false", + dest="module_grouping", + default=True, + help="Do not group symbols by module.") + args = parser.parse_args() if not os.path.isdir(args.directory): @@ -213,7 +222,8 @@ def main(): if args.whitelist: create_whitelist( args.whitelist, undefined_symbols, - all_exported if args.include_module_exports else exported_in_vmlinux) + all_exported if args.include_module_exports else exported_in_vmlinux, + args.module_grouping) if __name__ == "__main__": |