| 638e69cf | 28-Feb-2018 |
Rasmus Villemoes <linux@rasmusvillemoes.dk> |
fixdep: do not ignore kconfig.h
kconfig.h was excluded from consideration by fixdep by 6a5be57f0f00 (fixdep: fix extraneous dependencies) to avoid some false positive hits
(1) include/config/.h (2)
fixdep: do not ignore kconfig.h
kconfig.h was excluded from consideration by fixdep by 6a5be57f0f00 (fixdep: fix extraneous dependencies) to avoid some false positive hits
(1) include/config/.h (2) include/config/h.h (3) include/config/foo.h
(1) occurred because kconfig.h contains the string CONFIG_ in a comment. However, since dee81e988674 (fixdep: faster CONFIG_ search), we have a check that the part after CONFIG_ is non-empty, so this does not happen anymore (and CONFIG_ appears by itself elsewhere, so that check is worthwhile).
(2) comes from the include guard, __LINUX_KCONFIG_H. But with the previous patch, we no longer match that either.
That leaves (3), which amounts to one [1] false dependency (aka stat() call done by make), which I think we can live with:
We've already had one case [2] where the lack of include/linux/kconfig.h in the .o.cmd file caused a missing rebuild, and while I originally thought we should just put kconfig.h in the dependency list without parsing it for the CONFIG_ pattern, we actually do have some real CONFIG_ symbols mentioned in it, and one can imagine some translation unit that just does '#ifdef __BIG_ENDIAN' but doesn't through some other header actually depend on CONFIG_CPU_BIG_ENDIAN - so changing the target endianness could end up rebuilding the world, minus that small TU. Quoting Linus,
... when missing dependencies cause a missed re-compile, the resulting bugs can be _really_ subtle.
[1] well, two, we now also have CONFIG_BOOGER/booger.h - we could change that to FOO if we care
[2] https://lkml.org/lkml/2018/2/22/838
Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
show more ...
|
| 5b8ad96d | 28-Feb-2018 |
Rasmus Villemoes <linux@rasmusvillemoes.dk> |
fixdep: remove some false CONFIG_ matches
The string CONFIG_ quite often appears after other alphanumerics, meaning that that instance cannot be referencing a Kconfig symbol. Omitting these means ma
fixdep: remove some false CONFIG_ matches
The string CONFIG_ quite often appears after other alphanumerics, meaning that that instance cannot be referencing a Kconfig symbol. Omitting these means make has fewer files to stat() when deciding what needs to be rebuilt - for a defconfig build, this seems to remove about 2% of the (wildcard ...) lines from the .o.cmd files.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
show more ...
|
| ab9ce9fe | 11-Jan-2018 |
Masahiro Yamada <yamada.masahiro@socionext.com> |
fixdep: use existing helper to check modular CONFIG options
str_ends_with() tests if the given token ends with a particular string. Currently, it is used to check file paths without $(srctree).
Act
fixdep: use existing helper to check modular CONFIG options
str_ends_with() tests if the given token ends with a particular string. Currently, it is used to check file paths without $(srctree).
Actually, we have one more place where this helper is useful. Use it to check if CONFIG option ends with _MODULE.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
show more ...
|
| 87b95a81 | 11-Jan-2018 |
Masahiro Yamada <yamada.masahiro@socionext.com> |
fixdep: refactor parse_dep_file()
parse_dep_file() has too much indentation, and puts the code far to the right. This commit refactors the code and reduces the one level of indentation.
strrcmp()
fixdep: refactor parse_dep_file()
parse_dep_file() has too much indentation, and puts the code far to the right. This commit refactors the code and reduces the one level of indentation.
strrcmp() computes 'slen' by itself, but the caller already knows the length of the token, so 'slen' can be passed via function argument. With this, we can swap the order of strrcmp() and "*p = \0;"
Also, strrcmp() is an ambiguous function name. Flip the logic and rename it to str_ends_with().
I added a new helper is_ignored_file() - this returns 1 if the token represents a file that should be ignored.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
show more ...
|
| 5d1ef76f | 11-Jan-2018 |
Masahiro Yamada <yamada.masahiro@socionext.com> |
fixdep: move global variables to local variables of main()
I do not mind global variables where they are useful enough. In this case, I do not see a good reason to use global variables since they a
fixdep: move global variables to local variables of main()
I do not mind global variables where they are useful enough. In this case, I do not see a good reason to use global variables since they are just referenced in shallow places. It is easy to pass them via function arguments.
I squashed print_cmdline() into main() since it is just one line code.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
show more ...
|
| ccfe7887 | 11-Jan-2018 |
Masahiro Yamada <yamada.masahiro@socionext.com> |
fixdep: remove unneeded memcpy() in parse_dep_file()
Each token in the depfile is copied to the temporary buffer 's' to terminate the token with zero. We do not need to do this any more because the
fixdep: remove unneeded memcpy() in parse_dep_file()
Each token in the depfile is copied to the temporary buffer 's' to terminate the token with zero. We do not need to do this any more because the parsed buffer is now writable. Insert '\0' directly in the buffer without calling memcpy().
<limits.h> is no longer necessary. (It was needed for PATH_MAX).
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
show more ...
|
| 4003fd80 | 11-Jan-2018 |
Masahiro Yamada <yamada.masahiro@socionext.com> |
fixdep: factor out common code for reading files
Now, do_config_files() and print_deps() are almost the same. Only the difference is the parser function called (parse_config_file vs parse_dep_file)
fixdep: factor out common code for reading files
Now, do_config_files() and print_deps() are almost the same. Only the difference is the parser function called (parse_config_file vs parse_dep_file).
We can reduce the code duplication by factoring out the common code into read_file() - this function allocates a buffer and loads a file to it. It returns the pointer to the allocated buffer. (As before, it bails out by exit(2) for any error.) The caller must free the buffer when done.
Having empty source files is possible; fixdep should simply skip them. I deleted the "st.st_size == 0" check, so read_file() allocates 1-byte buffer for an empty file. strstr() will immediately return NULL, and this is what we expect.
On the other hand, an empty dep_file should be treated as an error. In this case, parse_dep_file() will error out with "no targets found" and it is a correct error message.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
show more ...
|
| 01b5cbe7 | 11-Jan-2018 |
Masahiro Yamada <yamada.masahiro@socionext.com> |
fixdep: use malloc() and read() to load dep_file to buffer
Commit dee81e988674 ("fixdep: faster CONFIG_ search") changed how to read files in which CONFIG options are searched. It used malloc() and
fixdep: use malloc() and read() to load dep_file to buffer
Commit dee81e988674 ("fixdep: faster CONFIG_ search") changed how to read files in which CONFIG options are searched. It used malloc() and read() instead of mmap() because it needed to zero-terminate the buffer in order to use strstr(). print_deps() was left untouched since there was no reason to change it.
Now, I have two motivations to change it in the same way.
- do_config_file() and print_deps() do quite similar things; they open a file, load it onto memory, and pass it to a parser function. If we use malloc() and read() for print_deps() too, we can factor out the common code. (I will do this in the next commit.)
- parse_dep_file() copies each token to a temporary buffer because it needs to zero-terminate it to be passed to printf(). It is not possible to modify the buffer directly because it is mmap'ed with O_RDONLY. If we load the file content into a malloc'ed buffer, we can insert '\0' after each token, and save memcpy(). (I will do this in the commit after next.)
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
show more ...
|
| 41f92cff | 11-Jan-2018 |
Masahiro Yamada <yamada.masahiro@socionext.com> |
fixdep: remove unnecessary <arpa/inet.h> inclusion
<arpa/inet.h> was included for ntohl(), but it was removed by commit dee81e988674 ("fixdep: faster CONFIG_ search").
Signed-off-by: Masahiro Yamad
fixdep: remove unnecessary <arpa/inet.h> inclusion
<arpa/inet.h> was included for ntohl(), but it was removed by commit dee81e988674 ("fixdep: faster CONFIG_ search").
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
show more ...
|
| c1a95fda | 22-Jan-2016 |
Nicolas Pitre <nicolas.pitre@linaro.org> |
kbuild: add fine grained build dependencies for exported symbols
Like with kconfig options, we now have the ability to compile in and out individual EXPORT_SYMBOL() declarations based on the content
kbuild: add fine grained build dependencies for exported symbols
Like with kconfig options, we now have the ability to compile in and out individual EXPORT_SYMBOL() declarations based on the content of include/generated/autoksyms.h. However we don't want the entire world to be rebuilt whenever that file is touched.
Let's apply the same build dependency trick used for CONFIG_* symbols where the time stamp of empty files whose paths matching those symbols is used to trigger fine grained rebuilds. In our case the key is the symbol name passed to EXPORT_SYMBOL().
However, unlike config options, we cannot just use fixdep to parse the source code for EXPORT_SYMBOL(ksym) because several variants exist and parsing them all in a separate tool, and keeping it in synch, is not trivially maintainable. Furthermore, there are variants such as
EXPORT_SYMBOL_GPL(pci_user_read_config_##size);
that are instanciated via a macro for which we can't easily determine the actual exported symbol name(s) short of actually running the preprocessor on them.
Storing the symbol name string in a special ELF section doesn't work for targets that output assembly or preprocessed source.
So the best way is really to leverage the preprocessor by having it output actual symbol names anchored by a special sequence that can be easily filtered out. Then the list of symbols is simply fed to fixdep to be merged with the other dependencies.
That implies the preprocessor is executed twice for each source file. A previous attempt relied on a warning pragma for each EXPORT_SYMBOL() instance that was filtered apart from stderr by the build system with a sed script during the actual compilation pass. Unfortunately the preprocessor/compiler diagnostic output isn't stable between versions and this solution, although more efficient, was deemed too fragile.
Because of the lowercasing performed by fixdep, there might be name collisions triggering spurious rebuilds for similar symbols. But this shouldn't be a big issue in practice. (This is the case for CONFIG_* symbols and I didn't want to be different here, whatever the original reason for doing so.)
To avoid needless build overhead, the exported symbol name gathering is performed only when CONFIG_TRIM_UNUSED_KSYMS is selected.
Signed-off-by: Nicolas Pitre <nico@linaro.org> Acked-by: Rusty Russell <rusty@rustcorp.com.au>
show more ...
|
| d179e227 | 24-Jul-2015 |
Masahiro Yamada <yamada.masahiro@socionext.com> |
kbuild: fixdep: drop meaningless hash table initialization
The clear_config() is called just once at the beginning of this program, but the global variable hashtab[] is already zero-filled at the st
kbuild: fixdep: drop meaningless hash table initialization
The clear_config() is called just once at the beginning of this program, but the global variable hashtab[] is already zero-filled at the start-up.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Michal Marek <mmarek@suse.com>
show more ...
|
| de5b56ba | 08-Aug-2014 |
Vivek Goyal <vgoyal@redhat.com> |
kernel: build bin2c based on config option CONFIG_BUILD_BIN2C
currently bin2c builds only if CONFIG_IKCONFIG=y. But bin2c will now be used by kexec too. So make it compilation dependent on CONFIG_B
kernel: build bin2c based on config option CONFIG_BUILD_BIN2C
currently bin2c builds only if CONFIG_IKCONFIG=y. But bin2c will now be used by kexec too. So make it compilation dependent on CONFIG_BUILD_BIN2C and this config option can be selected by CONFIG_KEXEC and CONFIG_IKCONFIG.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Cc: Borislav Petkov <bp@suse.de> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Cc: Yinghai Lu <yinghai@kernel.org> Cc: Eric Biederman <ebiederm@xmission.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Matthew Garrett <mjg59@srcf.ucam.org> Cc: Greg Kroah-Hartman <greg@kroah.com> Cc: Dave Young <dyoung@redhat.com> Cc: WANG Chao <chaowang@redhat.com> Cc: Baoquan He <bhe@redhat.com> Cc: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
show more ...
|