From: Nick Alcock Date: Thu, 22 Nov 2012 09:34:41 +0000 (+0000) Subject: ctf: update the shared CTF file right after initialization X-Git-Tag: v4.1.12-92~313^2~96 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=93b780cdc4b5b0338b1cf7c19cfd163601ac1b8c;p=users%2Fjedix%2Flinux-maple.git ctf: update the shared CTF file right after initialization If we don't do this, the void and function pointer types are not available for lookup until something else gets added to the shared type repository and triggers an update, so insertions of types depending on such types into the shared type repository will fail until that happens. Since function pointers are seen a lot in structures in the Linux kernel, such a failure for a member of a structure means that all later members of the structure are skipped, and since a major cause of insertion into the shared type repository is recursive insertion from structure members in headers, this has the effect of losing track of quite a lot of types first seen in translation units mentioned early on the dwarf2ctf command line. Fortunately, since they haven't been successfully inserted, insertion is retried later and succeeds. So this bugfix fixes a latent bug only. We would have seen this long ago as a bunch of error output were it not for a bug in libdtrace-ctf leading to bad ID errors in CTF lookups that recurse to parents not being emitted anywhere we were looking for them. Fixing that bug requires us to fix this one, lest we get bombed with error messages henceforward. Signed-off-by: Nick Alcock --- diff --git a/scripts/dwarf2ctf/dwarf2ctf.c b/scripts/dwarf2ctf/dwarf2ctf.c index 8bf7cf62e8b9a..8726b652ef3a9 100644 --- a/scripts/dwarf2ctf/dwarf2ctf.c +++ b/scripts/dwarf2ctf/dwarf2ctf.c @@ -976,6 +976,12 @@ static ctf_file_t *init_ctf_table(const char *module_name) &func_info, NULL); ctf_funcptr_type = ctf_add_pointer(ctf_file, CTF_ADD_ROOT, func_type); + + if (ctf_update(ctf_file) < 0) { + fprintf(stderr, "Cannot initialize shared CTF " + "file: %s\n", ctf_errmsg(ctf_errno(ctf_file))); + exit(1); + } } else { /* * Local types module with deduplication enabled: point the