From 0b4524fa93c46fdef52a8e0af855391c41555cfd Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Thu, 7 Sep 2017 10:10:10 +0100 Subject: [PATCH] ctf: delete the deduplication blacklist This kludge has been automated away. Signed-off-by: Nick Alcock Reviewed-by: Tomas Jedlicka Orabug: 26765112 --- scripts/Makefile.modpost | 2 +- scripts/dwarf2ctf/dwarf2ctf.c | 125 +++------------------------------- 2 files changed, 9 insertions(+), 118 deletions(-) diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 0c3c924fbb11..c4b6fcd00d88 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -184,7 +184,7 @@ cmd-touch-ctf = @: ifeq ($(KBUILD_EXTMOD),) ctf-dir-mk := quiet_cmd_ctf = CTFA - cmd_ctf = scripts/dwarf2ctf/dwarf2ctf $(CTF_FILENAME) $(srctree) objects.builtin modules.builtin $(srctree)/scripts/dwarf2ctf/dedup.blacklist $(srctree)/scripts/dwarf2ctf/member.blacklist $(ctf-filelist) + cmd_ctf = scripts/dwarf2ctf/dwarf2ctf $(CTF_FILENAME) $(srctree) objects.builtin modules.builtin $(srctree)/scripts/dwarf2ctf/member.blacklist $(ctf-filelist) ctf-builtins := $(CTF_DEBUGDIR)/vmlinux ctf-modules := $(shell find $(CTF_DEBUGDIR) \( -name '*.ko' -o -name '*.ko.debug' \) -print) ctf-filelist := .ctf.filelist diff --git a/scripts/dwarf2ctf/dwarf2ctf.c b/scripts/dwarf2ctf/dwarf2ctf.c index 8cd015802484..516812dbb944 100644 --- a/scripts/dwarf2ctf/dwarf2ctf.c +++ b/scripts/dwarf2ctf/dwarf2ctf.c @@ -177,30 +177,6 @@ static size_t builtin_objects_cnt; static void init_builtin(const char *builtin_objects_file, const char *builtin_module_file); -/* - * The deduplication blacklist bans specific modules that do notably insane - * things with the preprocessor from participating in deduplication. The list - * of sins is short: things like #including two different source files that - * proceed to add or remove members from structures depending on which source - * file they were included from. - * - * These modules share no types whatsoever with the rest of the kernel. - * - * This is, of course, only used if deduplication is turned on. - */ -static GHashTable *dedup_blacklist; - -/* - * Populate the deduplication blacklist from the dedup_blacklist file. - */ -static void init_dedup_blacklist(const char *dedup_blacklist_file); - -/* - * See if the given module is blacklisted, and update state accordingly so that - * type IDs are appropriately augmented. - */ -static void dedup_blacklisted_module(const char *module_name); - /* * The member blacklist bans fields with specific names in specifically named * structures, declared in specific source files, from being emitted. The @@ -839,11 +815,11 @@ int main(int argc, char *argv[]) exit(1); } - if ((argc != 4 && argc != 8) || + if ((argc != 4 && argc != 7) || (argc == 4 && strcmp(argv[2], "-e") != 0)) { fprintf(stderr, "Syntax: dwarf2ctf output-file srcdir " - "objects.builtin modules.builtin dedup.blacklist\n"); - fprintf(stderr, " member.blacklist filelist\n"); + "objects.builtin modules.builtin member.blacklist\n"); + fprintf(stderr, " filelist\n"); fprintf(stderr, " or dwarf2ctf output-dir -e filelist\n" "for external module use\n"); exit(1); @@ -870,19 +846,16 @@ int main(int argc, char *argv[]) const char *srcdir; char *builtin_objects_file; char *builtin_module_file; - char *dedup_blacklist_file; char *member_blacklist_file; srcdir = argv[2]; builtin_objects_file = argv[3]; builtin_module_file = argv[4]; - dedup_blacklist_file = argv[5]; - member_blacklist_file = argv[6]; + member_blacklist_file = argv[5]; init_builtin(builtin_objects_file, builtin_module_file); - init_dedup_blacklist(dedup_blacklist_file); init_member_blacklist(member_blacklist_file, srcdir); - init_object_names(argv[7]); + init_object_names(argv[6]); run(output, 0); } else { @@ -1168,72 +1141,6 @@ static void init_assembly_tab(void) } } -/* - * Populate the deduplication blacklist from the dedup_blacklist file. - */ -static void init_dedup_blacklist(const char *dedup_blacklist_file) -{ - FILE *f; - char *line = NULL; - size_t line_size = 0; - - /* - * Not having a deduplication blacklist is not an error. - */ - if ((f = fopen(dedup_blacklist_file, "r")) == NULL) - return; - - dedup_blacklist = g_hash_table_new(g_str_hash, g_str_equal); - - while (getline(&line, &line_size, f) >= 0) { - size_t len = strlen(line); - - if (len == 0) - continue; - - if (line[len-1] == '\n') - line[len-1] = '\0'; - - - g_hash_table_insert(dedup_blacklist, xstrdup(line), NULL); - } - free(line); - - if (ferror(f)) { - fprintf(stderr, "Error reading from %s: %s\n", - dedup_blacklist_file, strerror(errno)); - exit(1); - } - - fclose(f); -} - -/* - * See if the given module is blacklisted, and update state accordingly so that - * type IDs are appropriately augmented. - */ -static void dedup_blacklisted_module(const char *module_name) -{ - if (dedup_blacklist == NULL) - return; - if (g_hash_table_lookup_extended(dedup_blacklist, module_name, - NULL, NULL)) { - /* - * The prefix goes before the DWARF file pathname, so we pick - * something that is not going to be a valid path on any POSIX - * system. - */ - free(blacklist_type_prefix); - blacklist_type_prefix = NULL; - blacklist_type_prefix = str_appendn(blacklist_type_prefix, - "/dev/null/@blacklisted: ", - module_name, "@", NULL); - } else { - free(blacklist_type_prefix); - blacklist_type_prefix = NULL; - } -} - /* * Populate the member blacklist from the member_blacklist file. */ @@ -1924,13 +1831,6 @@ static void process_file(const char *file_name, break; } - - /* - * This arranges to augment type IDs appropriately for - * dedup-blacklisted modules for everything that uses - * process_file(). We reset it at the end. - */ - dedup_blacklisted_module(module_name); if (tu_init != NULL) tu_init(module_name, file_name, tu_die, data); @@ -1940,7 +1840,6 @@ static void process_file(const char *file_name, if (tu_done != NULL) tu_done(module_name, file_name, tu_die, data); } - dedup_blacklisted_module(""); free(fn_module_name); simple_dwfl_free(dwfl); @@ -2199,10 +2098,7 @@ static void detect_duplicates(const char *module_name, * modules get their names and locations recorded for subsequent passes; * all type_id()-descendant types are similarly noted. */ - if (is_sou && strncmp(id, "////", strlen("////")) != 0 && - (dedup_blacklist == NULL || - !g_hash_table_lookup_extended(dedup_blacklist, module_name, - NULL, NULL))) + if (is_sou && strncmp(id, "////", strlen("////")) != 0) free(type_id(die, NULL, detect_duplicates_will_rescan, state)); /* @@ -2351,8 +2247,8 @@ static enum needs_sharing type_needs_sharing(const char *module_name, /* * Types not already known about do not need sharing. * - * Types on the dedup blacklist, types already in the current modules, - * and any types in external-module mode do not even need marking. + * Types already in the current modules and any types in external-module + * mode do not even need marking. */ if (existing_type_module == NULL) return NS_NOT_SHARED; @@ -2362,11 +2258,6 @@ static enum needs_sharing type_needs_sharing(const char *module_name, (builtin_modules == NULL)) return NS_NO_MARKING; - if (dedup_blacklist != NULL && - g_hash_table_lookup_extended(dedup_blacklist, module_name, - NULL, NULL)) - return NS_NO_MARKING; - return NS_NEEDS_SHARING; } -- 2.50.1