Messages in this thread | | | Subject | Re: [RFC PATCH 0/3] Mark literal strings in __init / __exit code | From | Joe Perches <> | Date | Sun, 22 Jun 2014 18:30:15 -0700 |
| |
On Mon, 2014-06-23 at 00:46 +0200, Mathias Krause wrote: > This RFC series tries to address the problem of dangling strings of > __init functions after initialization, as well as __exit strings for > code not even included in the final kernel image. The code might get > freed, but the format strings are not. > > One solution to the problem might be to declare variables in the code > and mark those variables as __initconst. That, though, makes the code > ugly, as can be seen, e.g., in drivers/hwmon/w83627ehf.c -- a pile of > 'static const char[] __initconst' lines just for the pr_info() call.
Another solution might be, as David Daney suggested, using gcc 4.5+ plug-ins to extract these format strings and const char * arrays into specific sections automatically.
https://lkml.org/lkml/2009/7/21/483
Seems feasible, but there might be a negative of string duplication in multiple sections that would otherwise be consolidated into a single object.
| |