summaryrefslogtreecommitdiff
path: root/scripts/genksyms
AgeCommit message (Collapse)Author
2019-06-24genksyms: Teach parser about 128-bit built-in typesWill Deacon
__uint128_t crops up in a few files that export symbols to modules, so teach genksyms about it and the other GCC built-in 128-bit integer types so that we don't end up skipping the CRC generation for some symbols due to the parser failing to spot them: | WARNING: EXPORT symbol "kernel_neon_begin" [vmlinux] version | generation failed, symbol will not be versioned. | ld: arch/arm64/kernel/fpsimd.o: relocation R_AARCH64_ABS32 against | `__crc_kernel_neon_begin' can not be used when making a shared | object | ld: arch/arm64/kernel/fpsimd.o:(.data+0x0): dangerous relocation: | unsupported relocation Reported-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156Thomas Gleixner
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21treewide: Add SPDX license identifier for missed filesThomas Gleixner
Add SPDX license identifiers to all files which: - Have no license information of any form - Have EXPORT_.*_SYMBOL_GPL inside which was used in the initial scan/conversion to ignore the file These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-18treewide: prefix header search paths with $(srctree)/Masahiro Yamada
Currently, the Kbuild core manipulates header search paths in a crazy way [1]. To fix this mess, I want all Makefiles to add explicit $(srctree)/ to the search paths in the srctree. Some Makefiles are already written in that way, but not all. The goal of this work is to make the notation consistent, and finally get rid of the gross hacks. Having whitespaces after -I does not matter since commit 48f6e3cf5bc6 ("kbuild: do not drop -I without parameter"). [1]: https://patchwork.kernel.org/patch/9632347/ Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-05-17genksyms: remove symbol prefix supportMasahiro Yamada
CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX was selected by BLACKFIN, METAG. They were removed by commit 4ba66a976072 ("arch: remove blackfin port"), commit bb6fb6dfcc17 ("metag: Remove arch/metag/"), respectively. No more architecture enables CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX, hence the -s (--symbol-prefix) option is unnecessary. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
2018-05-05genksyms: fix typo in parse.tab.{c,h} generation rulesMauro Rossi
'quet' is replaced by 'quiet' in scripts/genksyms/Makefile Signed-off-by: Mauro Rossi <issor.oruam@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-04-07kbuild: add %.lex.c and %.tab.[ch] to 'targets' automaticallyMasahiro Yamada
Files generated by if_changed* must be added to 'targets' to include *.cmd files. Otherwise, they would be regenerated every time. The build system automatically adds objects to 'targets' where appropriate, such as obj-y, extra-y, etc. but does nothing for intermediate files. So, each Makefile needs to add them by itself. There are some common cases where objects are generated by chained rules. Lexers and parsers are compiled like follows: %.lex.o <- %.lex.c <- %.l %.tab.o <- %.tab.c <- %.y They are common patterns, so it is reasonable to take care of them in the core Makefile instead of requiring each Makefile to do so. At this moment, you cannot delete 'target += zconf.lex.c' in the Kconfig Makefile because zconf.lex.c is included from zconf.tab.c instead of being compiled separately. It should be deleted after Kconfig is more refactored. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Frank Rowand <frowand.list@gmail.com>
2018-04-07genksyms: generate lexer and parser during build instead of shippingMasahiro Yamada
Now that the kernel build supports flex and bison, remove the _shipped files and generate them during the build instead. There are no more shipped lexer and parser, so I ripped off the rules in scripts/Malefile.lib that were used for REGENERATE_PARSERS. The genksyms parser has ambiguous grammar, which would emit warnings: scripts/genksyms/parse.y: warning: 9 shift/reduce conflicts [-Wconflicts-sr] scripts/genksyms/parse.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr] They are normally suppressed, but displayed when W=1 is given. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-04-07kbuild: clean up *.lex.c and *.tab.[ch] patterns from top-level MakefileMasahiro Yamada
Files suffixed by .lex.c, .tab.[ch] are generated lexers, parsers, respectively. Clean them up globally from the top Makefile. Some of the final host programs those lexer/parser are linked into are necessary for building external modules, but the intermediates are unneeded. They can be cleaned away by 'make clean' instead of 'make mrproper'. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Frank Rowand <frowand.list@gmail.com>
2018-04-07.gitignore: move *.lex.c *.tab.[ch] patterns to the top-level .gitignoreMasahiro Yamada
These patterns are common to host programs that require lexer and parser. Move them to the top .gitignore. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Frank Rowand <frowand.list@gmail.com>
2018-01-13genksyms: drop *.hash.c from .gitignoreMasahiro Yamada
This is a left-over of commit bb3290d91695 ("Remove gperf usage from toolchain"). We do not generate a hash function any more. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-08genksyms: fix gperf removal conversionLinus Torvalds
I had stupidly missed one special use of 'is_reserved_word()' when I converted the code to avoid gperf. I had changed that function to return the token ID directly rather than a pointer to the token descriptor structure, but that meant that the test for "is this a reserved word" changed from checking the return value against NULL, to checking that it wasn't negative. And while I had converted the main token parser over, I missed the special case of the typeof phrase handling. And since our dependency chain for genksyms does not include the genksyms program itself changing, my kernel rebuild didn't show the problem. Fixes: bb3290d91695 ("Remove gperf usage from toolchain") Reported-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-08-19Remove gperf usage from toolchainLinus Torvalds
It turns out that gperf-3.1 changed types in the generated code in ways that aren't even trivially detectable without having to generate a test-file. It's just not worth using tools and libraries from clowns that don't understand or care about compatibility. So get rid of gperf. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-06-06genksyms: add printf format attribute to error_with_pos()Nicolas Iooss
When compiling with -Wsuggest-attribute=format in HOSTCFLAGS, gcc complains that error_with_pos() may be declared with a printf format attribute: scripts/genksyms/genksyms.c:726:3: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format] vfprintf(stderr, fmt, args); ^~~~~~~~ This would allow catching printf-format errors at compile time in callers to error_with_pos(). Add this attribute. Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-03-11Merge branch 'kbuild' of ↵Masahiro Yamada
git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild Pull Michal's unmerged branch into the new Kbuild repository. * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: genksyms: Regenerate parser genksyms: Fix segfault with invalid declarations
2017-02-03kbuild: modversions: add infrastructure for emitting relative CRCsArd Biesheuvel
This add the kbuild infrastructure that will allow architectures to emit vmlinux symbol CRCs as 32-bit offsets to another location in the kernel where the actual value is stored. This works around problems with CRCs being mistaken for relocatable symbols on kernels that self relocate at runtime (i.e., powerpc with CONFIG_RELOCATABLE=y) For the kbuild side of things, this comes down to the following: - introducing a Kconfig symbol MODULE_REL_CRCS - adding a -R switch to genksyms to instruct it to emit the CRC symbols as references into the .rodata section - making modpost distinguish such references from absolute CRC symbols by the section index (SHN_ABS) - making kallsyms disregard non-absolute symbols with a __crc_ prefix Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-05genksyms: Regenerate parserMichal Marek
Regenerate the parser after d920f7c6628c ("genksyms: Fix segfault with invalid declarations"). Reported-and-tested-by: Borislav Petkov <bp@alien8.de> Signed-off-by: Michal Marek <mmarek@suse.com>
2017-01-05genksyms: Fix segfault with invalid declarationsMichal Marek
Do not try to recover too early and segfault when parsing invalid declarations such as echo 'int (int);' | scripts/genksyms/genksyms echo 'int a, (int);' | scripts/genksyms/genksyms echo 'extern void *__inline_memcpy((void *), (const void *), (__kernel_size_t));' | scripts/genksyms/genksyms The last one was a real-life bug with include/asm-generic/asm-prototypes.h on x86_64. Reported-and-tested-by: Borislav Petkov <bp@alien8.de> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-11-29genksyms: Regenerate parserMichal Marek
Regenerate the keyword table and parser after commit 0efdb2282343 ("kbuild/genksyms: handle va_list type"). Signed-off-by: Michal Marek <mmarek@suse.com>
2016-11-29kbuild/genksyms: handle va_list typeNicholas Piggin
genksyms currently does not handle va_list. Add the __builtin_va_list keyword as a type. This reduces the amount of syntax errors thrown, but so far no export symbol has a type with a va_list argument, so there is currently no bug in the end result. Note: this patch does not regenerate shipped parser files. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-08-25kbuild: Regenerate genksyms lexerMichal Marek
Update the lexer after 4fab91605a6b ("kbuild: genksyms fix for typeof handling"). Signed-off-by: Michal Marek <mmarek@suse.com>
2016-08-25kbuild: genksyms fix for typeof handlingNicholas Piggin
The tokenizer misses counting an open-parenthesis when parsing a non-trivial typeof beginning with an open-parenthesis. This function in include/linux/ceph/libceph.h static type *lookup_##name(struct rb_root *root, typeof(((type *)0)->keyfld) key) When instantiated in net/ceph/mon_client.c, causes subsequent symbols including an EXPORT_SYMBOL in that file to be lost. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-04-20scripts: genksyms: fix resource leakMaxim Zhukov
This commit fixed resource leak at func main Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.com>
2015-12-09genksyms: Handle string literals with spaces in reference filesMichal Marek
The reference files use spaces to separate tokens, however, we must preserve spaces inside string literals. Currently the only case in the tree is struct edac_raw_error_desc in <linux/edac.h>: $ KBUILD_SYMTYPES=1 make -s drivers/edac/amd64_edac.symtypes $ mv drivers/edac/amd64_edac.{symtypes,symref} $ KBUILD_SYMTYPES=1 make -s drivers/edac/amd64_edac.symtypes drivers/edac/amd64_edac.c:527: warning: amd64_get_dram_hole_info: modversion changed because of changes in struct edac_raw_error_desc Signed-off-by: Michal Marek <mmarek@suse.com>
2015-08-20genksyms: Regenerate parserMichal Marek
Rebuild the parser after commit 1c722503fa81 (genksyms: Duplicate function pointer type definitions segfault), using bison 2.7. Signed-off-by: Michal Marek <mmarek@suse.com>
2015-08-20genksyms: Duplicate function pointer type definitions segfaultRichard Yao
I noticed that genksyms will segfault when it sees duplicate function pointer type declaration when I placed the same function pointer definition in two separate headers in a local branch as an intermediate step of some refactoring. This can be reproduced by piping the following minimal test case into `genksyms -r /dev/null` or alternatively, putting it into a C file attempting a build: typedef int (*f)(); typedef int (*f)(); Attaching gdb to genksyms to understand this failure is useless without changing CFLAGS to emit debuginfo. Once you have debuginfo, you will find that the failure is that `char *s` was NULL and the program executed `while(*s)`. At which point, further debugging requires familiarity with compiler front end / parser development. What happens is that flex identifies the first instance of the token "f" as IDENT and the yacc parser adds it to the symbol table. On the second instance, flex will identify "f" as TYPE, which triggers an error case in the yacc parser. Given that TYPE would have been IDENT had it not been in the symbol table, the the segmentaion fault could be avoided by treating TYPE as IDENT in the affected rule. Some might consider placing identical function pointer type declarations in different headers to be poor style might consider a failure to be beneficial. However, failing through a segmentation fault makes the cause non-obvious and can waste the time of anyone who encounters it. Signed-off-by: Richard Yao <richard.yao@clusterhq.com> Acked-by: Madhuri Yechuri <madhuriyechuri@clusterhq.com> Signed-off-by: Michal Marek <mmarek@suse.com>
2014-04-03genksyms: fix typeof() handlingJan Beulich
Recent increased use of typeof() throughout the tree resulted in a number of symbols (25 in a typical distro config of ours) not getting a proper CRC calculated for them anymore, due to the parser in genksyms not coping with several of these uses (interestingly in the majority of [if not all] cases the problem is due to the use of typeof() in code preceding a certain export, not in the declaration/definition of the exported function/object itself; I wasn't able to find a way to address this more general parser shortcoming). The use of parameter_declaration is a little more relaxed than would be ideal (permitting not just a bare type specification, but also one with identifier), but since the same code is being passed through an actual compiler, there's no apparent risk of allowing through any broken code. Otoh using parameter_declaration instead of the ad hoc "decl_specifier_seq '*'" / "decl_specifier_seq" pair allows all types to be handled rather than just plain ones and pointers to plain ones. Signed-off-by: Jan Beulich <jbeulich@suse.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-03-20genksyms: pass symbol-prefix instead of archJames Hogan
Pass symbol-prefix to genksyms instead of arch, so that the decision what symbol prefix to use is kept in one place. Basically genksyms used to take a -a $ARCH argument and it used that to determine whether to add an underscore symbol prefix. It's now changed to take a -s $SYMBOL_PREFIX argument so that the caller decides whether a symbol prefix is required. The build system then uses CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX to determine whether to pass the argument. Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2013-03-02genksyms: fix metag symbol prefix on crc symbolsJames Hogan
Meta uses symbol prefixes, so add "metag" to the list of architectures to set the mod_prefix to "_" for. This fixes __crc_* symbols to add the extra underscore to match _CRC_SYMBOL macro in <linux/export.h> and so that modpost finds them. Signed-off-by: James Hogan <james.hogan@imgtec.com>
2012-01-08scripts/genksyms: clean lex/yacc generated filesFernando Luis Vázquez Cao
Add "keywords.hash.c", "lex.lex.c", "parse.tab.c" and "parse.tab.h" to clean-list so that they get automagically deleted at clean/mrproper time. Signed-off-by: Fernando Luis Vazquez Cao<fernando@oss.ntt.co.jp> Signed-off-by: Michal Marek <mmarek@suse.cz>
2011-10-11genksyms: Regenerate lexer and parserMichal Marek
2011-10-11genksyms: Do not expand internal typesMichal Marek
Consider structures, unions and enums defined in the source file as internal and do not expand them. This way, changes to e.g. struct serial_private in drivers/tty/serial/8250_pci.c will not affect the checksum of the pciserial_* exports.
2011-10-11genksyms: Minor parser cleanupMichal Marek
Move the identical logic for recording a struct/union/enum definition to a function.
2011-07-25genksyms: Use same type in loop comparisonJesper Juhl
The ARRAY_SIZE macro in scripts/genksyms/genksyms.c returns a value of type size_t. That value is being compared to a variable of type int in a loop in read_node(). Change the int variable to size_t type as well, so we don't do signed vs unsigned type comparisons with all the potential promotion/sign extension trouble that can cause (also silences compiler warnings at high levels of warnings). Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Michal Marek <mmarek@suse.cz>
2011-06-09genksym: regen parserArnaud Lacombe
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
2011-06-09genksyms: migrate parser to implicit rulesArnaud Lacombe
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
2011-06-09genksyms: drop -Wno-uninitialized from HOSTCFLAGS_parse.tab.oArnaud Lacombe
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
2011-06-09genksyms: pass hash and lookup functions name and target language though the ↵Arnaud Lacombe
input file Renaming hash and lookup functions on the command line would reduces its genericity. Use the .gperf file to pass this information. Do the same for the target language. Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
2011-03-17genksyms: Regenerate lexer and parserMichal Marek
Regenerated the parser after "genksyms: Track changes to enum constants". Signed-off-by: Michal Marek <mmarek@suse.cz> Acked-by: Sam Ravnborg <sam@ravnborg.org>
2011-03-17genksyms: Track changes to enum constantsMichal Marek
Enum constants can be used as array sizes; if the enum itself does not appear in the symbol expansion, a change in the enum constant will go unnoticed. Example patch that changes the ABI but does not change the checksum with current genksyms: | enum e { | E1, | E2, |+ E3, | E_MAX | }; | | struct s { | int a[E_MAX]; | } | | int f(struct s *s) { ... } | EXPORT_SYMBOL(f) Therefore, remember the value of each enum constant and expand each occurence to <constant> <value>. The value is not actually computed, but instead an expression in the form (last explicitly assigned value) + N is used. This avoids having to parse and semantically understand whole of C. Note: The changes won't take effect until the lexer and parser are rebuilt by the next patch. Signed-off-by: Michal Marek <mmarek@suse.cz> Acked-by: Sam Ravnborg <sam@ravnborg.org>
2011-03-17genksyms: simplify usage of find_symbol()Michal Marek
Allow searching for symbols of an exact type. The lexer does this and a subsequent patch will add one more usage. Signed-off-by: Michal Marek <mmarek@suse.cz> Acked-by: Sam Ravnborg <sam@ravnborg.org>
2011-03-17genksyms: Add helpers for building string listsMichal Marek
Signed-off-by: Michal Marek <mmarek@suse.cz> Acked-by: Sam Ravnborg <sam@ravnborg.org>
2011-03-17genksyms: Simplify printing of symbol typesMichal Marek
Instead of special-casing SYM_NORMAL, do not map any name to it. Also explicitly set the single-letter name of the symbol type, which will be needed by a further patch. The only user-visible change is one debug printf. Signed-off-by: Michal Marek <mmarek@suse.cz> Acked-by: Sam Ravnborg <sam@ravnborg.org>
2011-03-17genksyms: Simplify lexerMichal Marek
The V2_TOKENS state is active all the time. Signed-off-by: Michal Marek <mmarek@suse.cz> Acked-by: Sam Ravnborg <sam@ravnborg.org>
2011-03-17genksyms: Do not paste the bison header file to lex.cMichal Marek
The header is already #included, no need to include it a second time. lex.c_shipped was regenerated using flex-2.5.35. Signed-off-by: Michal Marek <mmarek@suse.cz> Acked-by: Sam Ravnborg <sam@ravnborg.org>
2010-11-25scripts/genksyms: fix header usageArnaud Lacombe
FreeBSD does not like <malloc.h> when __STDC__ is defined, use the standard <stdlib.h> instead. Signed-off-by: Arnaud Lacombe <lacombar@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02genksyms: close ref_file after useAlexander Beregalov
It is the last place when the file is read, so close it. Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2009-12-12genksyms: properly consider EXPORT_UNUSED_SYMBOL{,_GPL}()Jan Beulich
Despite being unused these should also get a CRC calculated. Primarily I view this as a consistency thing. But I also think this is one of the reasons why __crc_* need to be weak (which I think should be avoided, and hence we should have the goal to eliminate this so that failure to calculate a proper CRC for a symbol causes the build to fail). Signed-off-by: Jan Beulich <jbeulich@novell.com> Cc: Anibal Monsalve Salazar <anibal@debian.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2009-11-15genksyms: Mark is_reserved_word staticJosh Triplett
The genksyms keyword gperf hash provides a function is_reserved_word. genksyms #includes the resulting generated file keywords.c, so the function gets used only in the same source file that defines it. Mark is_reserved_word static, and regenerate the corresponding generated file. Signed-off-by: Josh Triplett <josh@joshtriplett.org>