forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Signed-off-by: Christoph Lameter <[email protected]> Cc: Andy Whitcroft <[email protected]> Cc: KAMEZAWA Hiroyuki <[email protected]> Cc: KOSAKI Motohiro <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Jeremy Fitzhardinge <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
- Loading branch information
Showing
2 changed files
with
67 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 */ | ||
} |