mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-02 20:29:20 +00:00
kbuild: create a way to create preprocessor constants from C expressions
The use of enums create constants that are not available to the preprocessor when building the kernel (f.e. MAX_NR_ZONES). Arch code already has a way to export constants calculated to the preprocessor through the asm-offsets.c file. Generate something similar for the core kernel through kbuild. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Christoph Lameter <clameter@sgi.com> Cc: Andy Whitcroft <apw@shadowen.org> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Rik van Riel <riel@redhat.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
308c05e35e
commit
1cdf25d704
2 changed files with 67 additions and 8 deletions
19
kernel/bounds.c
Normal file
19
kernel/bounds.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Generate definitions needed by the preprocessor.
|
||||
* This code generates raw asm output which is post-processed
|
||||
* to extract and format the required data.
|
||||
*/
|
||||
|
||||
#define __GENERATING_BOUNDS_H
|
||||
/* Include headers that define the enum constants of interest */
|
||||
|
||||
#define DEFINE(sym, val) \
|
||||
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
|
||||
|
||||
#define BLANK() asm volatile("\n->" : : )
|
||||
|
||||
void foo(void)
|
||||
{
|
||||
/* The enum constants to put into include/linux/bounds.h */
|
||||
/* End of constants */
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue