Pull Kbuild updates from Masahiro Yamada: - Generate a list of built DTB files (arch/*/boot/dts/dtbs-list) - Use more threads when building Debian packages in parallel - Fix warnings shown during the RPM kernel package uninstallation - Change OBJECT_FILES_NON_STANDARD_*.o etc. to take a relative path to Makefile - Support GCC's -fmin-function-alignment flag - Fix a null pointer dereference bug in modpost - Add the DTB support to the RPM package - Various fixes and cleanups in Kconfig * tag 'kbuild-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (67 commits) kconfig: tests: test dependency after shuffling choices kconfig: tests: add a test for randconfig with dependent choices kconfig: tests: support KCONFIG_SEED for the randconfig runner kbuild: rpm-pkg: add dtb files in kernel rpm kconfig: remove unneeded menu_is_visible() call in conf_write_defconfig() kconfig: check prompt for choice while parsing kconfig: lxdialog: remove unused dialog colors kconfig: lxdialog: fix button color for blackbg theme modpost: fix null pointer dereference kbuild: remove GCC's default -Wpacked-bitfield-compat flag kbuild: unexport abs_srctree and abs_objtree kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1 kconfig: remove named choice support kconfig: use linked list in get_symbol_str() to iterate over menus kconfig: link menus to a symbol kbuild: fix inconsistent indentation in top Makefile kbuild: Use -fmin-function-alignment when available alpha: merge two entries for CONFIG_ALPHA_GAMMA alpha: merge two entries for CONFIG_ALPHA_EV4 kbuild: change DTC_FLAGS_<basetarget>.o to take the path relative to $(obj) ...
Unified · Split
| @@ -52,6 +52,7 @@ · 51 unmodified lines | ||
| 52 | 52 | *.xz |
| 53 | 53 | *.zst |
| 54 | 54 | Module.symvers |
| 55 | +dtbs-list | |
| 55 | 56 | modules.order |
| 56 | 57 | |
| 57 | 58 | # |
| @@ -393,7 +393,7 @@ of C0, which doesn't depend on M:: · 392 unmodified lines | ||
| 393 | 393 | |
| 394 | 394 | choices:: |
| 395 | 395 | |
| 396 | − "choice" [symbol] | |
| 396 | + "choice" | |
| 397 | 397 | <choice options> |
| 398 | 398 | <choice block> |
| 399 | 399 | "endchoice" |
| @@ -412,10 +412,6 @@ the kernel, but all drivers can be compiled as modules. · 12 unmodified lines | ||
| 412 | 412 | |
| 413 | 413 | A choice accepts another option "optional", which allows to set the |
| 414 | 414 | choice to 'n' and no entry needs to be selected. |
| 415 | −If no [symbol] is associated with a choice, then you can not have multiple | |
| 416 | −definitions of that choice. If a [symbol] is associated to the choice, | |
| 417 | −then you may define the same choice (i.e. with the same entries) in another | |
| 418 | −place. | |
| 419 | 415 | |
| 420 | 416 | comment:: |
| 421 | 417 | |
| @@ -1,10 +1,10 @@ | ||
| 1 | −=================== | |
| 2 | −Kconfig make config | |
| 3 | −=================== | |
| 1 | +================================= | |
| 2 | +Configuration targets and editors | |
| 3 | +================================= | |
| 4 | 4 | |
| 5 | −This file contains some assistance for using `make *config`. | |
| 5 | +This file contains some assistance for using ``make *config``. | |
| 6 | 6 | |
| 7 | −Use "make help" to list all of the possible configuration targets. | |
| 7 | +Use ``make help`` to list all of the possible configuration targets. | |
| 8 | 8 | |
| 9 | 9 | The xconfig ('qconf'), menuconfig ('mconf'), and nconfig ('nconf') |
| 10 | 10 | programs also have embedded help text. Be sure to check that for |
| @@ -12,8 +12,9 @@ navigation, search, and other general help text. · 1 unmodified line | ||
| 12 | 12 | |
| 13 | 13 | The gconfig ('gconf') program has limited help text. |
| 14 | 14 | |
| 15 | + | |
| 15 | 16 | General |
| 16 | −------- | |
| 17 | +======= | |
| 17 | 18 | |
| 18 | 19 | New kernel releases often introduce new config symbols. Often more |
| 19 | 20 | important, new kernel releases may rename config symbols. When |
| @@ -24,118 +25,102 @@ symbols have been introduced. · 4 unmodified lines | ||
| 24 | 25 | |
| 25 | 26 | To see a list of new config symbols, use:: |
| 26 | 27 | |
| 27 | − cp user/some/old.config .config | |
| 28 | − make listnewconfig | |
| 28 | + cp user/some/old.config .config | |
| 29 | + make listnewconfig | |
| 29 | 30 | |
| 30 | 31 | and the config program will list any new symbols, one per line. |
| 31 | 32 | |
| 32 | 33 | Alternatively, you can use the brute force method:: |
| 33 | 34 | |
| 34 | − make oldconfig | |
| 35 | − scripts/diffconfig .config.old .config | less | |
| 36 | − | |
| 37 | −---------------------------------------------------------------------- | |
| 38 | − | |
| 39 | −Environment variables for `*config` | |
| 35 | + make oldconfig | |
| 36 | + scripts/diffconfig .config.old .config | less | |
| 40 | 37 | |
| 41 | −KCONFIG_CONFIG | |
| 42 | −-------------- | |
| 43 | −This environment variable can be used to specify a default kernel config | |
| 44 | −file name to override the default name of ".config". | |
| 45 | 38 | |
| 46 | −KCONFIG_DEFCONFIG_LIST | |
| 47 | −---------------------- | |
| 39 | +Environment variables | |
| 40 | +===================== | |
| 48 | 41 | |
| 49 | −This environment variable specifies a list of config files which can be used | |
| 50 | −as a base configuration in case the .config does not exist yet. Entries in | |
| 51 | −the list are separated with whitespaces to each other, and the first one | |
| 52 | −that exists is used. | |
| 42 | +Environment variables for ``*config``: | |
| 53 | 43 | |
| 54 | −KCONFIG_OVERWRITECONFIG | |
| 55 | −----------------------- | |
| 56 | −If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not | |
| 57 | −break symlinks when .config is a symlink to somewhere else. | |
| 44 | +``KCONFIG_CONFIG`` | |
| 45 | + This environment variable can be used to specify a default kernel config | |
| 46 | + file name to override the default name of ".config". | |
| 58 | 47 | |
| 59 | −KCONFIG_WARN_UNKNOWN_SYMBOLS | |
| 60 | −---------------------------- | |
| 61 | −This environment variable makes Kconfig warn about all unrecognized | |
| 62 | −symbols in the config input. | |
| 48 | +``KCONFIG_DEFCONFIG_LIST`` | |
| 49 | + This environment variable specifies a list of config files which can be | |
| 50 | + used as a base configuration in case the .config does not exist yet. | |
| 51 | + Entries in the list are separated with whitespaces to each other, and | |
| 52 | + the first one that exists is used. | |
| 63 | 53 | |
| 64 | −KCONFIG_WERROR | |
| 65 | −-------------- | |
| 66 | −If set, Kconfig treats warnings as errors. | |
| 54 | +``KCONFIG_OVERWRITECONFIG`` | |
| 55 | + If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not | |
| 56 | + break symlinks when .config is a symlink to somewhere else. | |
| 67 | 57 | |
| 68 | −`CONFIG_` | |
| 69 | −--------- | |
| 70 | −If you set `CONFIG_` in the environment, Kconfig will prefix all symbols | |
| 71 | −with its value when saving the configuration, instead of using the default, | |
| 72 | −`CONFIG_`. | |
| 58 | +``KCONFIG_WARN_UNKNOWN_SYMBOLS`` | |
| 59 | + This environment variable makes Kconfig warn about all unrecognized | |
| 60 | + symbols in the config input. | |
| 73 | 61 | |
| 74 | −---------------------------------------------------------------------- | |
| 62 | +``KCONFIG_WERROR`` | |
| 63 | + If set, Kconfig treats warnings as errors. | |
| 75 | 64 | |
| 76 | −Environment variables for '{allyes/allmod/allno/rand}config' | |
| 65 | +``CONFIG_`` | |
| 66 | + If you set ``CONFIG_`` in the environment, Kconfig will prefix all symbols | |
| 67 | + with its value when saving the configuration, instead of using the | |
| 68 | + default, ``CONFIG_``. | |
| 77 | 69 | |
| 78 | −KCONFIG_ALLCONFIG | |
| 79 | −----------------- | |
| 80 | −(partially based on lkml email from/by Rob Landley, re: miniconfig) | |
| 70 | +Environment variables for ``{allyes/allmod/allno/rand}config``: | |
| 81 | 71 | |
| 82 | −-------------------------------------------------- | |
| 72 | +``KCONFIG_ALLCONFIG`` | |
| 73 | + The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also | |
| 74 | + use the environment variable KCONFIG_ALLCONFIG as a flag or a filename | |
| 75 | + that contains config symbols that the user requires to be set to a | |
| 76 | + specific value. If KCONFIG_ALLCONFIG is used without a filename where | |
| 77 | + KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", ``make *config`` | |
| 78 | + checks for a file named "all{yes/mod/no/def/random}.config" | |
| 79 | + (corresponding to the ``*config`` command that was used) for symbol values | |
| 80 | + that are to be forced. If this file is not found, it checks for a | |
| 81 | + file named "all.config" to contain forced values. | |
| 83 | 82 | |
| 84 | −The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also | |
| 85 | −use the environment variable KCONFIG_ALLCONFIG as a flag or a filename | |
| 86 | −that contains config symbols that the user requires to be set to a | |
| 87 | −specific value. If KCONFIG_ALLCONFIG is used without a filename where | |
| 88 | −KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", `make *config` | |
| 89 | −checks for a file named "all{yes/mod/no/def/random}.config" | |
| 90 | −(corresponding to the `*config` command that was used) for symbol values | |
| 91 | −that are to be forced. If this file is not found, it checks for a | |
| 92 | −file named "all.config" to contain forced values. | |
| 83 | + This enables you to create "miniature" config (miniconfig) or custom | |
| 84 | + config files containing just the config symbols that you are interested | |
| 85 | + in. Then the kernel config system generates the full .config file, | |
| 86 | + including symbols of your miniconfig file. | |
| 93 | 87 | |
| 94 | −This enables you to create "miniature" config (miniconfig) or custom | |
| 95 | −config files containing just the config symbols that you are interested | |
| 96 | −in. Then the kernel config system generates the full .config file, | |
| 97 | −including symbols of your miniconfig file. | |
| 98 | − | |
| 99 | −This 'KCONFIG_ALLCONFIG' file is a config file which contains | |
| 100 | −(usually a subset of all) preset config symbols. These variable | |
| 101 | −settings are still subject to normal dependency checks. | |
| 102 | − | |
| 103 | −Examples:: | |
| 88 | + This ``KCONFIG_ALLCONFIG`` file is a config file which contains | |
| 89 | + (usually a subset of all) preset config symbols. These variable | |
| 90 | + settings are still subject to normal dependency checks. | |
| 104 | 91 | |
| 105 | − KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig | |
| 92 | + Examples:: | |
| 106 | 93 | |
| 107 | −or:: | |
| 94 | + KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig | |
| 108 | 95 | |
| 109 | − KCONFIG_ALLCONFIG=mini.config make allnoconfig | |
| 96 | + or:: | |
| 110 | 97 | |
| 111 | −or:: | |
| 98 | + KCONFIG_ALLCONFIG=mini.config make allnoconfig | |
| 112 | 99 | |
| 113 | − make KCONFIG_ALLCONFIG=mini.config allnoconfig | |
| 100 | + or:: | |
| 114 | 101 | |
| 115 | −These examples will disable most options (allnoconfig) but enable or | |
| 116 | −disable the options that are explicitly listed in the specified | |
| 117 | −mini-config files. | |
| 102 | + make KCONFIG_ALLCONFIG=mini.config allnoconfig | |
| 118 | 103 | |
| 119 | −---------------------------------------------------------------------- | |
| 104 | + These examples will disable most options (allnoconfig) but enable or | |
| 105 | + disable the options that are explicitly listed in the specified | |
| 106 | + mini-config files. | |
| 120 | 107 | |
| 121 | −Environment variables for 'randconfig' | |
| 108 | +Environment variables for ``randconfig``: | |
| 122 | 109 | |
| 123 | −KCONFIG_SEED | |
| 124 | −------------ | |
| 125 | −You can set this to the integer value used to seed the RNG, if you want | |
| 126 | −to somehow debug the behaviour of the kconfig parser/frontends. | |
| 127 | −If not set, the current time will be used. | |
| 110 | +``KCONFIG_SEED`` | |
| 111 | + You can set this to the integer value used to seed the RNG, if you want | |
| 112 | + to somehow debug the behaviour of the kconfig parser/frontends. | |
| 113 | + If not set, the current time will be used. | |
| 128 | 114 | |
| 129 | −KCONFIG_PROBABILITY | |
| 130 | −------------------- | |
| 131 | −This variable can be used to skew the probabilities. This variable can | |
| 132 | −be unset or empty, or set to three different formats: | |
| 115 | +``KCONFIG_PROBABILITY`` | |
| 116 | + This variable can be used to skew the probabilities. This variable can | |
| 117 | + be unset or empty, or set to three different formats: | |
| 133 | 118 | |
| 134 | 119 | ======================= ================== ===================== |
| 135 | − KCONFIG_PROBABILITY y:n split y:m:n split | |
| 120 | + KCONFIG_PROBABILITY y:n split y:m:n split | |
| 136 | 121 | ======================= ================== ===================== |
| 137 | − unset or empty 50 : 50 33 : 33 : 34 | |
| 138 | − N N : 100-N N/2 : N/2 : 100-N | |
| 122 | + unset or empty 50 : 50 33 : 33 : 34 | |
| 123 | + N N : 100-N N/2 : N/2 : 100-N | |
| 139 | 124 | [1] N:M N+M : 100-(N+M) N : M : 100-(N+M) |
| 140 | 125 | [2] N:M:L N : 100-N M : L : 100-(M+L) |
| 141 | 126 | ======================= ================== ===================== |
| @@ -149,112 +134,98 @@ that: · 7 unmodified lines | ||
| 149 | 134 | |
| 150 | 135 | Examples:: |
| 151 | 136 | |
| 152 | − KCONFIG_PROBABILITY=10 | |
| 153 | − 10% of booleans will be set to 'y', 90% to 'n' | |
| 154 | − 5% of tristates will be set to 'y', 5% to 'm', 90% to 'n' | |
| 155 | − KCONFIG_PROBABILITY=15:25 | |
| 156 | − 40% of booleans will be set to 'y', 60% to 'n' | |
| 157 | − 15% of tristates will be set to 'y', 25% to 'm', 60% to 'n' | |
| 158 | − KCONFIG_PROBABILITY=10:15:15 | |
| 159 | − 10% of booleans will be set to 'y', 90% to 'n' | |
| 160 | − 15% of tristates will be set to 'y', 15% to 'm', 70% to 'n' | |
| 137 | + KCONFIG_PROBABILITY=10 | |
| 138 | + 10% of booleans will be set to 'y', 90% to 'n' | |
| 139 | + 5% of tristates will be set to 'y', 5% to 'm', 90% to 'n' | |
| 140 | + KCONFIG_PROBABILITY=15:25 | |
| 141 | + 40% of booleans will be set to 'y', 60% to 'n' | |
| 142 | + 15% of tristates will be set to 'y', 25% to 'm', 60% to 'n' | |
| 143 | + KCONFIG_PROBABILITY=10:15:15 | |
| 144 | + 10% of booleans will be set to 'y', 90% to 'n' | |
| 145 | + 15% of tristates will be set to 'y', 15% to 'm', 70% to 'n' | |
| 161 | 146 | |
| 162 | −---------------------------------------------------------------------- | |
| 147 | +Environment variables for ``syncconfig``: | |
| 163 | 148 | |
| 164 | −Environment variables for 'syncconfig' | |
| 149 | +``KCONFIG_NOSILENTUPDATE`` | |
| 150 | + If this variable has a non-blank value, it prevents silent kernel | |
| 151 | + config updates (requires explicit updates). | |
| 165 | 152 | |
| 166 | −KCONFIG_NOSILENTUPDATE | |
| 167 | −---------------------- | |
| 168 | −If this variable has a non-blank value, it prevents silent kernel | |
| 169 | −config updates (requires explicit updates). | |
| 153 | +``KCONFIG_AUTOCONFIG`` | |
| 154 | + This environment variable can be set to specify the path & name of the | |
| 155 | + "auto.conf" file. Its default value is "include/config/auto.conf". | |
| 170 | 156 | |
| 171 | −KCONFIG_AUTOCONFIG | |
| 172 | −------------------ | |
| 173 | −This environment variable can be set to specify the path & name of the | |
| 174 | −"auto.conf" file. Its default value is "include/config/auto.conf". | |
| 157 | +``KCONFIG_AUTOHEADER`` | |
| 158 | + This environment variable can be set to specify the path & name of the | |
| 159 | + "autoconf.h" (header) file. | |
| 160 | + Its default value is "include/generated/autoconf.h". | |
| 175 | 161 | |
| 176 | −KCONFIG_AUTOHEADER | |
| 177 | −------------------ | |
| 178 | −This environment variable can be set to specify the path & name of the | |
| 179 | −"autoconf.h" (header) file. | |
| 180 | −Its default value is "include/generated/autoconf.h". | |
| 181 | − | |
| 182 | − | |
| 183 | −---------------------------------------------------------------------- | |
| 184 | 162 | |
| 185 | 163 | menuconfig |
| 186 | −---------- | |
| 187 | − | |
| 188 | −SEARCHING for CONFIG symbols | |
| 164 | +========== | |
| 189 | 165 | |
| 190 | 166 | Searching in menuconfig: |
| 191 | 167 | |
| 192 | − The Search function searches for kernel configuration symbol | |
| 193 | − names, so you have to know something close to what you are | |
| 194 | − looking for. | |
| 168 | + The Search function searches for kernel configuration symbol | |
| 169 | + names, so you have to know something close to what you are | |
| 170 | + looking for. | |
| 195 | 171 | |
| 196 | − Example:: | |
| 172 | + Example:: | |
| 197 | 173 | |
| 198 | − /hotplug | |
| 199 | − This lists all config symbols that contain "hotplug", | |
| 200 | − e.g., HOTPLUG_CPU, MEMORY_HOTPLUG. | |
| 174 | + /hotplug | |
| 175 | + This lists all config symbols that contain "hotplug", | |
| 176 | + e.g., HOTPLUG_CPU, MEMORY_HOTPLUG. | |
| 201 | 177 | |
| 202 | − For search help, enter / followed by TAB-TAB (to highlight | |
| 203 | − <Help>) and Enter. This will tell you that you can also use | |
| 204 | − regular expressions (regexes) in the search string, so if you | |
| 205 | − are not interested in MEMORY_HOTPLUG, you could try:: | |
| 178 | + For search help, enter / followed by TAB-TAB (to highlight | |
| 179 | + <Help>) and Enter. This will tell you that you can also use | |
| 180 | + regular expressions (regexes) in the search string, so if you | |
| 181 | + are not interested in MEMORY_HOTPLUG, you could try:: | |
| 206 | 182 | |
| 207 | − /^hotplug | |
| 183 | + /^hotplug | |
| 208 | 184 | |
| 209 | − When searching, symbols are sorted thus: | |
| 185 | + When searching, symbols are sorted thus: | |
| 210 | 186 | |
| 211 | − - first, exact matches, sorted alphabetically (an exact match | |
| 212 | − is when the search matches the complete symbol name); | |
| 213 | − - then, other matches, sorted alphabetically. | |
| 187 | + - first, exact matches, sorted alphabetically (an exact match | |
| 188 | + is when the search matches the complete symbol name); | |
| 189 | + - then, other matches, sorted alphabetically. | |
| 214 | 190 | |
| 215 | − For example: ^ATH.K matches: | |
| 191 | + For example, ^ATH.K matches: | |
| 216 | 192 | |
| 217 | − ATH5K ATH9K ATH5K_AHB ATH5K_DEBUG [...] ATH6KL ATH6KL_DEBUG | |
| 218 | − [...] ATH9K_AHB ATH9K_BTCOEX_SUPPORT ATH9K_COMMON [...] | |
| 193 | + ATH5K ATH9K ATH5K_AHB ATH5K_DEBUG [...] ATH6KL ATH6KL_DEBUG | |
| 194 | + [...] ATH9K_AHB ATH9K_BTCOEX_SUPPORT ATH9K_COMMON [...] | |
| 219 | 195 | |
| 220 | − of which only ATH5K and ATH9K match exactly and so are sorted | |
| 221 | − first (and in alphabetical order), then come all other symbols, | |
| 222 | − sorted in alphabetical order. | |
| 196 | + of which only ATH5K and ATH9K match exactly and so are sorted | |
| 197 | + first (and in alphabetical order), then come all other symbols, | |
| 198 | + sorted in alphabetical order. | |
| 223 | 199 | |
| 224 | − In this menu, pressing the key in the (#) prefix will jump | |
| 225 | − directly to that location. You will be returned to the current | |
| 226 | − search results after exiting this new menu. | |
| 200 | + In this menu, pressing the key in the (#) prefix will jump | |
| 201 | + directly to that location. You will be returned to the current | |
| 202 | + search results after exiting this new menu. | |
| 227 | 203 | |
| 228 | −---------------------------------------------------------------------- | |
| 204 | +User interface options for 'menuconfig': | |
| 229 | 205 | |
| 230 | −User interface options for 'menuconfig' | |
| 206 | +``MENUCONFIG_COLOR`` | |
| 207 | + It is possible to select different color themes using the variable | |
| 208 | + MENUCONFIG_COLOR. To select a theme use:: | |
| 231 | 209 | |
| 232 | −MENUCONFIG_COLOR | |
| 233 | −---------------- | |
| 234 | −It is possible to select different color themes using the variable | |
| 235 | −MENUCONFIG_COLOR. To select a theme use:: | |
| 210 | + make MENUCONFIG_COLOR=<theme> menuconfig | |
| 236 | 211 | |
| 237 | − make MENUCONFIG_COLOR=<theme> menuconfig | |
| 212 | + Available themes are:: | |
| 238 | 213 | |
| 239 | −Available themes are:: | |
| 214 | + - mono => selects colors suitable for monochrome displays | |
| 215 | + - blackbg => selects a color scheme with black background | |
| 216 | + - classic => theme with blue background. The classic look | |
| 217 | + - bluetitle => a LCD friendly version of classic. (default) | |
| 240 | 218 | |
| 241 | − - mono => selects colors suitable for monochrome displays | |
| 242 | − - blackbg => selects a color scheme with black background | |
| 243 | − - classic => theme with blue background. The classic look | |
| 244 | − - bluetitle => a LCD friendly version of classic. (default) | |
| 219 | +``MENUCONFIG_MODE`` | |
| 220 | + This mode shows all sub-menus in one large tree. | |
| 245 | 221 | |
| 246 | −MENUCONFIG_MODE | |
| 247 | −--------------- | |
| 248 | −This mode shows all sub-menus in one large tree. | |
| 222 | + Example:: | |
| 249 | 223 | |
| 250 | −Example:: | |
| 224 | + make MENUCONFIG_MODE=single_menu menuconfig | |
| 251 | 225 | |
| 252 | − make MENUCONFIG_MODE=single_menu menuconfig | |
| 253 | − | |
| 254 | −---------------------------------------------------------------------- | |
| 255 | 226 | |
| 256 | 227 | nconfig |
| 257 | −------- | |
| 228 | +======= | |
| 258 | 229 | |
| 259 | 230 | nconfig is an alternate text-based configurator. It lists function |
| 260 | 231 | keys across the bottom of the terminal (window) that execute commands. |
| @@ -266,61 +237,59 @@ Use F1 for Global help or F3 for the Short help menu. · 5 unmodified lines | ||
| 266 | 237 | |
| 267 | 238 | Searching in nconfig: |
| 268 | 239 | |
| 269 | − You can search either in the menu entry "prompt" strings | |
| 270 | − or in the configuration symbols. | |
| 240 | + You can search either in the menu entry "prompt" strings | |
| 241 | + or in the configuration symbols. | |
| 242 | + | |
| 243 | + Use / to begin a search through the menu entries. This does | |
| 244 | + not support regular expressions. Use <Down> or <Up> for | |
| 245 | + Next hit and Previous hit, respectively. Use <Esc> to | |
| 246 | + terminate the search mode. | |
| 271 | 247 | |
| 272 | − Use / to begin a search through the menu entries. This does | |
| 273 | − not support regular expressions. Use <Down> or <Up> for | |
| 274 | − Next hit and Previous hit, respectively. Use <Esc> to | |
| 275 | − terminate the search mode. | |
| 248 | + F8 (SymSearch) searches the configuration symbols for the | |
| 249 | + given string or regular expression (regex). | |
| 276 | 250 | |
| 277 | − F8 (SymSearch) searches the configuration symbols for the | |
| 278 | − given string or regular expression (regex). | |
| 251 | + In the SymSearch, pressing the key in the (#) prefix will | |
| 252 | + jump directly to that location. You will be returned to the | |
| 253 | + current search results after exiting this new menu. | |
| 279 | 254 | |
| 280 | − In the SymSearch, pressing the key in the (#) prefix will | |
| 281 | − jump directly to that location. You will be returned to the | |
| 282 | − current search results after exiting this new menu. | |
| 255 | +Environment variables: | |
| 283 | 256 | |
| 284 | −NCONFIG_MODE | |
| 285 | −------------ | |
| 286 | −This mode shows all sub-menus in one large tree. | |
| 257 | +``NCONFIG_MODE`` | |
| 258 | + This mode shows all sub-menus in one large tree. | |
| 287 | 259 | |
| 288 | −Example:: | |
| 260 | + Example:: | |
| 289 | 261 | |
| 290 | − make NCONFIG_MODE=single_menu nconfig | |
| 262 | + make NCONFIG_MODE=single_menu nconfig | |
| 291 | 263 | |
| 292 | −---------------------------------------------------------------------- | |
| 293 | 264 | |
| 294 | 265 | xconfig |
| 295 | −------- | |
| 266 | +======= | |
| 296 | 267 | |
| 297 | 268 | Searching in xconfig: |
| 298 | 269 | |
| 299 | − The Search function searches for kernel configuration symbol | |
| 300 | − names, so you have to know something close to what you are | |
| 301 | − looking for. | |
| 302 | − | |
| 303 | − Example:: | |
| 270 | + The Search function searches for kernel configuration symbol | |
| 271 | + names, so you have to know something close to what you are | |
| 272 | + looking for. | |
| 304 | 273 | |
| 305 | − Ctrl-F hotplug | |
| 274 | + Example:: | |
| 306 | 275 | |
| 307 | − or:: | |
| 276 | + Ctrl-F hotplug | |
| 308 | 277 | |
| 309 | − Menu: File, Search, hotplug | |
| 278 | + or:: | |
| 310 | 279 | |
| 311 | − lists all config symbol entries that contain "hotplug" in | |
| 312 | − the symbol name. In this Search dialog, you may change the | |
| 313 | − config setting for any of the entries that are not grayed out. | |
| 314 | − You can also enter a different search string without having | |
| 315 | − to return to the main menu. | |
| 280 | + Menu: File, Search, hotplug | |
| 316 | 281 | |
| 282 | + lists all config symbol entries that contain "hotplug" in | |
| 283 | + the symbol name. In this Search dialog, you may change the | |
| 284 | + config setting for any of the entries that are not grayed out. | |
| 285 | + You can also enter a different search string without having | |
| 286 | + to return to the main menu. | |
| 317 | 287 | |
| 318 | −---------------------------------------------------------------------- | |
| 319 | 288 | |
| 320 | 289 | gconfig |
| 321 | −------- | |
| 290 | +======= | |
| 322 | 291 | |
| 323 | 292 | Searching in gconfig: |
| 324 | 293 | |
| 325 | − There is no search command in gconfig. However, gconfig does | |
| 326 | − have several different viewing choices, modes, and options. | |
| 294 | + There is no search command in gconfig. However, gconfig does | |
| 295 | + have several different viewing choices, modes, and options. | |
| @@ -39,8 +39,8 @@ __all: · 38 unmodified lines | ||
| 39 | 39 | # prepare rule. |
| 40 | 40 | |
| 41 | 41 | this-makefile := $(lastword $(MAKEFILE_LIST)) |
| 42 | −export abs_srctree := $(realpath $(dir $(this-makefile))) | |
| 43 | −export abs_objtree := $(CURDIR) | |
| 42 | +abs_srctree := $(realpath $(dir $(this-makefile))) | |
| 43 | +abs_objtree := $(CURDIR) | |
| 44 | 44 | |
| 45 | 45 | ifneq ($(sub_make_done),1) |
| 46 | 46 | |
| @@ -295,51 +295,51 @@ single-build := · 248 unmodified lines | ||
| 295 | 295 | |
| 296 | 296 | ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) |
| 297 | 297 | ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) |
| 298 | − need-config := | |
| 298 | + need-config := | |
| 299 | 299 | endif |
| 300 | 300 | endif |
| 301 | 301 | |
| 302 | 302 | ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),) |
| 303 | 303 | ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),) |
| 304 | − may-sync-config := | |
| 304 | + may-sync-config := | |
| 305 | 305 | endif |
| 306 | 306 | endif |
| 307 | 307 | |
| 308 | 308 | need-compiler := $(may-sync-config) |
| 309 | 309 | |
| 310 | 310 | ifneq ($(KBUILD_EXTMOD),) |
| 311 | − may-sync-config := | |
| 311 | + may-sync-config := | |
| 312 | 312 | endif |
| 313 | 313 | |
| 314 | 314 | ifeq ($(KBUILD_EXTMOD),) |
| 315 | − ifneq ($(filter %config,$(MAKECMDGOALS)),) | |
| 316 | − config-build := 1 | |
| 317 | − ifneq ($(words $(MAKECMDGOALS)),1) | |
| 318 | − mixed-build := 1 | |
| 319 | − endif | |
| 315 | + ifneq ($(filter %config,$(MAKECMDGOALS)),) | |
| 316 | + config-build := 1 | |
| 317 | + ifneq ($(words $(MAKECMDGOALS)),1) | |
| 318 | + mixed-build := 1 | |
| 320 | 319 | endif |
| 320 | + endif | |
| 321 | 321 | endif |
| 322 | 322 | |
| 323 | 323 | # We cannot build single targets and the others at the same time |
| 324 | 324 | ifneq ($(filter $(single-targets), $(MAKECMDGOALS)),) |
| 325 | − single-build := 1 | |
| 325 | + single-build := 1 | |
| 326 | 326 | ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),) |
| 327 | − mixed-build := 1 | |
| 327 | + mixed-build := 1 | |
| 328 | 328 | endif |
| 329 | 329 | endif |
| 330 | 330 | |
| 331 | 331 | # For "make -j clean all", "make -j mrproper defconfig all", etc. |
| 332 | 332 | ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),) |
| 333 | − ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),) | |
| 334 | − mixed-build := 1 | |
| 335 | − endif | |
| 333 | + ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),) | |
| 334 | + mixed-build := 1 | |
| 335 | + endif | |
| 336 | 336 | endif |
| 337 | 337 | |
| 338 | 338 | # install and modules_install need also be processed one by one |
| 339 | 339 | ifneq ($(filter install,$(MAKECMDGOALS)),) |
| 340 | − ifneq ($(filter modules_install,$(MAKECMDGOALS)),) | |
| 341 | − mixed-build := 1 | |
| 342 | − endif | |
| 340 | + ifneq ($(filter modules_install,$(MAKECMDGOALS)),) | |
| 341 | + mixed-build := 1 | |
| 342 | + endif | |
| 343 | 343 | endif |
| 344 | 344 | |
| 345 | 345 | ifdef mixed-build |
| @@ -965,8 +965,15 @@ export CC_FLAGS_CFI · 619 unmodified lines | ||
| 965 | 965 | endif |
| 966 | 966 | |
| 967 | 967 | ifneq ($(CONFIG_FUNCTION_ALIGNMENT),0) |
| 968 | +# Set the minimal function alignment. Use the newer GCC option | |
| 969 | +# -fmin-function-alignment if it is available, or fall back to -falign-funtions. | |
| 970 | +# See also CONFIG_CC_HAS_SANE_FUNCTION_ALIGNMENT. | |
| 971 | +ifdef CONFIG_CC_HAS_MIN_FUNCTION_ALIGNMENT | |
| 972 | +KBUILD_CFLAGS += -fmin-function-alignment=$(CONFIG_FUNCTION_ALIGNMENT) | |
| 973 | +else | |
| 968 | 974 | KBUILD_CFLAGS += -falign-functions=$(CONFIG_FUNCTION_ALIGNMENT) |
| 969 | 975 | endif |
| 976 | +endif | |
| 970 | 977 | |
| 971 | 978 | # arch Makefile may override CC so keep this after arch Makefile is included |
| 972 | 979 | NOSTDINC_FLAGS += -nostdinc |
| @@ -1384,7 +1391,7 @@ ifneq ($(dtstree),) · 411 unmodified lines | ||
| 1384 | 1391 | |
| 1385 | 1392 | PHONY += dtbs dtbs_prepare dtbs_install dtbs_check |
| 1386 | 1393 | dtbs: dtbs_prepare |
| 1387 | − $(Q)$(MAKE) $(build)=$(dtstree) | |
| 1394 | + $(Q)$(MAKE) $(build)=$(dtstree) need-dtbslist=1 | |
| 1388 | 1395 | |
| 1389 | 1396 | # include/config/kernel.release is actually needed when installing DTBs because |
| 1390 | 1397 | # INSTALL_DTBS_PATH contains $(KERNELRELEASE). However, we do not want to make |
| @@ -1402,7 +1409,7 @@ endif · 11 unmodified lines | ||
| 1402 | 1409 | dtbs_check: dtbs |
| 1403 | 1410 | |
| 1404 | 1411 | dtbs_install: |
| 1405 | − $(Q)$(MAKE) $(dtbinst)=$(dtstree) dst=$(INSTALL_DTBS_PATH) | |
| 1412 | + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.dtbinst obj=$(dtstree) | |
| 1406 | 1413 | |
| 1407 | 1414 | ifdef CONFIG_OF_EARLY_FLATTREE |
| 1408 | 1415 | all: dtbs |
| @@ -1923,7 +1930,7 @@ clean: $(clean-dirs) · 514 unmodified lines | ||
| 1923 | 1930 | -o -name '*.ko.*' \ |
| 1924 | 1931 | -o -name '*.dtb' -o -name '*.dtbo' \ |
| 1925 | 1932 | -o -name '*.dtb.S' -o -name '*.dtbo.S' \ |
| 1926 | − -o -name '*.dt.yaml' \ | |
| 1933 | + -o -name '*.dt.yaml' -o -name 'dtbs-list' \ | |
| 1927 | 1934 | -o -name '*.dwo' -o -name '*.lst' \ |
| 1928 | 1935 | -o -name '*.su' -o -name '*.mod' \ |
| 1929 | 1936 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ |
| @@ -1597,4 +1597,16 @@ config FUNCTION_ALIGNMENT · 1596 unmodified lines | ||
| 1597 | 1597 | default 4 if FUNCTION_ALIGNMENT_4B |
| 1598 | 1598 | default 0 |
| 1599 | 1599 | |
| 1600 | +config CC_HAS_MIN_FUNCTION_ALIGNMENT | |
| 1601 | + # Detect availability of the GCC option -fmin-function-alignment which | |
| 1602 | + # guarantees minimal alignment for all functions, unlike | |
| 1603 | + # -falign-functions which the compiler ignores for cold functions. | |
| 1604 | + def_bool $(cc-option, -fmin-function-alignment=8) | |
| 1605 | + | |
| 1606 | +config CC_HAS_SANE_FUNCTION_ALIGNMENT | |
| 1607 | + # Set if the guaranteed alignment with -fmin-function-alignment is | |
| 1608 | + # available or extra care is required in the kernel. Clang provides | |
| 1609 | + # strict alignment always, even with -falign-functions. | |
| 1610 | + def_bool CC_HAS_MIN_FUNCTION_ALIGNMENT || CC_IS_CLANG | |
| 1611 | + | |
| 1600 | 1612 | endmenu |
| @@ -339,6 +339,7 @@ config ALPHA_EV4 · 338 unmodified lines | ||
| 339 | 339 | bool |
| 340 | 340 | depends on ALPHA_JENSEN || (ALPHA_SABLE && !ALPHA_GAMMA) || ALPHA_LYNX || ALPHA_NORITAKE && !ALPHA_PRIMO || ALPHA_MIKASA && !ALPHA_PRIMO || ALPHA_CABRIOLET || ALPHA_AVANTI_CH || ALPHA_EB64P_CH || ALPHA_XL || ALPHA_NONAME || ALPHA_EB66 || ALPHA_EB66P || ALPHA_P2K |
| 341 | 341 | default y if !ALPHA_LYNX |
| 342 | + default y if !ALPHA_EV5 | |
| 342 | 343 | |
| 343 | 344 | config ALPHA_LCA |
| 344 | 345 | bool |
| @@ -366,10 +367,6 @@ config ALPHA_EV5 · 21 unmodified lines | ||
| 366 | 367 | bool "EV5 CPU(s) (model 5/xxx)?" if ALPHA_LYNX |
| 367 | 368 | default y if ALPHA_RX164 || ALPHA_RAWHIDE || ALPHA_MIATA || ALPHA_LX164 || ALPHA_SX164 || ALPHA_RUFFIAN || ALPHA_SABLE && ALPHA_GAMMA || ALPHA_NORITAKE && ALPHA_PRIMO || ALPHA_MIKASA && ALPHA_PRIMO || ALPHA_PC164 || ALPHA_TAKARA || ALPHA_EB164 || ALPHA_ALCOR |
| 368 | 369 | |
| 369 | −config ALPHA_EV4 | |
| 370 | − bool | |
| 371 | − default y if ALPHA_LYNX && !ALPHA_EV5 | |
| 372 | − | |
| 373 | 370 | config ALPHA_CIA |
| 374 | 371 | bool |
| 375 | 372 | depends on ALPHA_MIATA || ALPHA_LX164 || ALPHA_SX164 || ALPHA_RUFFIAN || ALPHA_NORITAKE && ALPHA_PRIMO || ALPHA_MIKASA && ALPHA_PRIMO || ALPHA_PC164 || ALPHA_TAKARA || ALPHA_EB164 || ALPHA_ALCOR |
| @@ -394,16 +391,12 @@ config ALPHA_PRIMO · 18 unmodified lines | ||
| 394 | 391 | Say Y if you have an AS 1000 5/xxx or an AS 1000A 5/xxx. |
| 395 | 392 | |
| 396 | 393 | config ALPHA_GAMMA |
| 397 | − bool "EV5 CPU(s) (model 5/xxx)?" | |
| 398 | − depends on ALPHA_SABLE | |
| 394 | + bool "EV5 CPU(s) (model 5/xxx)?" if ALPHA_SABLE | |
| 395 | + depends on ALPHA_SABLE || ALPHA_LYNX | |
| 396 | + default ALPHA_LYNX | |
| 399 | 397 | help |
| 400 | 398 | Say Y if you have an AS 2000 5/xxx or an AS 2100 5/xxx. |
| 401 | 399 | |
| 402 | −config ALPHA_GAMMA | |
| 403 | − bool | |
| 404 | − depends on ALPHA_LYNX | |
| 405 | − default y | |
| 406 | − | |
| 407 | 400 | config ALPHA_T2 |
| 408 | 401 | bool |
| 409 | 402 | depends on ALPHA_SABLE || ALPHA_LYNX |
| @@ -7,11 +7,13 @@ config HEXAGON · 6 unmodified lines | ||
| 7 | 7 | select ARCH_32BIT_OFF_T |
| 8 | 8 | select ARCH_HAS_SYNC_DMA_FOR_DEVICE |
| 9 | 9 | select ARCH_NO_PREEMPT |
| 10 | + select ARCH_WANT_FRAME_POINTERS | |
| 10 | 11 | select DMA_GLOBAL_POOL |
| 11 | 12 | select HAVE_PAGE_SIZE_4KB |
| 12 | 13 | select HAVE_PAGE_SIZE_16KB |
| 13 | 14 | select HAVE_PAGE_SIZE_64KB |
| 14 | 15 | select HAVE_PAGE_SIZE_256KB |
| 16 | + select FRAME_POINTER | |
| 15 | 17 | # Other pending projects/to-do items. |
| 16 | 18 | # select HAVE_REGS_AND_STACK_ACCESS_API |
| 17 | 19 | # select HAVE_HW_BREAKPOINT if PERF_EVENTS |
| @@ -23,6 +25,7 @@ config HEXAGON · 5 unmodified lines | ||
| 23 | 25 | select HAVE_PERF_EVENTS |
| 24 | 26 | # GENERIC_ALLOCATOR is used by dma_alloc_coherent() |
| 25 | 27 | select GENERIC_ALLOCATOR |
| 28 | + select GENERIC_IRQ_PROBE | |
| 26 | 29 | select GENERIC_IRQ_SHOW |
| 27 | 30 | select HAVE_ARCH_KGDB |
| 28 | 31 | select HAVE_ARCH_TRACEHOOK |
| @@ -47,9 +50,6 @@ config HEXAGON_PHYS_OFFSET · 18 unmodified lines | ||
| 47 | 50 | help |
| 48 | 51 | Platforms that don't load the kernel at zero set this. |
| 49 | 52 | |
| 50 | −config FRAME_POINTER | |
| 51 | − def_bool y | |
| 52 | − | |
| 53 | 53 | config LOCKDEP_SUPPORT |
| 54 | 54 | def_bool y |
| 55 | 55 | |
| @@ -62,12 +62,6 @@ config MMU · 6 unmodified lines | ||
| 62 | 62 | config GENERIC_CSUM |
| 63 | 63 | def_bool y |
| 64 | 64 | |
| 65 | −# | |
| 66 | −# Use the generic interrupt handling code in kernel/irq/: | |
| 67 | −# | |
| 68 | −config GENERIC_IRQ_PROBE | |
| 69 | − def_bool y | |
| 70 | − | |
| 71 | 65 | config GENERIC_HWEIGHT |
| 72 | 66 | def_bool y |
| 73 | 67 | |
| @@ -238,9 +238,9 @@ config PARISC_HUGE_KERNEL · 237 unmodified lines | ||
| 238 | 238 | def_bool y if !MODULES || UBSAN || FTRACE || COMPILE_TEST |
| 239 | 239 | |
| 240 | 240 | config MLONGCALLS |
| 241 | − def_bool y if PARISC_HUGE_KERNEL | |
| 242 | 241 | bool "Enable the -mlong-calls compiler option for big kernels" if !PARISC_HUGE_KERNEL |
| 243 | 242 | depends on PA8X00 |
| 243 | + default PARISC_HUGE_KERNEL | |
| 244 | 244 | help |
| 245 | 245 | If you configure the kernel to include many drivers built-in instead |
| 246 | 246 | as modules, the kernel executable may become too big, so that the |
| @@ -255,9 +255,9 @@ config MLONGCALLS · 8 unmodified lines | ||
| 255 | 255 | Enabling this option will probably slow down your kernel. |
| 256 | 256 | |
| 257 | 257 | config 64BIT |
| 258 | − def_bool y if "$(ARCH)" = "parisc64" | |
| 259 | 258 | bool "64-bit kernel" if "$(ARCH)" = "parisc" |
| 260 | 259 | depends on PA8X00 |
| 260 | + default "$(ARCH)" = "parisc64" | |
| 261 | 261 | help |
| 262 | 262 | Enable this if you want to support 64bit kernel on PA-RISC platform. |
| 263 | 263 | |
| @@ -6,7 +6,7 @@ config AS_HAS_ULEB128 · 5 unmodified lines | ||
| 6 | 6 | |
| 7 | 7 | menuconfig RUNTIME_KERNEL_TESTING_MENU |
| 8 | 8 | bool "arch/riscv/kernel runtime Testing" |
| 9 | − def_bool y | |
| 9 | + default y | |
| 10 | 10 | help |
| 11 | 11 | Enable riscv kernel runtime testing. |
| 12 | 12 | |
| @@ -9,7 +9,9 @@ include $(srctree)/lib/vdso/Makefile · 8 unmodified lines | ||
| 9 | 9 | # Sanitizer runtimes are unavailable and cannot be linked here. |
| 10 | 10 | KASAN_SANITIZE := n |
| 11 | 11 | KMSAN_SANITIZE_vclock_gettime.o := n |
| 12 | +KMSAN_SANITIZE_vdso32/vclock_gettime.o := n | |
| 12 | 13 | KMSAN_SANITIZE_vgetcpu.o := n |
| 14 | +KMSAN_SANITIZE_vdso32/vgetcpu.o := n | |
| 13 | 15 | |
| 14 | 16 | UBSAN_SANITIZE := n |
| 15 | 17 | KCSAN_SANITIZE := n |
| @@ -118,8 +118,8 @@ config KVM_AMD · 117 unmodified lines | ||
| 118 | 118 | will be called kvm-amd. |
| 119 | 119 | |
| 120 | 120 | config KVM_AMD_SEV |
| 121 | − def_bool y | |
| 122 | 121 | bool "AMD Secure Encrypted Virtualization (SEV) support" |
| 122 | + default y | |
| 123 | 123 | depends on KVM_AMD && X86_64 |
| 124 | 124 | depends on CRYPTO_DEV_SP_PSP && !(KVM_AMD=y && CRYPTO_DEV_CCP_DD=m) |
| 125 | 125 | help |
| @@ -4,7 +4,8 @@ ccflags-y += -I $(srctree)/arch/x86/kvm · 3 unmodified lines | ||
| 4 | 4 | ccflags-$(CONFIG_KVM_WERROR) += -Werror |
| 5 | 5 | |
| 6 | 6 | ifeq ($(CONFIG_FRAME_POINTER),y) |
| 7 | −OBJECT_FILES_NON_STANDARD_vmenter.o := y | |
| 7 | +OBJECT_FILES_NON_STANDARD_vmx/vmenter.o := y | |
| 8 | +OBJECT_FILES_NON_STANDARD_svm/vmenter.o := y | |
| 8 | 9 | endif |
| 9 | 10 | |
| 10 | 11 | include $(srctree)/virt/kvm/Makefile.kvm |
| @@ -81,7 +81,6 @@ config XEN_PVH · 80 unmodified lines | ||
| 81 | 81 | bool "Xen PVH guest support" |
| 82 | 82 | depends on XEN && XEN_PVHVM && ACPI |
| 83 | 83 | select PVH |
| 84 | − def_bool n | |
| 85 | 84 | help |
| 86 | 85 | Support for running as a Xen PVH guest. |
| 87 | 86 | |
| @@ -460,7 +460,6 @@ config ACPI_BGRT · 459 unmodified lines | ||
| 460 | 460 | |
| 461 | 461 | config ACPI_REDUCED_HARDWARE_ONLY |
| 462 | 462 | bool "Hardware-reduced ACPI support only" if EXPERT |
| 463 | − def_bool n | |
| 464 | 463 | help |
| 465 | 464 | This config item changes the way the ACPI code is built. When this |
| 466 | 465 | option is selected, the kernel will use a specialized version of |
| @@ -87,8 +87,8 @@ config INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON · 86 unmodified lines | ||
| 87 | 87 | the default value. |
| 88 | 88 | |
| 89 | 89 | config INTEL_IOMMU_PERF_EVENTS |
| 90 | − def_bool y | |
| 91 | 90 | bool "Intel IOMMU performance events" |
| 91 | + default y | |
| 92 | 92 | depends on INTEL_IOMMU && PERF_EVENTS |
| 93 | 93 | help |
| 94 | 94 | Selecting this option will enable the performance monitoring |
| @@ -519,7 +519,6 @@ config DM_VERITY · 518 unmodified lines | ||
| 519 | 519 | If unsure, say N. |
| 520 | 520 | |
| 521 | 521 | config DM_VERITY_VERIFY_ROOTHASH_SIG |
| 522 | − def_bool n | |
| 523 | 522 | bool "Verity data device root hash signature verification support" |
| 524 | 523 | depends on DM_VERITY |
| 525 | 524 | select SYSTEM_DATA_VERIFICATION |
| @@ -99,17 +99,17 @@ static inline void __chk_io_ptr(const volatile void __iomem *ptr) { } · 98 unmodified lines | ||
| 99 | 99 | * gcc: https://gcc.gnu.org/onlinedocs/gcc/Label-Attributes.html#index-cold-label-attribute |
| 100 | 100 | * |
| 101 | 101 | * When -falign-functions=N is in use, we must avoid the cold attribute as |
| 102 | − * contemporary versions of GCC drop the alignment for cold functions. Worse, | |
| 103 | − * GCC can implicitly mark callees of cold functions as cold themselves, so | |
| 104 | − * it's not sufficient to add __function_aligned here as that will not ensure | |
| 105 | − * that callees are correctly aligned. | |
| 102 | + * GCC drops the alignment for cold functions. Worse, GCC can implicitly mark | |
| 103 | + * callees of cold functions as cold themselves, so it's not sufficient to add | |
| 104 | + * __function_aligned here as that will not ensure that callees are correctly | |
| 105 | + * aligned. | |
| 106 | 106 | * |
| 107 | 107 | * See: |
| 108 | 108 | * |
| 109 | 109 | * https://lore.kernel.org/lkml/Y77%2FqVgvaJidFpYt@FVFF77S0Q05N |
| 110 | 110 | * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88345#c9 |
| 111 | 111 | */ |
| 112 | −#if !defined(CONFIG_CC_IS_GCC) || (CONFIG_FUNCTION_ALIGNMENT == 0) | |
| 112 | +#if defined(CONFIG_CC_HAS_SANE_FUNCTION_ALIGNMENT) || (CONFIG_FUNCTION_ALIGNMENT == 0) | |
| 113 | 113 | #define __cold __attribute__((__cold__)) |
| 114 | 114 | #else |
| 115 | 115 | #define __cold |
| @@ -1499,7 +1499,7 @@ config MULTIUSER · 1498 unmodified lines | ||
| 1499 | 1499 | |
| 1500 | 1500 | config SGETMASK_SYSCALL |
| 1501 | 1501 | bool "sgetmask/ssetmask syscalls support" if EXPERT |
| 1502 | − def_bool PARISC || M68K || PPC || MIPS || X86 || SPARC || MICROBLAZE || SUPERH | |
| 1502 | + default PARISC || M68K || PPC || MIPS || X86 || SPARC || MICROBLAZE || SUPERH | |
| 1503 | 1503 | help |
| 1504 | 1504 | sys_sgetmask and sys_ssetmask are obsolete system calls |
| 1505 | 1505 | no longer supported in libc but still enabled by default in some |
| @@ -362,8 +362,7 @@ config MODPROBE_PATH · 361 unmodified lines | ||
| 362 | 362 | userspace can still load modules explicitly). |
| 363 | 363 | |
| 364 | 364 | config TRIM_UNUSED_KSYMS |
| 365 | − bool "Trim unused exported kernel symbols" if EXPERT | |
| 366 | − depends on !COMPILE_TEST | |
| 365 | + bool "Trim unused exported kernel symbols" | |
| 367 | 366 | help |
| 368 | 367 | The kernel and some modules make many symbols available for |
| 369 | 368 | other modules to use via EXPORT_SYMBOL() and variants. Depending |
| @@ -2127,7 +2127,7 @@ config KCOV_IRQ_AREA_SIZE · 2126 unmodified lines | ||
| 2127 | 2127 | |
| 2128 | 2128 | menuconfig RUNTIME_TESTING_MENU |
| 2129 | 2129 | bool "Runtime Testing" |
| 2130 | − def_bool y | |
| 2130 | + default y | |
| 2131 | 2131 | |
| 2132 | 2132 | if RUNTIME_TESTING_MENU |
| 2133 | 2133 | |
| @@ -583,7 +583,7 @@ config MEMORY_BALLOON · 582 unmodified lines | ||
| 583 | 583 | # support for memory balloon compaction |
| 584 | 584 | config BALLOON_COMPACTION |
| 585 | 585 | bool "Allow for balloon memory compaction/migration" |
| 586 | − def_bool y | |
| 586 | + default y | |
| 587 | 587 | depends on COMPACTION && MEMORY_BALLOON |
| 588 | 588 | help |
| 589 | 589 | Memory fragmentation introduced by ballooning might reduce |
| @@ -598,7 +598,7 @@ config BALLOON_COMPACTION · 8 unmodified lines | ||
| 598 | 598 | # support for memory compaction |
| 599 | 599 | config COMPACTION |
| 600 | 600 | bool "Allow for memory compaction" |
| 601 | − def_bool y | |
| 601 | + default y | |
| 602 | 602 | select MIGRATION |
| 603 | 603 | depends on MMU |
| 604 | 604 | help |
| @@ -621,7 +621,6 @@ config COMPACT_UNEVICTABLE_DEFAULT · 16 unmodified lines | ||
| 621 | 621 | # support for free page reporting |
| 622 | 622 | config PAGE_REPORTING |
| 623 | 623 | bool "Free page reporting" |
| 624 | − def_bool n | |
| 625 | 624 | help |
| 626 | 625 | Free page reporting allows for the incremental acquisition of |
| 627 | 626 | free pages from the buddy allocator for the purpose of reporting |
| @@ -633,7 +632,7 @@ config PAGE_REPORTING · 5 unmodified lines | ||
| 633 | 632 | # |
| 634 | 633 | config MIGRATION |
| 635 | 634 | bool "Page migration" |
| 636 | − def_bool y | |
| 635 | + default y | |
| 637 | 636 | depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU |
| 638 | 637 | help |
| 639 | 638 | Allows the migration of the physical location of pages of processes |
| @@ -13,7 +13,7 @@ config IP_DCCP_CCID2_DEBUG · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | config IP_DCCP_CCID3 |
| 15 | 15 | bool "CCID-3 (TCP-Friendly)" |
| 16 | − def_bool y if (IP_DCCP = y || IP_DCCP = m) | |
| 16 | + default IP_DCCP = y || IP_DCCP = m | |
| 17 | 17 | help |
| 18 | 18 | CCID-3 denotes TCP-Friendly Rate Control (TFRC), an equation-based |
| 19 | 19 | rate-controlled congestion control mechanism. TFRC is designed to |
| @@ -100,7 +100,7 @@ rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \ · 99 unmodified lines | ||
| 100 | 100 | -e 's:rust-logo-[0-9a-f]+\.svg:logo.svg:g' \ |
| 101 | 101 | -e 's:favicon-[0-9a-f]+\.svg:logo.svg:g' \ |
| 102 | 102 | -e 's:<link rel="alternate icon" type="image/png" href="[/.]+/static\.files/favicon-(16x16|32x32)-[0-9a-f]+\.png">::g' \ |
| 103 | − -e 's:<a href="srctree/([^"]+)">:<a href="$(abs_srctree)/\1">:g' | |
| 103 | + -e 's:<a href="srctree/([^"]+)">:<a href="$(realpath $(srctree))/\1">:g' | |
| 104 | 104 | $(Q)for f in $(rustdoc_output)/static.files/rustdoc-*.css; do \ |
| 105 | 105 | echo ".logo-container > img { object-fit: contain; }" >> $$f; done |
| 106 | 106 | |
| @@ -414,7 +414,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L · 307 unmodified lines | ||
| 414 | 414 | rust-analyzer: |
| 415 | 415 | $(Q)$(srctree)/scripts/generate_rust_analyzer.py \ |
| 416 | 416 | --cfgs='core=$(core-cfgs)' --cfgs='alloc=$(alloc-cfgs)' \ |
| 417 | − $(abs_srctree) $(abs_objtree) \ | |
| 417 | + $(realpath $(srctree)) $(realpath $(objtree)) \ | |
| 418 | 418 | $(RUST_LIB_SRC) $(KBUILD_EXTMOD) > \ |
| 419 | 419 | $(if $(KBUILD_EXTMOD),$(extmod_prefix),$(objtree))/rust-project.json |
| 420 | 420 | |
| @@ -113,12 +113,6 @@ endef · 112 unmodified lines | ||
| 113 | 113 | # $(Q)$(MAKE) $(build)=dir |
| 114 | 114 | build := -f $(srctree)/scripts/Makefile.build obj |
| 115 | 115 | |
| 116 | −### | |
| 117 | −# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj= | |
| 118 | −# Usage: | |
| 119 | −# $(Q)$(MAKE) $(dtbinst)=dir | |
| 120 | −dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj | |
| 121 | − | |
| 122 | 116 | ### |
| 123 | 117 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj= |
| 124 | 118 | # Usage: |
| @@ -71,6 +71,7 @@ endif · 70 unmodified lines | ||
| 71 | 71 | # subdir-builtin and subdir-modorder may contain duplications. Use $(sort ...) |
| 72 | 72 | subdir-builtin := $(sort $(filter %/built-in.a, $(real-obj-y))) |
| 73 | 73 | subdir-modorder := $(sort $(filter %/modules.order, $(obj-m))) |
| 74 | +subdir-dtbslist := $(sort $(filter %/dtbs-list, $(dtb-y))) | |
| 74 | 75 | |
| 75 | 76 | targets-for-builtin := $(extra-y) |
| 76 | 77 | |
| @@ -213,7 +214,7 @@ endif # CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT · 136 unmodified lines | ||
| 213 | 214 | # 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file |
| 214 | 215 | # 'OBJECT_FILES_NON_STANDARD_foo.o := 'n': override directory skip for a file |
| 215 | 216 | |
| 216 | −is-standard-object = $(if $(filter-out y%, $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n),y) | |
| 217 | +is-standard-object = $(if $(filter-out y%, $(OBJECT_FILES_NON_STANDARD_$(target-stem).o)$(OBJECT_FILES_NON_STANDARD)n),y) | |
| 217 | 218 | |
| 218 | 219 | $(obj)/%.o: objtool-enabled = $(if $(is-standard-object),$(if $(delay-objtool),$(is-single-obj-m),y)) |
| 219 | 220 | |
| @@ -388,6 +389,7 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler · 168 unmodified lines | ||
| 388 | 389 | # To build objects in subdirs, we need to descend into the directories |
| 389 | 390 | $(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ; |
| 390 | 391 | $(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ; |
| 392 | +$(subdir-dtbslist): $(obj)/%/dtbs-list: $(obj)/% ; | |
| 391 | 393 | |
| 392 | 394 | # |
| 393 | 395 | # Rule to compile a set of .o files into one .a file (without symbol table) |
| @@ -404,19 +406,21 @@ $(obj)/built-in.a: $(real-obj-y) FORCE · 10 unmodified lines | ||
| 404 | 406 | $(call if_changed,ar_builtin) |
| 405 | 407 | |
| 406 | 408 | # |
| 407 | −# Rule to create modules.order file | |
| 409 | +# Rule to create modules.order and dtbs-list | |
| 408 | 410 | # |
| 409 | −# Create commands to either record .ko file or cat modules.order from | |
| 410 | −# a subdirectory | |
| 411 | −# Add $(obj-m) as the prerequisite to avoid updating the timestamp of | |
| 412 | −# modules.order unless contained modules are updated. | |
| 411 | +# This is a list of build artifacts (module or dtb) from the current Makefile | |
| 412 | +# and its sub-directories. The timestamp should be updated when any of the | |
| 413 | +# member files. | |
| 413 | 414 | |
| 414 | −cmd_modules_order = { $(foreach m, $(real-prereqs), \ | |
| 415 | − $(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \ | |
| 415 | +cmd_gen_order = { $(foreach m, $(real-prereqs), \ | |
| 416 | + $(if $(filter %/$(notdir $@), $m), cat $m, echo $m);) :; } \ | |
| 416 | 417 | > $@ |
| 417 | 418 | |
| 418 | 419 | $(obj)/modules.order: $(obj-m) FORCE |
| 419 | − $(call if_changed,modules_order) | |
| 420 | + $(call if_changed,gen_order) | |
| 421 | + | |
| 422 | +$(obj)/dtbs-list: $(dtb-y) FORCE | |
| 423 | + $(call if_changed,gen_order) | |
| 420 | 424 | |
| 421 | 425 | # |
| 422 | 426 | # Rule to compile a set of .o files into one .a file (with symbol table) |
| @@ -8,32 +8,36 @@ · 7 unmodified lines | ||
| 8 | 8 | # $INSTALL_PATH/dtbs/$KERNELRELEASE |
| 9 | 9 | # ========================================================================== |
| 10 | 10 | |
| 11 | −src := $(obj) | |
| 12 | − | |
| 13 | 11 | PHONY := __dtbs_install |
| 14 | 12 | __dtbs_install: |
| 15 | 13 | |
| 16 | 14 | include include/config/auto.conf |
| 17 | 15 | include $(srctree)/scripts/Kbuild.include |
| 18 | −include $(kbuild-file) | |
| 19 | − | |
| 20 | −dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-))) | |
| 21 | −subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m)) | |
| 22 | 16 | |
| 23 | −__dtbs_install: $(dtbs) $(subdirs) | |
| 24 | − @: | |
| 17 | +dst := $(INSTALL_DTBS_PATH) | |
| 25 | 18 | |
| 26 | 19 | quiet_cmd_dtb_install = INSTALL $@ |
| 27 | 20 | cmd_dtb_install = install -D $< $@ |
| 28 | 21 | |
| 29 | −$(dst)/%.dtb: $(obj)/%.dtb | |
| 22 | +$(dst)/%: $(obj)/% | |
| 30 | 23 | $(call cmd,dtb_install) |
| 31 | 24 | |
| 32 | −$(dst)/%.dtbo: $(obj)/%.dtbo | |
| 33 | − $(call cmd,dtb_install) | |
| 25 | +dtbs := $(patsubst $(obj)/%,%,$(call read-file, $(obj)/dtbs-list)) | |
| 26 | + | |
| 27 | +ifdef CONFIG_ARCH_WANT_FLAT_DTB_INSTALL | |
| 34 | 28 | |
| 35 | −PHONY += $(subdirs) | |
| 36 | −$(subdirs): | |
| 37 | − $(Q)$(MAKE) $(dtbinst)=$@ dst=$(if $(CONFIG_ARCH_WANT_FLAT_DTB_INSTALL),$(dst),$(patsubst $(obj)/%,$(dst)/%,$@)) | |
| 29 | +define gen_install_rules | |
| 30 | +$(dst)/%: $(obj)/$(1)% | |
| 31 | + $$(call cmd,dtb_install) | |
| 32 | +endef | |
| 33 | + | |
| 34 | +$(foreach d, $(sort $(dir $(dtbs))), $(eval $(call gen_install_rules,$(d)))) | |
| 35 | + | |
| 36 | +dtbs := $(notdir $(dtbs)) | |
| 37 | + | |
| 38 | +endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL | |
| 39 | + | |
| 40 | +__dtbs_install: $(addprefix $(dst)/, $(dtbs)) | |
| 41 | + @: | |
| 38 | 42 | |
| 39 | 43 | .PHONY: $(PHONY) |
| @@ -132,6 +132,8 @@ KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) · 131 unmodified lines | ||
| 132 | 132 | KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare |
| 133 | 133 | KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access) |
| 134 | 134 | KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict) |
| 135 | +KBUILD_CFLAGS += -Wno-enum-compare-conditional | |
| 136 | +KBUILD_CFLAGS += -Wno-enum-enum-conversion | |
| 135 | 137 | endif |
| 136 | 138 | |
| 137 | 139 | endif |
| @@ -185,7 +187,6 @@ KBUILD_CFLAGS += -Wpointer-arith · 47 unmodified lines | ||
| 185 | 187 | KBUILD_CFLAGS += -Wredundant-decls |
| 186 | 188 | KBUILD_CFLAGS += -Wsign-compare |
| 187 | 189 | KBUILD_CFLAGS += -Wswitch-default |
| 188 | −KBUILD_CFLAGS += $(call cc-option, -Wpacked-bitfield-compat) | |
| 189 | 190 | |
| 190 | 191 | KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN3 |
| 191 | 192 | |
| @@ -45,6 +45,11 @@ else · 44 unmodified lines | ||
| 45 | 45 | obj-y := $(filter-out %/, $(obj-y)) |
| 46 | 46 | endif |
| 47 | 47 | |
| 48 | +ifdef need-dtbslist | |
| 49 | +dtb-y += $(addsuffix /dtbs-list, $(subdir-ym)) | |
| 50 | +always-y += dtbs-list | |
| 51 | +endif | |
| 52 | + | |
| 48 | 53 | # Expand $(foo-objs) $(foo-y) etc. by replacing their individuals |
| 49 | 54 | suffix-search = $(strip $(foreach s, $3, $($(1:%$(strip $2)=%$s)))) |
| 50 | 55 | # List composite targets that are constructed by combining other targets |
| @@ -99,6 +104,7 @@ lib-y := $(addprefix $(obj)/,$(lib-y)) · 48 unmodified lines | ||
| 99 | 104 | real-obj-y := $(addprefix $(obj)/,$(real-obj-y)) |
| 100 | 105 | real-obj-m := $(addprefix $(obj)/,$(real-obj-m)) |
| 101 | 106 | multi-obj-m := $(addprefix $(obj)/, $(multi-obj-m)) |
| 107 | +dtb-y := $(addprefix $(obj)/, $(dtb-y)) | |
| 102 | 108 | multi-dtb-y := $(addprefix $(obj)/, $(multi-dtb-y)) |
| 103 | 109 | real-dtb-y := $(addprefix $(obj)/, $(real-dtb-y)) |
| 104 | 110 | subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) |
| @@ -148,7 +154,7 @@ _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(target-stem).lds) · 43 unmodified lines | ||
| 148 | 154 | # |
| 149 | 155 | ifeq ($(CONFIG_GCOV_KERNEL),y) |
| 150 | 156 | _c_flags += $(if $(patsubst n%,, \ |
| 151 | − $(GCOV_PROFILE_$(basetarget).o)$(GCOV_PROFILE)$(CONFIG_GCOV_PROFILE_ALL)), \ | |
| 157 | + $(GCOV_PROFILE_$(target-stem).o)$(GCOV_PROFILE)$(CONFIG_GCOV_PROFILE_ALL)), \ | |
| 152 | 158 | $(CFLAGS_GCOV)) |
| 153 | 159 | endif |
| 154 | 160 | |
| @@ -159,32 +165,32 @@ endif · 4 unmodified lines | ||
| 159 | 165 | ifeq ($(CONFIG_KASAN),y) |
| 160 | 166 | ifneq ($(CONFIG_KASAN_HW_TAGS),y) |
| 161 | 167 | _c_flags += $(if $(patsubst n%,, \ |
| 162 | − $(KASAN_SANITIZE_$(basetarget).o)$(KASAN_SANITIZE)y), \ | |
| 168 | + $(KASAN_SANITIZE_$(target-stem).o)$(KASAN_SANITIZE)y), \ | |
| 163 | 169 | $(CFLAGS_KASAN), $(CFLAGS_KASAN_NOSANITIZE)) |
| 164 | 170 | endif |
| 165 | 171 | endif |
| 166 | 172 | |
| 167 | 173 | ifeq ($(CONFIG_KMSAN),y) |
| 168 | 174 | _c_flags += $(if $(patsubst n%,, \ |
| 169 | − $(KMSAN_SANITIZE_$(basetarget).o)$(KMSAN_SANITIZE)y), \ | |
| 175 | + $(KMSAN_SANITIZE_$(target-stem).o)$(KMSAN_SANITIZE)y), \ | |
| 170 | 176 | $(CFLAGS_KMSAN)) |
| 171 | 177 | _c_flags += $(if $(patsubst n%,, \ |
| 172 | − $(KMSAN_ENABLE_CHECKS_$(basetarget).o)$(KMSAN_ENABLE_CHECKS)y), \ | |
| 178 | + $(KMSAN_ENABLE_CHECKS_$(target-stem).o)$(KMSAN_ENABLE_CHECKS)y), \ | |
| 173 | 179 | , -mllvm -msan-disable-checks=1) |
| 174 | 180 | endif |
| 175 | 181 | |
| 176 | 182 | ifeq ($(CONFIG_UBSAN),y) |
| 177 | 183 | _c_flags += $(if $(patsubst n%,, \ |
| 178 | − $(UBSAN_SANITIZE_$(basetarget).o)$(UBSAN_SANITIZE)y), \ | |
| 184 | + $(UBSAN_SANITIZE_$(target-stem).o)$(UBSAN_SANITIZE)y), \ | |
| 179 | 185 | $(CFLAGS_UBSAN)) |
| 180 | 186 | _c_flags += $(if $(patsubst n%,, \ |
| 181 | − $(UBSAN_SIGNED_WRAP_$(basetarget).o)$(UBSAN_SANITIZE_$(basetarget).o)$(UBSAN_SIGNED_WRAP)$(UBSAN_SANITIZE)y), \ | |
| 187 | + $(UBSAN_SIGNED_WRAP_$(target-stem).o)$(UBSAN_SANITIZE_$(target-stem).o)$(UBSAN_SIGNED_WRAP)$(UBSAN_SANITIZE)y), \ | |
| 182 | 188 | $(CFLAGS_UBSAN_SIGNED_WRAP)) |
| 183 | 189 | endif |
| 184 | 190 | |
| 185 | 191 | ifeq ($(CONFIG_KCOV),y) |
| 186 | 192 | _c_flags += $(if $(patsubst n%,, \ |
| 187 | − $(KCOV_INSTRUMENT_$(basetarget).o)$(KCOV_INSTRUMENT)$(CONFIG_KCOV_INSTRUMENT_ALL)), \ | |
| 193 | + $(KCOV_INSTRUMENT_$(target-stem).o)$(KCOV_INSTRUMENT)$(CONFIG_KCOV_INSTRUMENT_ALL)), \ | |
| 188 | 194 | $(CFLAGS_KCOV)) |
| 189 | 195 | endif |
| 190 | 196 | |
| @@ -194,12 +200,12 @@ endif · 3 unmodified lines | ||
| 194 | 200 | # |
| 195 | 201 | ifeq ($(CONFIG_KCSAN),y) |
| 196 | 202 | _c_flags += $(if $(patsubst n%,, \ |
| 197 | − $(KCSAN_SANITIZE_$(basetarget).o)$(KCSAN_SANITIZE)y), \ | |
| 203 | + $(KCSAN_SANITIZE_$(target-stem).o)$(KCSAN_SANITIZE)y), \ | |
| 198 | 204 | $(CFLAGS_KCSAN)) |
| 199 | 205 | # Some uninstrumented files provide implied barriers required to avoid false |
| 200 | 206 | # positives: set KCSAN_INSTRUMENT_BARRIERS for barrier instrumentation only. |
| 201 | 207 | _c_flags += $(if $(patsubst n%,, \ |
| 202 | − $(KCSAN_INSTRUMENT_BARRIERS_$(basetarget).o)$(KCSAN_INSTRUMENT_BARRIERS)n), \ | |
| 208 | + $(KCSAN_INSTRUMENT_BARRIERS_$(target-stem).o)$(KCSAN_INSTRUMENT_BARRIERS)n), \ | |
| 203 | 209 | -D__KCSAN_INSTRUMENT_BARRIERS__) |
| 204 | 210 | endif |
| 205 | 211 | |
| @@ -364,7 +370,7 @@ DTC_FLAGS += -Wnode_name_chars_strict \ · 158 unmodified lines | ||
| 364 | 370 | -Wunique_unit_address |
| 365 | 371 | endif |
| 366 | 372 | |
| 367 | −DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) | |
| 373 | +DTC_FLAGS += $(DTC_FLAGS_$(target-stem)) | |
| 368 | 374 | |
| 369 | 375 | # Set -@ if the target is a base DTB that overlay is applied onto |
| 370 | 376 | DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@) |
| @@ -135,7 +135,7 @@ snap-pkg: · 134 unmodified lines | ||
| 135 | 135 | mkdir $(objtree)/snap |
| 136 | 136 | $(MAKE) clean |
| 137 | 137 | sed "s@KERNELRELEASE@$(KERNELRELEASE)@; \ |
| 138 | − s@SRCTREE@$(abs_srctree)@" \ | |
| 138 | + s@SRCTREE@$(realpath $(srctree))@" \ | |
| 139 | 139 | $(srctree)/scripts/package/snapcraft.template > \ |
| 140 | 140 | $(objtree)/snap/snapcraft.yaml |
| 141 | 141 | cd $(objtree)/snap && \ |
| @@ -0,0 +1,11 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef ARRAY_SIZE_H | |
| 3 | +#define ARRAY_SIZE_H | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * ARRAY_SIZE - get the number of elements in array @arr | |
| 7 | + * @arr: array to be sized | |
| 8 | + */ | |
| 9 | +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) | |
| 10 | + | |
| 11 | +#endif /* ARRAY_SIZE_H */ | |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <sys/time.h> |
| 15 | 15 | #include <errno.h> |
| 16 | 16 | |
| 17 | +#include "internal.h" | |
| 17 | 18 | #include "lkc.h" |
| 18 | 19 | |
| 19 | 20 | static void conf(struct menu *menu); |
| @@ -171,7 +172,7 @@ enum conf_def_mode { · 151 unmodified lines | ||
| 171 | 172 | static bool conf_set_all_new_symbols(enum conf_def_mode mode) |
| 172 | 173 | { |
| 173 | 174 | struct symbol *sym, *csym; |
| 174 | − int i, cnt; | |
| 175 | + int cnt; | |
| 175 | 176 | /* |
| 176 | 177 | * can't go as the default in switch-case below, otherwise gcc whines |
| 177 | 178 | * about -Wmaybe-uninitialized |
| @@ -226,7 +227,7 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode) · 48 unmodified lines | ||
| 226 | 227 | } |
| 227 | 228 | } |
| 228 | 229 | |
| 229 | − for_all_symbols(i, sym) { | |
| 230 | + for_all_symbols(sym) { | |
| 230 | 231 | if (sym_has_value(sym) || sym->flags & SYMBOL_VALID) |
| 231 | 232 | continue; |
| 232 | 233 | switch (sym_get_type(sym)) { |
| @@ -278,14 +279,14 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode) · 45 unmodified lines | ||
| 278 | 279 | * and the rest to no. |
| 279 | 280 | */ |
| 280 | 281 | if (mode != def_random) { |
| 281 | − for_all_symbols(i, csym) { | |
| 282 | + for_all_symbols(csym) { | |
| 282 | 283 | if ((sym_is_choice(csym) && !sym_has_value(csym)) || |
| 283 | 284 | sym_is_choice_value(csym)) |
| 284 | 285 | csym->flags |= SYMBOL_NEED_SET_CHOICE_VALUES; |
| 285 | 286 | } |
| 286 | 287 | } |
| 287 | 288 | |
| 288 | − for_all_symbols(i, csym) { | |
| 289 | + for_all_symbols(csym) { | |
| 289 | 290 | if (sym_has_value(csym) || !sym_is_choice(csym)) |
| 290 | 291 | continue; |
| 291 | 292 | |
| @@ -304,9 +305,8 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode) · 12 unmodified lines | ||
| 304 | 305 | static void conf_rewrite_tristates(tristate old_val, tristate new_val) |
| 305 | 306 | { |
| 306 | 307 | struct symbol *sym; |
| 307 | − int i; | |
| 308 | 308 | |
| 309 | − for_all_symbols(i, sym) { | |
| 309 | + for_all_symbols(sym) { | |
| 310 | 310 | if (sym_get_type(sym) == S_TRISTATE && |
| 311 | 311 | sym->def[S_DEF_USER].tri == old_val) |
| 312 | 312 | sym->def[S_DEF_USER].tri = new_val; |
| @@ -18,8 +18,11 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <time.h> |
| 19 | 19 | #include <unistd.h> |
| 20 | 20 | |
| 21 | +#include "internal.h" | |
| 21 | 22 | #include "lkc.h" |
| 22 | 23 | |
| 24 | +struct gstr autoconf_cmd; | |
| 25 | + | |
| 23 | 26 | /* return true if 'path' exists, false otherwise */ |
| 24 | 27 | static bool is_present(const char *path) |
| 25 | 28 | { |
| @@ -293,63 +296,12 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) · 267 unmodified lines | ||
| 293 | 296 | return 0; |
| 294 | 297 | } |
| 295 | 298 | |
| 296 | −#define LINE_GROWTH 16 | |
| 297 | −static int add_byte(int c, char **lineptr, size_t slen, size_t *n) | |
| 298 | −{ | |
| 299 | − size_t new_size = slen + 1; | |
| 300 | − | |
| 301 | − if (new_size > *n) { | |
| 302 | − new_size += LINE_GROWTH - 1; | |
| 303 | − new_size *= 2; | |
| 304 | − *lineptr = xrealloc(*lineptr, new_size); | |
| 305 | − *n = new_size; | |
| 306 | − } | |
| 307 | − | |
| 308 | − (*lineptr)[slen] = c; | |
| 309 | − | |
| 310 | − return 0; | |
| 311 | −} | |
| 312 | − | |
| 313 | −static ssize_t compat_getline(char **lineptr, size_t *n, FILE *stream) | |
| 314 | −{ | |
| 315 | − char *line = *lineptr; | |
| 316 | − size_t slen = 0; | |
| 317 | − | |
| 318 | − for (;;) { | |
| 319 | − int c = getc(stream); | |
| 320 | − | |
| 321 | − switch (c) { | |
| 322 | − case '\n': | |
| 323 | − if (add_byte(c, &line, slen, n) < 0) | |
| 324 | − goto e_out; | |
| 325 | − slen++; | |
| 326 | − /* fall through */ | |
| 327 | − case EOF: | |
| 328 | − if (add_byte('\0', &line, slen, n) < 0) | |
| 329 | − goto e_out; | |
| 330 | − *lineptr = line; | |
| 331 | − if (slen == 0) | |
| 332 | − return -1; | |
| 333 | − return slen; | |
| 334 | − default: | |
| 335 | − if (add_byte(c, &line, slen, n) < 0) | |
| 336 | − goto e_out; | |
| 337 | − slen++; | |
| 338 | − } | |
| 339 | − } | |
| 340 | − | |
| 341 | −e_out: | |
| 342 | − line[slen-1] = '\0'; | |
| 343 | − *lineptr = line; | |
| 344 | − return -1; | |
| 345 | −} | |
| 346 | − | |
| 347 | 299 | /* like getline(), but the newline character is stripped away */ |
| 348 | 300 | static ssize_t getline_stripped(char **lineptr, size_t *n, FILE *stream) |
| 349 | 301 | { |
| 350 | 302 | ssize_t len; |
| 351 | 303 | |
| 352 | − len = compat_getline(lineptr, n, stream); | |
| 304 | + len = getline(lineptr, n, stream); | |
| 353 | 305 | |
| 354 | 306 | if (len > 0 && (*lineptr)[len - 1] == '\n') { |
| 355 | 307 | len--; |
| @@ -371,7 +323,7 @@ int conf_read_simple(const char *name, int def) · 15 unmodified lines | ||
| 371 | 323 | size_t line_asize = 0; |
| 372 | 324 | char *p, *val; |
| 373 | 325 | struct symbol *sym; |
| 374 | − int i, def_flags; | |
| 326 | + int def_flags; | |
| 375 | 327 | const char *warn_unknown, *sym_name; |
| 376 | 328 | |
| 377 | 329 | warn_unknown = getenv("KCONFIG_WARN_UNKNOWN_SYMBOLS"); |
| @@ -429,7 +381,7 @@ load: · 51 unmodified lines | ||
| 429 | 381 | conf_warnings = 0; |
| 430 | 382 | |
| 431 | 383 | def_flags = SYMBOL_DEF << def; |
| 432 | − for_all_symbols(i, sym) { | |
| 384 | + for_all_symbols(sym) { | |
| 433 | 385 | sym->flags |= SYMBOL_CHANGED; |
| 434 | 386 | sym->flags &= ~(def_flags|SYMBOL_VALID); |
| 435 | 387 | if (sym_is_choice(sym)) |
| @@ -538,7 +490,6 @@ int conf_read(const char *name) · 102 unmodified lines | ||
| 538 | 490 | { |
| 539 | 491 | struct symbol *sym; |
| 540 | 492 | int conf_unsaved = 0; |
| 541 | − int i; | |
| 542 | 493 | |
| 543 | 494 | conf_set_changed(false); |
| 544 | 495 | |
| @@ -549,7 +500,7 @@ int conf_read(const char *name) · 4 unmodified lines | ||
| 549 | 500 | |
| 550 | 501 | sym_calc_value(modules_sym); |
| 551 | 502 | |
| 552 | − for_all_symbols(i, sym) { | |
| 503 | + for_all_symbols(sym) { | |
| 553 | 504 | sym_calc_value(sym); |
| 554 | 505 | if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE)) |
| 555 | 506 | continue; |
| @@ -573,7 +524,7 @@ int conf_read(const char *name) · 17 unmodified lines | ||
| 573 | 524 | /* maybe print value in verbose mode... */ |
| 574 | 525 | } |
| 575 | 526 | |
| 576 | − for_all_symbols(i, sym) { | |
| 527 | + for_all_symbols(sym) { | |
| 577 | 528 | if (sym_has_value(sym) && !sym_is_choice_value(sym)) { |
| 578 | 529 | /* Reset values of generates values, so they'll appear |
| 579 | 530 | * as new, if they should become visible, but that |
| @@ -848,10 +799,7 @@ int conf_write_defconfig(const char *filename) · 268 unmodified lines | ||
| 848 | 799 | while (menu != NULL) |
| 849 | 800 | { |
| 850 | 801 | sym = menu->sym; |
| 851 | − if (sym == NULL) { | |
| 852 | − if (!menu_is_visible(menu)) | |
| 853 | − goto next_menu; | |
| 854 | − } else if (!sym_is_choice(sym)) { | |
| 802 | + if (sym && !sym_is_choice(sym)) { | |
| 855 | 803 | sym_calc_value(sym); |
| 856 | 804 | if (!(sym->flags & SYMBOL_WRITE)) |
| 857 | 805 | goto next_menu; |
| @@ -911,7 +859,6 @@ int conf_write(const char *name) · 53 unmodified lines | ||
| 911 | 859 | const char *str; |
| 912 | 860 | char tmpname[PATH_MAX + 1], oldname[PATH_MAX + 1]; |
| 913 | 861 | char *env; |
| 914 | − int i; | |
| 915 | 862 | bool need_newline = false; |
| 916 | 863 | |
| 917 | 864 | if (!name) |
| @@ -995,7 +942,7 @@ end_check: · 77 unmodified lines | ||
| 995 | 942 | } |
| 996 | 943 | fclose(out); |
| 997 | 944 | |
| 998 | − for_all_symbols(i, sym) | |
| 945 | + for_all_symbols(sym) | |
| 999 | 946 | sym->flags &= ~SYMBOL_WRITTEN; |
| 1000 | 947 | |
| 1001 | 948 | if (*tmpname) { |
| @@ -1023,7 +970,6 @@ end_check: · 21 unmodified lines | ||
| 1023 | 970 | static int conf_write_autoconf_cmd(const char *autoconf_name) |
| 1024 | 971 | { |
| 1025 | 972 | char name[PATH_MAX], tmp[PATH_MAX]; |
| 1026 | − struct file *file; | |
| 1027 | 973 | FILE *out; |
| 1028 | 974 | int ret; |
| 1029 | 975 | |
| @@ -1044,15 +990,9 @@ static int conf_write_autoconf_cmd(const char *autoconf_name) · 14 unmodified lines | ||
| 1044 | 990 | return -1; |
| 1045 | 991 | } |
| 1046 | 992 | |
| 1047 | − fprintf(out, "deps_config := \\\n"); | |
| 1048 | − for (file = file_list; file; file = file->next) | |
| 1049 | − fprintf(out, "\t%s \\\n", file->name); | |
| 1050 | − | |
| 1051 | − fprintf(out, "\n%s: $(deps_config)\n\n", autoconf_name); | |
| 993 | + fprintf(out, "autoconfig := %s\n", autoconf_name); | |
| 1052 | 994 | |
| 1053 | − env_write_dep(out, autoconf_name); | |
| 1054 | − | |
| 1055 | − fprintf(out, "\n$(deps_config): ;\n"); | |
| 995 | + fputs(str_get(&autoconf_cmd), out); | |
| 1056 | 996 | |
| 1057 | 997 | fflush(out); |
| 1058 | 998 | ret = ferror(out); /* error check for all fprintf() calls */ |
| @@ -1072,7 +1012,7 @@ static int conf_touch_deps(void) · 13 unmodified lines | ||
| 1072 | 1012 | { |
| 1073 | 1013 | const char *name, *tmp; |
| 1074 | 1014 | struct symbol *sym; |
| 1075 | − int res, i; | |
| 1015 | + int res; | |
| 1076 | 1016 | |
| 1077 | 1017 | name = conf_get_autoconfig_name(); |
| 1078 | 1018 | tmp = strrchr(name, '/'); |
| @@ -1086,7 +1026,7 @@ static int conf_touch_deps(void) · 7 unmodified lines | ||
| 1086 | 1026 | conf_read_simple(name, S_DEF_AUTO); |
| 1087 | 1027 | sym_calc_value(modules_sym); |
| 1088 | 1028 | |
| 1089 | − for_all_symbols(i, sym) { | |
| 1029 | + for_all_symbols(sym) { | |
| 1090 | 1030 | sym_calc_value(sym); |
| 1091 | 1031 | if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name) |
| 1092 | 1032 | continue; |
| @@ -1152,7 +1092,7 @@ static int __conf_write_autoconf(const char *filename, · 59 unmodified lines | ||
| 1152 | 1092 | char tmp[PATH_MAX]; |
| 1153 | 1093 | FILE *file; |
| 1154 | 1094 | struct symbol *sym; |
| 1155 | − int ret, i; | |
| 1095 | + int ret; | |
| 1156 | 1096 | |
| 1157 | 1097 | if (make_parent_dir(filename)) |
| 1158 | 1098 | return -1; |
| @@ -1169,7 +1109,7 @@ static int __conf_write_autoconf(const char *filename, · 10 unmodified lines | ||
| 1169 | 1109 | |
| 1170 | 1110 | conf_write_heading(file, comment_style); |
| 1171 | 1111 | |
| 1172 | − for_all_symbols(i, sym) | |
| 1112 | + for_all_symbols(sym) | |
| 1173 | 1113 | if ((sym->flags & SYMBOL_WRITE) && sym->name) |
| 1174 | 1114 | print_symbol(file, sym); |
| 1175 | 1115 | |
| @@ -1192,7 +1132,7 @@ int conf_write_autoconf(int overwrite) · 16 unmodified lines | ||
| 1192 | 1132 | { |
| 1193 | 1133 | struct symbol *sym; |
| 1194 | 1134 | const char *autoconf_name = conf_get_autoconfig_name(); |
| 1195 | − int ret, i; | |
| 1135 | + int ret; | |
| 1196 | 1136 | |
| 1197 | 1137 | if (!overwrite && is_present(autoconf_name)) |
| 1198 | 1138 | return 0; |
| @@ -1204,7 +1144,7 @@ int conf_write_autoconf(int overwrite) · 5 unmodified lines | ||
| 1204 | 1144 | if (conf_touch_deps()) |
| 1205 | 1145 | return 1; |
| 1206 | 1146 | |
| 1207 | − for_all_symbols(i, sym) | |
| 1147 | + for_all_symbols(sym) | |
| 1208 | 1148 | sym_calc_value(sym); |
| 1209 | 1149 | |
| 1210 | 1150 | ret = __conf_write_autoconf(conf_get_autoheader_name(), |
| @@ -12,17 +12,12 @@ extern "C" { · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | #include <assert.h> |
| 14 | 14 | #include <stdio.h> |
| 15 | −#include "list.h" | |
| 15 | +#include "list_types.h" | |
| 16 | 16 | #ifndef __cplusplus |
| 17 | 17 | #include <stdbool.h> |
| 18 | 18 | #endif |
| 19 | 19 | |
| 20 | −struct file { | |
| 21 | − struct file *next; | |
| 22 | − struct file *parent; | |
| 23 | − const char *name; | |
| 24 | − int lineno; | |
| 25 | −}; | |
| 20 | +#include "list_types.h" | |
| 26 | 21 | |
| 27 | 22 | typedef enum tristate { |
| 28 | 23 | no, mod, yes |
| @@ -81,8 +76,8 @@ enum { · 52 unmodified lines | ||
| 81 | 76 | * SYMBOL_CHOICE bit set in 'flags'. |
| 82 | 77 | */ |
| 83 | 78 | struct symbol { |
| 84 | − /* The next symbol in the same bucket in the symbol hash table */ | |
| 85 | − struct symbol *next; | |
| 79 | + /* link node for the hash table */ | |
| 80 | + struct hlist_node node; | |
| 86 | 81 | |
| 87 | 82 | /* The name of the symbol, e.g. "FOO" for 'config FOO' */ |
| 88 | 83 | char *name; |
| @@ -113,6 +108,9 @@ struct symbol { · 24 unmodified lines | ||
| 113 | 108 | */ |
| 114 | 109 | tristate visible; |
| 115 | 110 | |
| 111 | + /* config entries associated with this symbol */ | |
| 112 | + struct list_head menus; | |
| 113 | + | |
| 116 | 114 | /* SYMBOL_* flags */ |
| 117 | 115 | int flags; |
| 118 | 116 | |
| @@ -131,8 +129,6 @@ struct symbol { · 12 unmodified lines | ||
| 131 | 129 | struct expr_value implied; |
| 132 | 130 | }; |
| 133 | 131 | |
| 134 | −#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) | |
| 135 | − | |
| 136 | 132 | #define SYMBOL_CONST 0x0001 /* symbol is const */ |
| 137 | 133 | #define SYMBOL_CHECK 0x0008 /* used during dependency checking */ |
| 138 | 134 | #define SYMBOL_CHOICE 0x0010 /* start of a choice block (null name) */ |
| @@ -157,7 +153,6 @@ struct symbol { · 18 unmodified lines | ||
| 157 | 153 | #define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000 |
| 158 | 154 | |
| 159 | 155 | #define SYMBOL_MAXLENGTH 256 |
| 160 | −#define SYMBOL_HASHSIZE 9973 | |
| 161 | 156 | |
| 162 | 157 | /* A property represent the config options that can be associated |
| 163 | 158 | * with a config "symbol". |
| @@ -195,7 +190,7 @@ struct property { · 31 unmodified lines | ||
| 195 | 190 | struct menu *menu; /* the menu the property are associated with |
| 196 | 191 | * valid for: P_SELECT, P_RANGE, P_CHOICE, |
| 197 | 192 | * P_PROMPT, P_DEFAULT, P_MENU, P_COMMENT */ |
| 198 | − struct file *file; /* what file was this property defined */ | |
| 193 | + const char *filename; /* what file was this property defined */ | |
| 199 | 194 | int lineno; /* what lineno was this property defined */ |
| 200 | 195 | }; |
| 201 | 196 | |
| @@ -230,6 +225,8 @@ struct menu { · 28 unmodified lines | ||
| 230 | 225 | */ |
| 231 | 226 | struct symbol *sym; |
| 232 | 227 | |
| 228 | + struct list_head link; /* link to symbol::menus */ | |
| 229 | + | |
| 233 | 230 | /* |
| 234 | 231 | * The prompt associated with the node. This holds the prompt for a |
| 235 | 232 | * symbol as well as the text for a menu or comment, along with the |
| @@ -256,7 +253,7 @@ struct menu { · 20 unmodified lines | ||
| 256 | 253 | char *help; |
| 257 | 254 | |
| 258 | 255 | /* The location where the menu node appears in the Kconfig files */ |
| 259 | − struct file *file; | |
| 256 | + const char *filename; | |
| 260 | 257 | int lineno; |
| 261 | 258 | |
| 262 | 259 | /* For use by front ends that need to store auxiliary data */ |
| @@ -277,10 +274,6 @@ struct jump_key { · 14 unmodified lines | ||
| 277 | 274 | struct menu *target; |
| 278 | 275 | }; |
| 279 | 276 | |
| 280 | −extern struct file *file_list; | |
| 281 | −extern struct file *current_file; | |
| 282 | −struct file *lookup_file(const char *name); | |
| 283 | − | |
| 284 | 277 | extern struct symbol symbol_yes, symbol_no, symbol_mod; |
| 285 | 278 | extern struct symbol *modules_sym; |
| 286 | 279 | extern int cdebug; |
| @@ -0,0 +1,48 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | +#ifndef HASHTABLE_H | |
| 3 | +#define HASHTABLE_H | |
| 4 | + | |
| 5 | +#include "array_size.h" | |
| 6 | +#include "list.h" | |
| 7 | + | |
| 8 | +#define HASH_SIZE(name) (ARRAY_SIZE(name)) | |
| 9 | + | |
| 10 | +#define HASHTABLE_DECLARE(name, size) struct hlist_head name[size] | |
| 11 | + | |
| 12 | +#define HASHTABLE_DEFINE(name, size) \ | |
| 13 | + HASHTABLE_DECLARE(name, size) = \ | |
| 14 | + { [0 ... ((size) - 1)] = HLIST_HEAD_INIT } | |
| 15 | + | |
| 16 | +#define hash_head(table, key) (&(table)[(key) % HASH_SIZE(table)]) | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * hash_add - add an object to a hashtable | |
| 20 | + * @table: hashtable to add to | |
| 21 | + * @node: the &struct hlist_node of the object to be added | |
| 22 | + * @key: the key of the object to be added | |
| 23 | + */ | |
| 24 | +#define hash_add(table, node, key) \ | |
| 25 | + hlist_add_head(node, hash_head(table, key)) | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * hash_for_each - iterate over a hashtable | |
| 29 | + * @table: hashtable to iterate | |
| 30 | + * @obj: the type * to use as a loop cursor for each entry | |
| 31 | + * @member: the name of the hlist_node within the struct | |
| 32 | + */ | |
| 33 | +#define hash_for_each(table, obj, member) \ | |
| 34 | + for (int _bkt = 0; _bkt < HASH_SIZE(table); _bkt++) \ | |
| 35 | + hlist_for_each_entry(obj, &table[_bkt], member) | |
| 36 | + | |
| 37 | +/** | |
| 38 | + * hash_for_each_possible - iterate over all possible objects hashing to the | |
| 39 | + * same bucket | |
| 40 | + * @table: hashtable to iterate | |
| 41 | + * @obj: the type * to use as a loop cursor for each entry | |
| 42 | + * @member: the name of the hlist_node within the struct | |
| 43 | + * @key: the key of the objects to iterate over | |
| 44 | + */ | |
| 45 | +#define hash_for_each_possible(table, obj, member, key) \ | |
| 46 | + hlist_for_each_entry(obj, hash_head(table, key), member) | |
| 47 | + | |
| 48 | +#endif /* HASHTABLE_H */ | |
| @@ -2,8 +2,20 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef INTERNAL_H |
| 3 | 3 | #define INTERNAL_H |
| 4 | 4 | |
| 5 | +#include "hashtable.h" | |
| 6 | + | |
| 7 | +#define SYMBOL_HASHSIZE (1U << 14) | |
| 8 | + | |
| 9 | +extern HASHTABLE_DECLARE(sym_hashtable, SYMBOL_HASHSIZE); | |
| 10 | + | |
| 11 | +#define for_all_symbols(sym) \ | |
| 12 | + hash_for_each(sym_hashtable, sym, node) | |
| 13 | + | |
| 5 | 14 | struct menu; |
| 6 | 15 | |
| 7 | 16 | extern struct menu *current_menu, *current_entry; |
| 8 | 17 | |
| 18 | +extern const char *cur_filename; | |
| 19 | +extern int cur_lineno; | |
| 20 | + | |
| 9 | 21 | #endif /* INTERNAL_H */ |
| @@ -14,16 +14,22 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <string.h> |
| 15 | 15 | |
| 16 | 16 | #include "lkc.h" |
| 17 | +#include "preprocess.h" | |
| 18 | + | |
| 17 | 19 | #include "parser.tab.h" |
| 18 | 20 | |
| 19 | 21 | #define YY_DECL static int yylex1(void) |
| 20 | 22 | |
| 21 | 23 | #define START_STRSIZE 16 |
| 22 | 24 | |
| 23 | −static struct { | |
| 24 | − struct file *file; | |
| 25 | − int lineno; | |
| 26 | −} current_pos; | |
| 25 | +/* The Kconfig file currently being parsed. */ | |
| 26 | +const char *cur_filename; | |
| 27 | + | |
| 28 | +/* | |
| 29 | + * The line number of the current statement. This does not match yylineno. | |
| 30 | + * yylineno is used by the lexer, while cur_lineno is used by the parser. | |
| 31 | + */ | |
| 32 | +int cur_lineno; | |
| 27 | 33 | |
| 28 | 34 | static int prev_prev_token = T_EOL; |
| 29 | 35 | static int prev_token = T_EOL; |
| @@ -33,6 +39,9 @@ static int text_size, text_asize; · 3 unmodified lines | ||
| 33 | 39 | struct buffer { |
| 34 | 40 | struct buffer *parent; |
| 35 | 41 | YY_BUFFER_STATE state; |
| 42 | + int yylineno; | |
| 43 | + const char *filename; | |
| 44 | + int source_lineno; | |
| 36 | 45 | }; |
| 37 | 46 | |
| 38 | 47 | static struct buffer *current_buf; |
| @@ -77,7 +86,7 @@ static void warn_ignored_character(char chr) · 38 unmodified lines | ||
| 77 | 86 | { |
| 78 | 87 | fprintf(stderr, |
| 79 | 88 | "%s:%d:warning: ignoring unsupported character '%c'\n", |
| 80 | − current_file->name, yylineno, chr); | |
| 89 | + cur_filename, yylineno, chr); | |
| 81 | 90 | } |
| 82 | 91 | %} |
| 83 | 92 | |
| @@ -180,7 +189,7 @@ n [A-Za-z0-9_-] · 96 unmodified lines | ||
| 180 | 189 | \n { |
| 181 | 190 | fprintf(stderr, |
| 182 | 191 | "%s:%d:warning: multi-line strings not supported\n", |
| 183 | − zconf_curname(), zconf_lineno()); | |
| 192 | + cur_filename, cur_lineno); | |
| 184 | 193 | unput('\n'); |
| 185 | 194 | BEGIN(INITIAL); |
| 186 | 195 | yylval.string = text; |
| @@ -246,9 +255,9 @@ n [A-Za-z0-9_-] · 59 unmodified lines | ||
| 246 | 255 | |
| 247 | 256 | if (prev_token != T_EOL && prev_token != T_HELPTEXT) |
| 248 | 257 | fprintf(stderr, "%s:%d:warning: no new line at end of file\n", |
| 249 | − current_file->name, yylineno); | |
| 258 | + cur_filename, yylineno); | |
| 250 | 259 | |
| 251 | − if (current_file) { | |
| 260 | + if (current_buf) { | |
| 252 | 261 | zconf_endfile(); |
| 253 | 262 | return T_EOL; |
| 254 | 263 | } |
| @@ -267,19 +276,17 @@ repeat: · 12 unmodified lines | ||
| 267 | 276 | token = yylex1(); |
| 268 | 277 | |
| 269 | 278 | if (prev_token == T_EOL || prev_token == T_HELPTEXT) { |
| 270 | − if (token == T_EOL) { | |
| 279 | + if (token == T_EOL) | |
| 271 | 280 | /* Do not pass unneeded T_EOL to the parser. */ |
| 272 | 281 | goto repeat; |
| 273 | − } else { | |
| 282 | + else | |
| 274 | 283 | /* |
| 275 | − * For the parser, update file/lineno at the first token | |
| 284 | + * For the parser, update lineno at the first token | |
| 276 | 285 | * of each statement. Generally, \n is a statement |
| 277 | 286 | * terminator in Kconfig, but it is not always true |
| 278 | 287 | * because \n could be escaped by a backslash. |
| 279 | 288 | */ |
| 280 | − current_pos.file = current_file; | |
| 281 | − current_pos.lineno = yylineno; | |
| 282 | − } | |
| 289 | + cur_lineno = yylineno; | |
| 283 | 290 | } |
| 284 | 291 | |
| 285 | 292 | if (prev_prev_token == T_EOL && prev_token == T_WORD && |
| @@ -302,8 +309,11 @@ static char *expand_token(const char *in, size_t n) · 16 unmodified lines | ||
| 302 | 309 | new_string(); |
| 303 | 310 | append_string(in, n); |
| 304 | 311 | |
| 305 | − /* get the whole line because we do not know the end of token. */ | |
| 306 | − while ((c = input()) != EOF) { | |
| 312 | + /* | |
| 313 | + * get the whole line because we do not know the end of token. | |
| 314 | + * input() returns 0 (not EOF!) when it reachs the end of file. | |
| 315 | + */ | |
| 316 | + while ((c = input()) != 0) { | |
| 307 | 317 | if (c == '\n') { |
| 308 | 318 | unput(c); |
| 309 | 319 | break; |
| @@ -391,78 +401,60 @@ void zconf_initscan(const char *name) · 81 unmodified lines | ||
| 391 | 401 | exit(1); |
| 392 | 402 | } |
| 393 | 403 | |
| 394 | − current_buf = xmalloc(sizeof(*current_buf)); | |
| 395 | − memset(current_buf, 0, sizeof(*current_buf)); | |
| 396 | − | |
| 397 | − current_file = file_lookup(name); | |
| 404 | + cur_filename = file_lookup(name); | |
| 398 | 405 | yylineno = 1; |
| 399 | 406 | } |
| 400 | 407 | |
| 401 | 408 | void zconf_nextfile(const char *name) |
| 402 | 409 | { |
| 403 | − struct file *iter; | |
| 404 | − struct file *file = file_lookup(name); | |
| 405 | 410 | struct buffer *buf = xmalloc(sizeof(*buf)); |
| 406 | − memset(buf, 0, sizeof(*buf)); | |
| 411 | + bool recur_include = false; | |
| 407 | 412 | |
| 408 | − current_buf->state = YY_CURRENT_BUFFER; | |
| 409 | − yyin = zconf_fopen(file->name); | |
| 413 | + buf->state = YY_CURRENT_BUFFER; | |
| 414 | + buf->yylineno = yylineno; | |
| 415 | + buf->filename = cur_filename; | |
| 416 | + buf->source_lineno = cur_lineno; | |
| 417 | + buf->parent = current_buf; | |
| 418 | + current_buf = buf; | |
| 419 | + yyin = zconf_fopen(name); | |
| 410 | 420 | if (!yyin) { |
| 411 | 421 | fprintf(stderr, "%s:%d: can't open file \"%s\"\n", |
| 412 | − zconf_curname(), zconf_lineno(), file->name); | |
| 422 | + cur_filename, cur_lineno, name); | |
| 413 | 423 | exit(1); |
| 414 | 424 | } |
| 415 | 425 | yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); |
| 416 | − buf->parent = current_buf; | |
| 417 | − current_buf = buf; | |
| 418 | 426 | |
| 419 | − current_file->lineno = yylineno; | |
| 420 | − file->parent = current_file; | |
| 421 | − | |
| 422 | − for (iter = current_file; iter; iter = iter->parent) { | |
| 423 | − if (!strcmp(iter->name, file->name)) { | |
| 424 | − fprintf(stderr, | |
| 425 | − "Recursive inclusion detected.\n" | |
| 426 | − "Inclusion path:\n" | |
| 427 | − " current file : %s\n", file->name); | |
| 428 | − iter = file; | |
| 429 | − do { | |
| 430 | − iter = iter->parent; | |
| 431 | − fprintf(stderr, " included from: %s:%d\n", | |
| 432 | − iter->name, iter->lineno - 1); | |
| 433 | − } while (strcmp(iter->name, file->name)); | |
| 434 | − exit(1); | |
| 435 | − } | |
| 427 | + for (buf = current_buf; buf; buf = buf->parent) { | |
| 428 | + if (!strcmp(buf->filename, name)) | |
| 429 | + recur_include = true; | |
| 436 | 430 | } |
| 437 | 431 | |
| 438 | − yylineno = 1; | |
| 439 | − current_file = file; | |
| 440 | −} | |
| 441 | − | |
| 442 | −static void zconf_endfile(void) | |
| 443 | −{ | |
| 444 | − struct buffer *parent; | |
| 445 | − | |
| 446 | − current_file = current_file->parent; | |
| 447 | − if (current_file) | |
| 448 | − yylineno = current_file->lineno; | |
| 432 | + if (recur_include) { | |
| 433 | + fprintf(stderr, | |
| 434 | + "Recursive inclusion detected.\n" | |
| 435 | + "Inclusion path:\n" | |
| 436 | + " current file : %s\n", name); | |
| 449 | 437 | |
| 450 | − parent = current_buf->parent; | |
| 451 | − if (parent) { | |
| 452 | − fclose(yyin); | |
| 453 | − yy_delete_buffer(YY_CURRENT_BUFFER); | |
| 454 | − yy_switch_to_buffer(parent->state); | |
| 438 | + for (buf = current_buf; buf; buf = buf->parent) | |
| 439 | + fprintf(stderr, " included from: %s:%d\n", | |
| 440 | + buf->filename, buf->source_lineno); | |
| 441 | + exit(1); | |
| 455 | 442 | } |
| 456 | − free(current_buf); | |
| 457 | − current_buf = parent; | |
| 458 | −} | |
| 459 | 443 | |
| 460 | −int zconf_lineno(void) | |
| 461 | −{ | |
| 462 | − return current_pos.lineno; | |
| 444 | + yylineno = 1; | |
| 445 | + cur_filename = file_lookup(name); | |
| 463 | 446 | } |
| 464 | 447 | |
| 465 | −const char *zconf_curname(void) | |
| 448 | +static void zconf_endfile(void) | |
| 466 | 449 | { |
| 467 | − return current_pos.file ? current_pos.file->name : "<none>"; | |
| 450 | + struct buffer *tmp; | |
| 451 | + | |
| 452 | + fclose(yyin); | |
| 453 | + yy_delete_buffer(YY_CURRENT_BUFFER); | |
| 454 | + yy_switch_to_buffer(current_buf->state); | |
| 455 | + yylineno = current_buf->yylineno; | |
| 456 | + cur_filename = current_buf->filename; | |
| 457 | + tmp = current_buf; | |
| 458 | + current_buf = current_buf->parent; | |
| 459 | + free(tmp); | |
| 468 | 460 | } |
| @@ -2,29 +2,39 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef LIST_H |
| 3 | 3 | #define LIST_H |
| 4 | 4 | |
| 5 | −/* | |
| 6 | − * Copied from include/linux/... | |
| 7 | − */ | |
| 5 | +#include <stddef.h> | |
| 8 | 6 | |
| 9 | −#undef offsetof | |
| 10 | −#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) | |
| 7 | +#include "list_types.h" | |
| 8 | + | |
| 9 | +/* Are two types/vars the same type (ignoring qualifiers)? */ | |
| 10 | +#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * container_of - cast a member of a structure out to the containing structure |
| 14 | − * @ptr: the pointer to the member. | |
| 15 | − * @type: the type of the container struct this is embedded in. | |
| 16 | − * @member: the name of the member within the struct. | |
| 14 | + * @ptr: the pointer to the member. | |
| 15 | + * @type: the type of the container struct this is embedded in. | |
| 16 | + * @member: the name of the member within the struct. | |
| 17 | 17 | * |
| 18 | 18 | */ |
| 19 | −#define container_of(ptr, type, member) ({ \ | |
| 20 | − const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | |
| 21 | − (type *)( (char *)__mptr - offsetof(type,member) );}) | |
| 22 | − | |
| 19 | +#define container_of(ptr, type, member) ({ \ | |
| 20 | + void *__mptr = (void *)(ptr); \ | |
| 21 | + _Static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | |
| 22 | + __same_type(*(ptr), void), \ | |
| 23 | + "pointer type mismatch in container_of()"); \ | |
| 24 | + ((type *)(__mptr - offsetof(type, member))); }) | |
| 23 | 25 | |
| 24 | −struct list_head { | |
| 25 | − struct list_head *next, *prev; | |
| 26 | −}; | |
| 26 | +#define LIST_POISON1 ((void *) 0x100) | |
| 27 | +#define LIST_POISON2 ((void *) 0x122) | |
| 27 | 28 | |
| 29 | +/* | |
| 30 | + * Circular doubly linked list implementation. | |
| 31 | + * | |
| 32 | + * Some of the internal functions ("__xxx") are useful when | |
| 33 | + * manipulating whole lists rather than single entries, as | |
| 34 | + * sometimes we already know the next/prev entries and we can | |
| 35 | + * generate better code by using them directly rather than | |
| 36 | + * using the generic single-entry routines. | |
| 37 | + */ | |
| 28 | 38 | |
| 29 | 39 | #define LIST_HEAD_INIT(name) { &(name), &(name) } |
| 30 | 40 | |
| @@ -32,45 +42,16 @@ struct list_head { · 1 unmodified line | ||
| 32 | 42 | struct list_head name = LIST_HEAD_INIT(name) |
| 33 | 43 | |
| 34 | 44 | /** |
| 35 | − * list_entry - get the struct for this entry | |
| 36 | − * @ptr: the &struct list_head pointer. | |
| 37 | − * @type: the type of the struct this is embedded in. | |
| 38 | − * @member: the name of the list_head within the struct. | |
| 39 | − */ | |
| 40 | −#define list_entry(ptr, type, member) \ | |
| 41 | − container_of(ptr, type, member) | |
| 42 | − | |
| 43 | −/** | |
| 44 | − * list_for_each_entry - iterate over list of given type | |
| 45 | − * @pos: the type * to use as a loop cursor. | |
| 46 | − * @head: the head for your list. | |
| 47 | − * @member: the name of the list_head within the struct. | |
| 48 | − */ | |
| 49 | −#define list_for_each_entry(pos, head, member) \ | |
| 50 | − for (pos = list_entry((head)->next, typeof(*pos), member); \ | |
| 51 | − &pos->member != (head); \ | |
| 52 | − pos = list_entry(pos->member.next, typeof(*pos), member)) | |
| 53 | − | |
| 54 | −/** | |
| 55 | − * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry | |
| 56 | − * @pos: the type * to use as a loop cursor. | |
| 57 | − * @n: another type * to use as temporary storage | |
| 58 | − * @head: the head for your list. | |
| 59 | − * @member: the name of the list_head within the struct. | |
| 60 | − */ | |
| 61 | −#define list_for_each_entry_safe(pos, n, head, member) \ | |
| 62 | − for (pos = list_entry((head)->next, typeof(*pos), member), \ | |
| 63 | − n = list_entry(pos->member.next, typeof(*pos), member); \ | |
| 64 | − &pos->member != (head); \ | |
| 65 | − pos = n, n = list_entry(n->member.next, typeof(*n), member)) | |
| 66 | − | |
| 67 | −/** | |
| 68 | − * list_empty - tests whether a list is empty | |
| 69 | − * @head: the list to test. | |
| 45 | + * INIT_LIST_HEAD - Initialize a list_head structure | |
| 46 | + * @list: list_head structure to be initialized. | |
| 47 | + * | |
| 48 | + * Initializes the list_head to point to itself. If it is a list header, | |
| 49 | + * the result is an empty list. | |
| 70 | 50 | */ |
| 71 | −static inline int list_empty(const struct list_head *head) | |
| 51 | +static inline void INIT_LIST_HEAD(struct list_head *list) | |
| 72 | 52 | { |
| 73 | − return head->next == head; | |
| 53 | + list->next = list; | |
| 54 | + list->prev = list; | |
| 74 | 55 | } |
| 75 | 56 | |
| 76 | 57 | /* |
| @@ -79,14 +60,27 @@ static inline int list_empty(const struct list_head *head) · 2 unmodified lines | ||
| 79 | 60 | * This is only for internal list manipulation where we know |
| 80 | 61 | * the prev/next entries already! |
| 81 | 62 | */ |
| 82 | −static inline void __list_add(struct list_head *_new, | |
| 63 | +static inline void __list_add(struct list_head *new, | |
| 83 | 64 | struct list_head *prev, |
| 84 | 65 | struct list_head *next) |
| 85 | 66 | { |
| 86 | − next->prev = _new; | |
| 87 | − _new->next = next; | |
| 88 | − _new->prev = prev; | |
| 89 | − prev->next = _new; | |
| 67 | + next->prev = new; | |
| 68 | + new->next = next; | |
| 69 | + new->prev = prev; | |
| 70 | + prev->next = new; | |
| 71 | +} | |
| 72 | + | |
| 73 | +/** | |
| 74 | + * list_add - add a new entry | |
| 75 | + * @new: new entry to be added | |
| 76 | + * @head: list head to add it after | |
| 77 | + * | |
| 78 | + * Insert a new entry after the specified head. | |
| 79 | + * This is good for implementing stacks. | |
| 80 | + */ | |
| 81 | +static inline void list_add(struct list_head *new, struct list_head *head) | |
| 82 | +{ | |
| 83 | + __list_add(new, head, head->next); | |
| 90 | 84 | } |
| 91 | 85 | |
| 92 | 86 | /** |
| @@ -97,9 +91,9 @@ static inline void __list_add(struct list_head *_new, · 4 unmodified lines | ||
| 97 | 91 | * Insert a new entry before the specified head. |
| 98 | 92 | * This is useful for implementing queues. |
| 99 | 93 | */ |
| 100 | −static inline void list_add_tail(struct list_head *_new, struct list_head *head) | |
| 94 | +static inline void list_add_tail(struct list_head *new, struct list_head *head) | |
| 101 | 95 | { |
| 102 | − __list_add(_new, head->prev, head); | |
| 96 | + __list_add(new, head->prev, head); | |
| 103 | 97 | } |
| 104 | 98 | |
| 105 | 99 | /* |
| @@ -115,8 +109,11 @@ static inline void __list_del(struct list_head *prev, struct list_head *next) · 9 unmodified lines | ||
| 115 | 109 | prev->next = next; |
| 116 | 110 | } |
| 117 | 111 | |
| 118 | −#define LIST_POISON1 ((void *) 0x00100100) | |
| 119 | −#define LIST_POISON2 ((void *) 0x00200200) | |
| 112 | +static inline void __list_del_entry(struct list_head *entry) | |
| 113 | +{ | |
| 114 | + __list_del(entry->prev, entry->next); | |
| 115 | +} | |
| 116 | + | |
| 120 | 117 | /** |
| 121 | 118 | * list_del - deletes entry from list. |
| 122 | 119 | * @entry: the element to delete from the list. |
| @@ -125,8 +122,135 @@ static inline void __list_del(struct list_head *prev, struct list_head *next) · 2 unmodified lines | ||
| 125 | 122 | */ |
| 126 | 123 | static inline void list_del(struct list_head *entry) |
| 127 | 124 | { |
| 128 | − __list_del(entry->prev, entry->next); | |
| 129 | − entry->next = (struct list_head*)LIST_POISON1; | |
| 130 | − entry->prev = (struct list_head*)LIST_POISON2; | |
| 125 | + __list_del_entry(entry); | |
| 126 | + entry->next = LIST_POISON1; | |
| 127 | + entry->prev = LIST_POISON2; | |
| 128 | +} | |
| 129 | + | |
| 130 | +/** | |
| 131 | + * list_is_head - tests whether @list is the list @head | |
| 132 | + * @list: the entry to test | |
| 133 | + * @head: the head of the list | |
| 134 | + */ | |
| 135 | +static inline int list_is_head(const struct list_head *list, const struct list_head *head) | |
| 136 | +{ | |
| 137 | + return list == head; | |
| 138 | +} | |
| 139 | + | |
| 140 | +/** | |
| 141 | + * list_empty - tests whether a list is empty | |
| 142 | + * @head: the list to test. | |
| 143 | + */ | |
| 144 | +static inline int list_empty(const struct list_head *head) | |
| 145 | +{ | |
| 146 | + return head->next == head; | |
| 147 | +} | |
| 148 | + | |
| 149 | +/** | |
| 150 | + * list_entry - get the struct for this entry | |
| 151 | + * @ptr: the &struct list_head pointer. | |
| 152 | + * @type: the type of the struct this is embedded in. | |
| 153 | + * @member: the name of the list_head within the struct. | |
| 154 | + */ | |
| 155 | +#define list_entry(ptr, type, member) \ | |
| 156 | + container_of(ptr, type, member) | |
| 157 | + | |
| 158 | +/** | |
| 159 | + * list_first_entry - get the first element from a list | |
| 160 | + * @ptr: the list head to take the element from. | |
| 161 | + * @type: the type of the struct this is embedded in. | |
| 162 | + * @member: the name of the list_head within the struct. | |
| 163 | + * | |
| 164 | + * Note, that list is expected to be not empty. | |
| 165 | + */ | |
| 166 | +#define list_first_entry(ptr, type, member) \ | |
| 167 | + list_entry((ptr)->next, type, member) | |
| 168 | + | |
| 169 | +/** | |
| 170 | + * list_next_entry - get the next element in list | |
| 171 | + * @pos: the type * to cursor | |
| 172 | + * @member: the name of the list_head within the struct. | |
| 173 | + */ | |
| 174 | +#define list_next_entry(pos, member) \ | |
| 175 | + list_entry((pos)->member.next, typeof(*(pos)), member) | |
| 176 | + | |
| 177 | +/** | |
| 178 | + * list_entry_is_head - test if the entry points to the head of the list | |
| 179 | + * @pos: the type * to cursor | |
| 180 | + * @head: the head for your list. | |
| 181 | + * @member: the name of the list_head within the struct. | |
| 182 | + */ | |
| 183 | +#define list_entry_is_head(pos, head, member) \ | |
| 184 | + (&pos->member == (head)) | |
| 185 | + | |
| 186 | +/** | |
| 187 | + * list_for_each_entry - iterate over list of given type | |
| 188 | + * @pos: the type * to use as a loop cursor. | |
| 189 | + * @head: the head for your list. | |
| 190 | + * @member: the name of the list_head within the struct. | |
| 191 | + */ | |
| 192 | +#define list_for_each_entry(pos, head, member) \ | |
| 193 | + for (pos = list_first_entry(head, typeof(*pos), member); \ | |
| 194 | + !list_entry_is_head(pos, head, member); \ | |
| 195 | + pos = list_next_entry(pos, member)) | |
| 196 | + | |
| 197 | +/** | |
| 198 | + * list_for_each_entry_safe - iterate over list of given type. Safe against removal of list entry | |
| 199 | + * @pos: the type * to use as a loop cursor. | |
| 200 | + * @n: another type * to use as temporary storage | |
| 201 | + * @head: the head for your list. | |
| 202 | + * @member: the name of the list_head within the struct. | |
| 203 | + */ | |
| 204 | +#define list_for_each_entry_safe(pos, n, head, member) \ | |
| 205 | + for (pos = list_first_entry(head, typeof(*pos), member), \ | |
| 206 | + n = list_next_entry(pos, member); \ | |
| 207 | + !list_entry_is_head(pos, head, member); \ | |
| 208 | + pos = n, n = list_next_entry(n, member)) | |
| 209 | + | |
| 210 | +/* | |
| 211 | + * Double linked lists with a single pointer list head. | |
| 212 | + * Mostly useful for hash tables where the two pointer list head is | |
| 213 | + * too wasteful. | |
| 214 | + * You lose the ability to access the tail in O(1). | |
| 215 | + */ | |
| 216 | + | |
| 217 | +#define HLIST_HEAD_INIT { .first = NULL } | |
| 218 | + | |
| 219 | +/** | |
| 220 | + * hlist_add_head - add a new entry at the beginning of the hlist | |
| 221 | + * @n: new entry to be added | |
| 222 | + * @h: hlist head to add it after | |
| 223 | + * | |
| 224 | + * Insert a new entry after the specified head. | |
| 225 | + * This is good for implementing stacks. | |
| 226 | + */ | |
| 227 | +static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) | |
| 228 | +{ | |
| 229 | + struct hlist_node *first = h->first; | |
| 230 | + | |
| 231 | + n->next = first; | |
| 232 | + if (first) | |
| 233 | + first->pprev = &n->next; | |
| 234 | + h->first = n; | |
| 235 | + n->pprev = &h->first; | |
| 131 | 236 | } |
| 132 | −#endif | |
| 237 | + | |
| 238 | +#define hlist_entry(ptr, type, member) container_of(ptr, type, member) | |
| 239 | + | |
| 240 | +#define hlist_entry_safe(ptr, type, member) \ | |
| 241 | + ({ typeof(ptr) ____ptr = (ptr); \ | |
| 242 | + ____ptr ? hlist_entry(____ptr, type, member) : NULL; \ | |
| 243 | + }) | |
| 244 | + | |
| 245 | +/** | |
| 246 | + * hlist_for_each_entry - iterate over list of given type | |
| 247 | + * @pos: the type * to use as a loop cursor. | |
| 248 | + * @head: the head for your list. | |
| 249 | + * @member: the name of the hlist_node within the struct. | |
| 250 | + */ | |
| 251 | +#define hlist_for_each_entry(pos, head, member) \ | |
| 252 | + for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\ | |
| 253 | + pos; \ | |
| 254 | + pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) | |
| 255 | + | |
| 256 | +#endif /* LIST_H */ | |
| @@ -0,0 +1,17 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef LIST_TYPES_H | |
| 3 | +#define LIST_TYPES_H | |
| 4 | + | |
| 5 | +struct list_head { | |
| 6 | + struct list_head *next, *prev; | |
| 7 | +}; | |
| 8 | + | |
| 9 | +struct hlist_head { | |
| 10 | + struct hlist_node *first; | |
| 11 | +}; | |
| 12 | + | |
| 13 | +struct hlist_node { | |
| 14 | + struct hlist_node *next, **pprev; | |
| 15 | +}; | |
| 16 | + | |
| 17 | +#endif /* LIST_TYPES_H */ | |
| @@ -36,10 +36,9 @@ void zconf_starthelp(void); · 35 unmodified lines | ||
| 36 | 36 | FILE *zconf_fopen(const char *name); |
| 37 | 37 | void zconf_initscan(const char *name); |
| 38 | 38 | void zconf_nextfile(const char *name); |
| 39 | −int zconf_lineno(void); | |
| 40 | −const char *zconf_curname(void); | |
| 41 | 39 | |
| 42 | 40 | /* confdata.c */ |
| 41 | +extern struct gstr autoconf_cmd; | |
| 43 | 42 | const char *conf_get_configname(void); |
| 44 | 43 | void set_all_choice_values(struct symbol *csym); |
| 45 | 44 | |
| @@ -53,7 +52,8 @@ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) · 7 unmodified lines | ||
| 53 | 52 | } |
| 54 | 53 | |
| 55 | 54 | /* util.c */ |
| 56 | −struct file *file_lookup(const char *name); | |
| 55 | +unsigned int strhash(const char *s); | |
| 56 | +const char *file_lookup(const char *name); | |
| 57 | 57 | void *xmalloc(size_t size); |
| 58 | 58 | void *xcalloc(size_t nmemb, size_t size); |
| 59 | 59 | void *xrealloc(void *p, size_t size); |
| @@ -18,8 +18,6 @@ void conf_set_message_callback(void (*fn)(const char *s)); · 17 unmodified lines | ||
| 18 | 18 | bool conf_errors(void); |
| 19 | 19 | |
| 20 | 20 | /* symbol.c */ |
| 21 | −extern struct symbol * symbol_hash[SYMBOL_HASHSIZE]; | |
| 22 | − | |
| 23 | 21 | struct symbol * sym_lookup(const char *name, int flags); |
| 24 | 22 | struct symbol * sym_find(const char *name); |
| 25 | 23 | void print_symbol_for_listconfig(struct symbol *sym); |
| @@ -40,19 +38,6 @@ const char * sym_get_string_value(struct symbol *sym); · 14 unmodified lines | ||
| 40 | 38 | |
| 41 | 39 | const char * prop_get_type_name(enum prop_type type); |
| 42 | 40 | |
| 43 | −/* preprocess.c */ | |
| 44 | −enum variable_flavor { | |
| 45 | − VAR_SIMPLE, | |
| 46 | − VAR_RECURSIVE, | |
| 47 | − VAR_APPEND, | |
| 48 | −}; | |
| 49 | −void env_write_dep(FILE *f, const char *auto_conf_name); | |
| 50 | −void variable_add(const char *name, const char *value, | |
| 51 | − enum variable_flavor flavor); | |
| 52 | −void variable_all_del(void); | |
| 53 | −char *expand_dollar(const char **str); | |
| 54 | −char *expand_one_token(const char **str); | |
| 55 | − | |
| 56 | 41 | /* expr.c */ |
| 57 | 42 | void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken); |
| 58 | 43 | |
| @@ -188,9 +188,8 @@ do_resize: · 187 unmodified lines | ||
| 188 | 188 | |
| 189 | 189 | print_buttons(dialog, height, width, 0); |
| 190 | 190 | |
| 191 | − wnoutrefresh(dialog); | |
| 192 | − wnoutrefresh(list); | |
| 193 | − doupdate(); | |
| 191 | + wmove(list, choice, check_x + 1); | |
| 192 | + wrefresh(list); | |
| 194 | 193 | |
| 195 | 194 | while (key != KEY_ESC) { |
| 196 | 195 | key = wgetch(dialog); |
| @@ -91,10 +91,6 @@ struct dialog_info { · 90 unmodified lines | ||
| 91 | 91 | struct dialog_color button_label_active; |
| 92 | 92 | struct dialog_color button_label_inactive; |
| 93 | 93 | struct dialog_color inputbox; |
| 94 | − struct dialog_color inputbox_border; | |
| 95 | − struct dialog_color searchbox; | |
| 96 | − struct dialog_color searchbox_title; | |
| 97 | − struct dialog_color searchbox_border; | |
| 98 | 94 | struct dialog_color position_indicator; |
| 99 | 95 | struct dialog_color menubox; |
| 100 | 96 | struct dialog_color menubox_border; |
| @@ -29,10 +29,6 @@ static void set_mono_theme(void) · 28 unmodified lines | ||
| 29 | 29 | dlg.button_label_active.atr = A_REVERSE; |
| 30 | 30 | dlg.button_label_inactive.atr = A_NORMAL; |
| 31 | 31 | dlg.inputbox.atr = A_NORMAL; |
| 32 | − dlg.inputbox_border.atr = A_NORMAL; | |
| 33 | − dlg.searchbox.atr = A_NORMAL; | |
| 34 | − dlg.searchbox_title.atr = A_BOLD; | |
| 35 | − dlg.searchbox_border.atr = A_NORMAL; | |
| 36 | 32 | dlg.position_indicator.atr = A_BOLD; |
| 37 | 33 | dlg.menubox.atr = A_NORMAL; |
| 38 | 34 | dlg.menubox_border.atr = A_NORMAL; |
| @@ -69,10 +65,6 @@ static void set_classic_theme(void) · 30 unmodified lines | ||
| 69 | 65 | DLG_COLOR(button_label_active, COLOR_YELLOW, COLOR_BLUE, true); |
| 70 | 66 | DLG_COLOR(button_label_inactive, COLOR_BLACK, COLOR_WHITE, true); |
| 71 | 67 | DLG_COLOR(inputbox, COLOR_BLACK, COLOR_WHITE, false); |
| 72 | − DLG_COLOR(inputbox_border, COLOR_BLACK, COLOR_WHITE, false); | |
| 73 | − DLG_COLOR(searchbox, COLOR_BLACK, COLOR_WHITE, false); | |
| 74 | − DLG_COLOR(searchbox_title, COLOR_YELLOW, COLOR_WHITE, true); | |
| 75 | − DLG_COLOR(searchbox_border, COLOR_WHITE, COLOR_WHITE, true); | |
| 76 | 68 | DLG_COLOR(position_indicator, COLOR_YELLOW, COLOR_WHITE, true); |
| 77 | 69 | DLG_COLOR(menubox, COLOR_BLACK, COLOR_WHITE, false); |
| 78 | 70 | DLG_COLOR(menubox_border, COLOR_WHITE, COLOR_WHITE, true); |
| @@ -101,14 +93,9 @@ static void set_blackbg_theme(void) · 22 unmodified lines | ||
| 101 | 93 | DLG_COLOR(button_key_active, COLOR_YELLOW, COLOR_RED, true); |
| 102 | 94 | DLG_COLOR(button_key_inactive, COLOR_RED, COLOR_BLACK, false); |
| 103 | 95 | DLG_COLOR(button_label_active, COLOR_WHITE, COLOR_RED, false); |
| 104 | − DLG_COLOR(button_label_inactive, COLOR_BLACK, COLOR_BLACK, true); | |
| 96 | + DLG_COLOR(button_label_inactive, COLOR_WHITE, COLOR_BLACK, false); | |
| 105 | 97 | |
| 106 | 98 | DLG_COLOR(inputbox, COLOR_YELLOW, COLOR_BLACK, false); |
| 107 | − DLG_COLOR(inputbox_border, COLOR_YELLOW, COLOR_BLACK, false); | |
| 108 | − | |
| 109 | − DLG_COLOR(searchbox, COLOR_YELLOW, COLOR_BLACK, false); | |
| 110 | − DLG_COLOR(searchbox_title, COLOR_YELLOW, COLOR_BLACK, true); | |
| 111 | − DLG_COLOR(searchbox_border, COLOR_BLACK, COLOR_BLACK, true); | |
| 112 | 99 | |
| 113 | 100 | DLG_COLOR(position_indicator, COLOR_RED, COLOR_BLACK, false); |
| 114 | 101 | |
| @@ -136,7 +123,6 @@ static void set_bluetitle_theme(void) · 21 unmodified lines | ||
| 136 | 123 | DLG_COLOR(title, COLOR_BLUE, COLOR_WHITE, true); |
| 137 | 124 | DLG_COLOR(button_key_active, COLOR_YELLOW, COLOR_BLUE, true); |
| 138 | 125 | DLG_COLOR(button_label_active, COLOR_WHITE, COLOR_BLUE, true); |
| 139 | − DLG_COLOR(searchbox_title, COLOR_BLUE, COLOR_WHITE, true); | |
| 140 | 126 | DLG_COLOR(position_indicator, COLOR_BLUE, COLOR_WHITE, true); |
| 141 | 127 | DLG_COLOR(tag, COLOR_BLUE, COLOR_WHITE, true); |
| 142 | 128 | DLG_COLOR(tag_key, COLOR_BLUE, COLOR_WHITE, true); |
| @@ -189,10 +175,6 @@ static void init_dialog_colors(void) · 46 unmodified lines | ||
| 189 | 175 | init_one_color(&dlg.button_label_active); |
| 190 | 176 | init_one_color(&dlg.button_label_inactive); |
| 191 | 177 | init_one_color(&dlg.inputbox); |
| 192 | − init_one_color(&dlg.inputbox_border); | |
| 193 | − init_one_color(&dlg.searchbox); | |
| 194 | − init_one_color(&dlg.searchbox_title); | |
| 195 | − init_one_color(&dlg.searchbox_border); | |
| 196 | 178 | init_one_color(&dlg.position_indicator); |
| 197 | 179 | init_one_color(&dlg.menubox); |
| 198 | 180 | init_one_color(&dlg.menubox_border); |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | #include <signal.h> |
| 20 | 20 | #include <unistd.h> |
| 21 | 21 | |
| 22 | +#include "list.h" | |
| 22 | 23 | #include "lkc.h" |
| 23 | 24 | #include "lxdialog/dialog.h" |
| 24 | 25 | #include "mnconf-common.h" |
| @@ -10,20 +10,18 @@ · 9 unmodified lines | ||
| 10 | 10 | |
| 11 | 11 | #include "lkc.h" |
| 12 | 12 | #include "internal.h" |
| 13 | +#include "list.h" | |
| 13 | 14 | |
| 14 | 15 | static const char nohelp_text[] = "There is no help available for this option."; |
| 15 | 16 | |
| 16 | 17 | struct menu rootmenu; |
| 17 | 18 | static struct menu **last_entry_ptr; |
| 18 | 19 | |
| 19 | −struct file *file_list; | |
| 20 | −struct file *current_file; | |
| 21 | − | |
| 22 | 20 | void menu_warn(struct menu *menu, const char *fmt, ...) |
| 23 | 21 | { |
| 24 | 22 | va_list ap; |
| 25 | 23 | va_start(ap, fmt); |
| 26 | − fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno); | |
| 24 | + fprintf(stderr, "%s:%d:warning: ", menu->filename, menu->lineno); | |
| 27 | 25 | vfprintf(stderr, fmt, ap); |
| 28 | 26 | fprintf(stderr, "\n"); |
| 29 | 27 | va_end(ap); |
| @@ -33,7 +31,7 @@ static void prop_warn(struct property *prop, const char *fmt, ...) · 3 unmodified lines | ||
| 33 | 31 | { |
| 34 | 32 | va_list ap; |
| 35 | 33 | va_start(ap, fmt); |
| 36 | − fprintf(stderr, "%s:%d:warning: ", prop->file->name, prop->lineno); | |
| 34 | + fprintf(stderr, "%s:%d:warning: ", prop->filename, prop->lineno); | |
| 37 | 35 | vfprintf(stderr, fmt, ap); |
| 38 | 36 | fprintf(stderr, "\n"); |
| 39 | 37 | va_end(ap); |
| @@ -53,14 +51,16 @@ void menu_add_entry(struct symbol *sym) · 13 unmodified lines | ||
| 53 | 51 | memset(menu, 0, sizeof(*menu)); |
| 54 | 52 | menu->sym = sym; |
| 55 | 53 | menu->parent = current_menu; |
| 56 | − menu->file = current_file; | |
| 57 | − menu->lineno = zconf_lineno(); | |
| 54 | + menu->filename = cur_filename; | |
| 55 | + menu->lineno = cur_lineno; | |
| 58 | 56 | |
| 59 | 57 | *last_entry_ptr = menu; |
| 60 | 58 | last_entry_ptr = &menu->next; |
| 61 | 59 | current_entry = menu; |
| 62 | − if (sym) | |
| 60 | + if (sym) { | |
| 63 | 61 | menu_add_symbol(P_SYMBOL, sym, NULL); |
| 62 | + list_add_tail(&menu->link, &sym->menus); | |
| 63 | + } | |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | struct menu *menu_add_menu(void) |
| @@ -134,8 +134,8 @@ static struct property *menu_add_prop(enum prop_type type, struct expr *expr, · 67 unmodified lines | ||
| 134 | 134 | prop = xmalloc(sizeof(*prop)); |
| 135 | 135 | memset(prop, 0, sizeof(*prop)); |
| 136 | 136 | prop->type = type; |
| 137 | − prop->file = current_file; | |
| 138 | − prop->lineno = zconf_lineno(); | |
| 137 | + prop->filename = cur_filename; | |
| 138 | + prop->lineno = cur_lineno; | |
| 139 | 139 | prop->menu = current_entry; |
| 140 | 140 | prop->expr = expr; |
| 141 | 141 | prop->visible.expr = dep; |
| @@ -307,12 +307,6 @@ void menu_finalize(struct menu *parent) · 165 unmodified lines | ||
| 307 | 307 | } |
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | − /* set the type of the remaining choice values */ | |
| 311 | − for (menu = parent->list; menu; menu = menu->next) { | |
| 312 | − current_entry = menu; | |
| 313 | − if (menu->sym && menu->sym->type == S_UNKNOWN) | |
| 314 | − menu_set_type(sym->type); | |
| 315 | − } | |
| 316 | 310 | |
| 317 | 311 | /* |
| 318 | 312 | * Use the choice itself as the parent dependency of |
| @@ -567,9 +561,6 @@ void menu_finalize(struct menu *parent) · 248 unmodified lines | ||
| 567 | 561 | if (sym->type == S_UNKNOWN) |
| 568 | 562 | menu_warn(parent, "config symbol defined without type"); |
| 569 | 563 | |
| 570 | − if (sym_is_choice(sym) && !parent->prompt) | |
| 571 | − menu_warn(parent, "choice must have a prompt"); | |
| 572 | − | |
| 573 | 564 | /* Check properties connected to this symbol */ |
| 574 | 565 | sym_check_prop(sym); |
| 575 | 566 | sym->flags |= SYMBOL_WARNED; |
| @@ -676,7 +667,7 @@ struct menu *menu_get_parent_menu(struct menu *menu) · 100 unmodified lines | ||
| 676 | 667 | static void get_def_str(struct gstr *r, struct menu *menu) |
| 677 | 668 | { |
| 678 | 669 | str_printf(r, "Defined at %s:%d\n", |
| 679 | − menu->file->name, menu->lineno); | |
| 670 | + menu->filename, menu->lineno); | |
| 680 | 671 | } |
| 681 | 672 | |
| 682 | 673 | static void get_dep_str(struct gstr *r, struct expr *expr, const char *prefix) |
| @@ -777,6 +768,7 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym, · 94 unmodified lines | ||
| 777 | 768 | struct list_head *head) |
| 778 | 769 | { |
| 779 | 770 | struct property *prop; |
| 771 | + struct menu *menu; | |
| 780 | 772 | |
| 781 | 773 | if (sym && sym->name) { |
| 782 | 774 | str_printf(r, "Symbol: %s [=%s]\n", sym->name, |
| @@ -793,17 +785,17 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym, · 10 unmodified lines | ||
| 793 | 785 | } |
| 794 | 786 | |
| 795 | 787 | /* Print the definitions with prompts before the ones without */ |
| 796 | − for_all_properties(sym, prop, P_SYMBOL) { | |
| 797 | − if (prop->menu->prompt) { | |
| 798 | − get_def_str(r, prop->menu); | |
| 799 | − get_prompt_str(r, prop->menu->prompt, head); | |
| 788 | + list_for_each_entry(menu, &sym->menus, link) { | |
| 789 | + if (menu->prompt) { | |
| 790 | + get_def_str(r, menu); | |
| 791 | + get_prompt_str(r, menu->prompt, head); | |
| 800 | 792 | } |
| 801 | 793 | } |
| 802 | 794 | |
| 803 | − for_all_properties(sym, prop, P_SYMBOL) { | |
| 804 | − if (!prop->menu->prompt) { | |
| 805 | − get_def_str(r, prop->menu); | |
| 806 | − get_dep_str(r, prop->menu->dep, " Depends on: "); | |
| 795 | + list_for_each_entry(menu, &sym->menus, link) { | |
| 796 | + if (!menu->prompt) { | |
| 797 | + get_def_str(r, menu); | |
| 798 | + get_dep_str(r, menu->dep, " Depends on: "); | |
| 807 | 799 | } |
| 808 | 800 | } |
| 809 | 801 | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <strings.h> |
| 12 | 12 | #include <stdlib.h> |
| 13 | 13 | |
| 14 | +#include "list.h" | |
| 14 | 15 | #include "lkc.h" |
| 15 | 16 | #include "mnconf-common.h" |
| 16 | 17 | #include "nconf.h" |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | #include "lkc.h" |
| 15 | 15 | #include "internal.h" |
| 16 | +#include "preprocess.h" | |
| 16 | 17 | |
| 17 | 18 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) |
| 18 | 19 | |
| @@ -27,8 +28,6 @@ static void zconf_error(const char *err, ...); · 8 unmodified lines | ||
| 27 | 28 | static bool zconf_endtoken(const char *tokenname, |
| 28 | 29 | const char *expected_tokenname); |
| 29 | 30 | |
| 30 | −struct symbol *symbol_hash[SYMBOL_HASHSIZE]; | |
| 31 | − | |
| 32 | 31 | struct menu *current_menu, *current_entry; |
| 33 | 32 | |
| 34 | 33 | %} |
| @@ -95,12 +94,12 @@ struct menu *current_menu, *current_entry; · 60 unmodified lines | ||
| 95 | 94 | %type <expr> if_expr |
| 96 | 95 | %type <string> end |
| 97 | 96 | %type <menu> if_entry menu_entry choice_entry |
| 98 | −%type <string> word_opt assign_val | |
| 97 | +%type <string> assign_val | |
| 99 | 98 | %type <flavor> assign_op |
| 100 | 99 | |
| 101 | 100 | %destructor { |
| 102 | 101 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
| 103 | − $$->file->name, $$->lineno); | |
| 102 | + $$->filename, $$->lineno); | |
| 104 | 103 | if (current_menu == $$) |
| 105 | 104 | menu_end_menu(); |
| 106 | 105 | } if_entry menu_entry choice_entry |
| @@ -143,19 +142,19 @@ config_entry_start: T_CONFIG nonconst_symbol T_EOL · 36 unmodified lines | ||
| 143 | 142 | { |
| 144 | 143 | $2->flags |= SYMBOL_OPTIONAL; |
| 145 | 144 | menu_add_entry($2); |
| 146 | − printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2->name); | |
| 145 | + printd(DEBUG_PARSE, "%s:%d:config %s\n", cur_filename, cur_lineno, $2->name); | |
| 147 | 146 | }; |
| 148 | 147 | |
| 149 | 148 | config_stmt: config_entry_start config_option_list |
| 150 | 149 | { |
| 151 | − printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); | |
| 150 | + printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno); | |
| 152 | 151 | }; |
| 153 | 152 | |
| 154 | 153 | menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL |
| 155 | 154 | { |
| 156 | 155 | $2->flags |= SYMBOL_OPTIONAL; |
| 157 | 156 | menu_add_entry($2); |
| 158 | − printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2->name); | |
| 157 | + printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", cur_filename, cur_lineno, $2->name); | |
| 159 | 158 | }; |
| 160 | 159 | |
| 161 | 160 | menuconfig_stmt: menuconfig_entry_start config_option_list |
| @@ -164,7 +163,7 @@ menuconfig_stmt: menuconfig_entry_start config_option_list · 2 unmodified lines | ||
| 164 | 163 | current_entry->prompt->type = P_MENU; |
| 165 | 164 | else |
| 166 | 165 | zconfprint("warning: menuconfig statement without prompt"); |
| 167 | − printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); | |
| 166 | + printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno); | |
| 168 | 167 | }; |
| 169 | 168 | |
| 170 | 169 | config_option_list: |
| @@ -177,15 +176,13 @@ config_option_list: · 6 unmodified lines | ||
| 177 | 176 | config_option: type prompt_stmt_opt T_EOL |
| 178 | 177 | { |
| 179 | 178 | menu_set_type($1); |
| 180 | − printd(DEBUG_PARSE, "%s:%d:type(%u)\n", | |
| 181 | − zconf_curname(), zconf_lineno(), | |
| 182 | − $1); | |
| 179 | + printd(DEBUG_PARSE, "%s:%d:type(%u)\n", cur_filename, cur_lineno, $1); | |
| 183 | 180 | }; |
| 184 | 181 | |
| 185 | 182 | config_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL |
| 186 | 183 | { |
| 187 | 184 | menu_add_prompt(P_PROMPT, $2, $3); |
| 188 | − printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | |
| 185 | + printd(DEBUG_PARSE, "%s:%d:prompt\n", cur_filename, cur_lineno); | |
| 189 | 186 | }; |
| 190 | 187 | |
| 191 | 188 | config_option: default expr if_expr T_EOL |
| @@ -193,27 +190,26 @@ config_option: default expr if_expr T_EOL · 1 unmodified line | ||
| 193 | 190 | menu_add_expr(P_DEFAULT, $2, $3); |
| 194 | 191 | if ($1 != S_UNKNOWN) |
| 195 | 192 | menu_set_type($1); |
| 196 | − printd(DEBUG_PARSE, "%s:%d:default(%u)\n", | |
| 197 | − zconf_curname(), zconf_lineno(), | |
| 193 | + printd(DEBUG_PARSE, "%s:%d:default(%u)\n", cur_filename, cur_lineno, | |
| 198 | 194 | $1); |
| 199 | 195 | }; |
| 200 | 196 | |
| 201 | 197 | config_option: T_SELECT nonconst_symbol if_expr T_EOL |
| 202 | 198 | { |
| 203 | 199 | menu_add_symbol(P_SELECT, $2, $3); |
| 204 | − printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno()); | |
| 200 | + printd(DEBUG_PARSE, "%s:%d:select\n", cur_filename, cur_lineno); | |
| 205 | 201 | }; |
| 206 | 202 | |
| 207 | 203 | config_option: T_IMPLY nonconst_symbol if_expr T_EOL |
| 208 | 204 | { |
| 209 | 205 | menu_add_symbol(P_IMPLY, $2, $3); |
| 210 | − printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno()); | |
| 206 | + printd(DEBUG_PARSE, "%s:%d:imply\n", cur_filename, cur_lineno); | |
| 211 | 207 | }; |
| 212 | 208 | |
| 213 | 209 | config_option: T_RANGE symbol symbol if_expr T_EOL |
| 214 | 210 | { |
| 215 | 211 | menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4); |
| 216 | − printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); | |
| 212 | + printd(DEBUG_PARSE, "%s:%d:range\n", cur_filename, cur_lineno); | |
| 217 | 213 | }; |
| 218 | 214 | |
| 219 | 215 | config_option: T_MODULES T_EOL |
| @@ -226,18 +222,23 @@ config_option: T_MODULES T_EOL · 6 unmodified lines | ||
| 226 | 222 | |
| 227 | 223 | /* choice entry */ |
| 228 | 224 | |
| 229 | −choice: T_CHOICE word_opt T_EOL | |
| 225 | +choice: T_CHOICE T_EOL | |
| 230 | 226 | { |
| 231 | − struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE); | |
| 227 | + struct symbol *sym = sym_lookup(NULL, SYMBOL_CHOICE); | |
| 232 | 228 | sym->flags |= SYMBOL_NO_WRITE; |
| 233 | 229 | menu_add_entry(sym); |
| 234 | 230 | menu_add_expr(P_CHOICE, NULL, NULL); |
| 235 | − free($2); | |
| 236 | − printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); | |
| 231 | + printd(DEBUG_PARSE, "%s:%d:choice\n", cur_filename, cur_lineno); | |
| 237 | 232 | }; |
| 238 | 233 | |
| 239 | 234 | choice_entry: choice choice_option_list |
| 240 | 235 | { |
| 236 | + if (!current_entry->prompt) { | |
| 237 | + fprintf(stderr, "%s:%d: error: choice must have a prompt\n", | |
| 238 | + current_entry->filename, current_entry->lineno); | |
| 239 | + yynerrs++; | |
| 240 | + } | |
| 241 | + | |
| 241 | 242 | $$ = menu_add_menu(); |
| 242 | 243 | }; |
| 243 | 244 | |
| @@ -245,7 +246,7 @@ choice_end: end · 1 unmodified line | ||
| 245 | 246 | { |
| 246 | 247 | if (zconf_endtoken($1, "choice")) { |
| 247 | 248 | menu_end_menu(); |
| 248 | − printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); | |
| 249 | + printd(DEBUG_PARSE, "%s:%d:endchoice\n", cur_filename, cur_lineno); | |
| 249 | 250 | } |
| 250 | 251 | }; |
| 251 | 252 | |
| @@ -262,27 +263,25 @@ choice_option_list: · 10 unmodified lines | ||
| 262 | 263 | choice_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL |
| 263 | 264 | { |
| 264 | 265 | menu_add_prompt(P_PROMPT, $2, $3); |
| 265 | − printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | |
| 266 | + printd(DEBUG_PARSE, "%s:%d:prompt\n", cur_filename, cur_lineno); | |
| 266 | 267 | }; |
| 267 | 268 | |
| 268 | 269 | choice_option: logic_type prompt_stmt_opt T_EOL |
| 269 | 270 | { |
| 270 | 271 | menu_set_type($1); |
| 271 | − printd(DEBUG_PARSE, "%s:%d:type(%u)\n", | |
| 272 | − zconf_curname(), zconf_lineno(), $1); | |
| 272 | + printd(DEBUG_PARSE, "%s:%d:type(%u)\n", cur_filename, cur_lineno, $1); | |
| 273 | 273 | }; |
| 274 | 274 | |
| 275 | 275 | choice_option: T_OPTIONAL T_EOL |
| 276 | 276 | { |
| 277 | 277 | current_entry->sym->flags |= SYMBOL_OPTIONAL; |
| 278 | − printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); | |
| 278 | + printd(DEBUG_PARSE, "%s:%d:optional\n", cur_filename, cur_lineno); | |
| 279 | 279 | }; |
| 280 | 280 | |
| 281 | 281 | choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL |
| 282 | 282 | { |
| 283 | 283 | menu_add_symbol(P_DEFAULT, $2, $3); |
| 284 | − printd(DEBUG_PARSE, "%s:%d:default\n", | |
| 285 | − zconf_curname(), zconf_lineno()); | |
| 284 | + printd(DEBUG_PARSE, "%s:%d:default\n", cur_filename, cur_lineno); | |
| 286 | 285 | }; |
| 287 | 286 | |
| 288 | 287 | type: |
| @@ -304,7 +303,7 @@ default: · 15 unmodified lines | ||
| 304 | 303 | |
| 305 | 304 | if_entry: T_IF expr T_EOL |
| 306 | 305 | { |
| 307 | − printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); | |
| 306 | + printd(DEBUG_PARSE, "%s:%d:if\n", cur_filename, cur_lineno); | |
| 308 | 307 | menu_add_entry(NULL); |
| 309 | 308 | menu_add_dep($2); |
| 310 | 309 | $$ = menu_add_menu(); |
| @@ -314,7 +313,7 @@ if_end: end · 3 unmodified lines | ||
| 314 | 313 | { |
| 315 | 314 | if (zconf_endtoken($1, "if")) { |
| 316 | 315 | menu_end_menu(); |
| 317 | − printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); | |
| 316 | + printd(DEBUG_PARSE, "%s:%d:endif\n", cur_filename, cur_lineno); | |
| 318 | 317 | } |
| 319 | 318 | }; |
| 320 | 319 | |
| @@ -330,7 +329,7 @@ menu: T_MENU T_WORD_QUOTE T_EOL · 9 unmodified lines | ||
| 330 | 329 | { |
| 331 | 330 | menu_add_entry(NULL); |
| 332 | 331 | menu_add_prompt(P_MENU, $2, NULL); |
| 333 | − printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); | |
| 332 | + printd(DEBUG_PARSE, "%s:%d:menu\n", cur_filename, cur_lineno); | |
| 334 | 333 | }; |
| 335 | 334 | |
| 336 | 335 | menu_entry: menu menu_option_list |
| @@ -342,7 +341,7 @@ menu_end: end · 5 unmodified lines | ||
| 342 | 341 | { |
| 343 | 342 | if (zconf_endtoken($1, "menu")) { |
| 344 | 343 | menu_end_menu(); |
| 345 | − printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); | |
| 344 | + printd(DEBUG_PARSE, "%s:%d:endmenu\n", cur_filename, cur_lineno); | |
| 346 | 345 | } |
| 347 | 346 | }; |
| 348 | 347 | |
| @@ -357,7 +356,7 @@ menu_option_list: · 8 unmodified lines | ||
| 357 | 356 | |
| 358 | 357 | source_stmt: T_SOURCE T_WORD_QUOTE T_EOL |
| 359 | 358 | { |
| 360 | − printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2); | |
| 359 | + printd(DEBUG_PARSE, "%s:%d:source %s\n", cur_filename, cur_lineno, $2); | |
| 361 | 360 | zconf_nextfile($2); |
| 362 | 361 | free($2); |
| 363 | 362 | }; |
| @@ -368,7 +367,7 @@ comment: T_COMMENT T_WORD_QUOTE T_EOL · 4 unmodified lines | ||
| 368 | 367 | { |
| 369 | 368 | menu_add_entry(NULL); |
| 370 | 369 | menu_add_prompt(P_COMMENT, $2, NULL); |
| 371 | − printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); | |
| 370 | + printd(DEBUG_PARSE, "%s:%d:comment\n", cur_filename, cur_lineno); | |
| 372 | 371 | }; |
| 373 | 372 | |
| 374 | 373 | comment_stmt: comment comment_option_list |
| @@ -383,7 +382,7 @@ comment_option_list: · 8 unmodified lines | ||
| 383 | 382 | |
| 384 | 383 | help_start: T_HELP T_EOL |
| 385 | 384 | { |
| 386 | − printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); | |
| 385 | + printd(DEBUG_PARSE, "%s:%d:help\n", cur_filename, cur_lineno); | |
| 387 | 386 | zconf_starthelp(); |
| 388 | 387 | }; |
| 389 | 388 | |
| @@ -408,7 +407,7 @@ help: help_start T_HELPTEXT · 18 unmodified lines | ||
| 408 | 407 | depends: T_DEPENDS T_ON expr T_EOL |
| 409 | 408 | { |
| 410 | 409 | menu_add_dep($3); |
| 411 | − printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); | |
| 410 | + printd(DEBUG_PARSE, "%s:%d:depends on\n", cur_filename, cur_lineno); | |
| 412 | 411 | }; |
| 413 | 412 | |
| 414 | 413 | /* visibility option */ |
| @@ -455,9 +454,6 @@ symbol: nonconst_symbol · 40 unmodified lines | ||
| 455 | 454 | | T_WORD_QUOTE { $$ = sym_lookup($1, SYMBOL_CONST); free($1); } |
| 456 | 455 | ; |
| 457 | 456 | |
| 458 | −word_opt: /* empty */ { $$ = NULL; } | |
| 459 | − | T_WORD | |
| 460 | − | |
| 461 | 457 | /* assignment statement */ |
| 462 | 458 | |
| 463 | 459 | assignment_stmt: T_WORD assign_op assign_val T_EOL { variable_add($1, $3, $2); free($1); free($3); } |
| @@ -477,8 +473,11 @@ assign_val: · 13 unmodified lines | ||
| 477 | 473 | |
| 478 | 474 | void conf_parse(const char *name) |
| 479 | 475 | { |
| 480 | − struct symbol *sym; | |
| 481 | − int i; | |
| 476 | + struct menu *menu; | |
| 477 | + | |
| 478 | + autoconf_cmd = str_new(); | |
| 479 | + | |
| 480 | + str_printf(&autoconf_cmd, "\ndeps_config := \\\n"); | |
| 482 | 481 | |
| 483 | 482 | zconf_initscan(name); |
| 484 | 483 | |
| @@ -488,13 +487,28 @@ void conf_parse(const char *name) · 3 unmodified lines | ||
| 488 | 487 | yydebug = 1; |
| 489 | 488 | yyparse(); |
| 490 | 489 | |
| 490 | + /* | |
| 491 | + * FIXME: | |
| 492 | + * cur_filename and cur_lineno are used even after yyparse(); | |
| 493 | + * menu_finalize() calls menu_add_symbol(). This should be fixed. | |
| 494 | + */ | |
| 495 | + cur_filename = "<none>"; | |
| 496 | + cur_lineno = 0; | |
| 497 | + | |
| 498 | + str_printf(&autoconf_cmd, | |
| 499 | + "\n" | |
| 500 | + "$(autoconfig): $(deps_config)\n" | |
| 501 | + "$(deps_config): ;\n"); | |
| 502 | + | |
| 503 | + env_write_dep(&autoconf_cmd); | |
| 504 | + | |
| 491 | 505 | /* Variables are expanded in the parse phase. We can free them here. */ |
| 492 | 506 | variable_all_del(); |
| 493 | 507 | |
| 494 | 508 | if (yynerrs) |
| 495 | 509 | exit(1); |
| 496 | 510 | if (!modules_sym) |
| 497 | − modules_sym = sym_find( "n" ); | |
| 511 | + modules_sym = &symbol_no; | |
| 498 | 512 | |
| 499 | 513 | if (!menu_has_prompt(&rootmenu)) { |
| 500 | 514 | current_entry = &rootmenu; |
| @@ -502,10 +516,23 @@ void conf_parse(const char *name) · 1 unmodified line | ||
| 502 | 516 | } |
| 503 | 517 | |
| 504 | 518 | menu_finalize(&rootmenu); |
| 505 | − for_all_symbols(i, sym) { | |
| 506 | − if (sym_check_deps(sym)) | |
| 519 | + | |
| 520 | + menu = &rootmenu; | |
| 521 | + while (menu) { | |
| 522 | + if (menu->sym && sym_check_deps(menu->sym)) | |
| 507 | 523 | yynerrs++; |
| 524 | + | |
| 525 | + if (menu->list) { | |
| 526 | + menu = menu->list; | |
| 527 | + continue; | |
| 528 | + } | |
| 529 | + | |
| 530 | + while (!menu->next && menu->parent) | |
| 531 | + menu = menu->parent; | |
| 532 | + | |
| 533 | + menu = menu->next; | |
| 508 | 534 | } |
| 535 | + | |
| 509 | 536 | if (yynerrs) |
| 510 | 537 | exit(1); |
| 511 | 538 | conf_set_changed(true); |
| @@ -520,11 +547,11 @@ static bool zconf_endtoken(const char *tokenname, · 8 unmodified lines | ||
| 520 | 547 | yynerrs++; |
| 521 | 548 | return false; |
| 522 | 549 | } |
| 523 | − if (current_menu->file != current_file) { | |
| 550 | + if (strcmp(current_menu->filename, cur_filename)) { | |
| 524 | 551 | zconf_error("'%s' in different file than '%s'", |
| 525 | 552 | tokenname, expected_tokenname); |
| 526 | 553 | fprintf(stderr, "%s:%d: location of the '%s'\n", |
| 527 | − current_menu->file->name, current_menu->lineno, | |
| 554 | + current_menu->filename, current_menu->lineno, | |
| 528 | 555 | expected_tokenname); |
| 529 | 556 | yynerrs++; |
| 530 | 557 | return false; |
| @@ -536,7 +563,7 @@ static void zconfprint(const char *err, ...) · 5 unmodified lines | ||
| 536 | 563 | { |
| 537 | 564 | va_list ap; |
| 538 | 565 | |
| 539 | − fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); | |
| 566 | + fprintf(stderr, "%s:%d: ", cur_filename, cur_lineno); | |
| 540 | 567 | va_start(ap, err); |
| 541 | 568 | vfprintf(stderr, err, ap); |
| 542 | 569 | va_end(ap); |
| @@ -548,7 +575,7 @@ static void zconf_error(const char *err, ...) · 5 unmodified lines | ||
| 548 | 575 | va_list ap; |
| 549 | 576 | |
| 550 | 577 | yynerrs++; |
| 551 | − fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); | |
| 578 | + fprintf(stderr, "%s:%d: ", cur_filename, cur_lineno); | |
| 552 | 579 | va_start(ap, err); |
| 553 | 580 | vfprintf(stderr, err, ap); |
| 554 | 581 | va_end(ap); |
| @@ -557,7 +584,7 @@ static void zconf_error(const char *err, ...) · 2 unmodified lines | ||
| 557 | 584 | |
| 558 | 585 | static void yyerror(const char *err) |
| 559 | 586 | { |
| 560 | − fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); | |
| 587 | + fprintf(stderr, "%s:%d: %s\n", cur_filename, cur_lineno, err); | |
| 561 | 588 | } |
| 562 | 589 | |
| 563 | 590 | static void print_quoted_string(FILE *out, const char *str) |
| @@ -9,10 +9,11 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <stdlib.h> |
| 10 | 10 | #include <string.h> |
| 11 | 11 | |
| 12 | +#include "array_size.h" | |
| 13 | +#include "internal.h" | |
| 12 | 14 | #include "list.h" |
| 13 | 15 | #include "lkc.h" |
| 14 | − | |
| 15 | −#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) | |
| 16 | +#include "preprocess.h" | |
| 16 | 17 | |
| 17 | 18 | static char *expand_string_with_args(const char *in, int argc, char *argv[]); |
| 18 | 19 | static char *expand_string(const char *in); |
| @@ -21,7 +22,7 @@ static void __attribute__((noreturn)) pperror(const char *format, ...) · 2 unmodified lines | ||
| 21 | 22 | { |
| 22 | 23 | va_list ap; |
| 23 | 24 | |
| 24 | − fprintf(stderr, "%s:%d: ", current_file->name, yylineno); | |
| 25 | + fprintf(stderr, "%s:%d: ", cur_filename, yylineno); | |
| 25 | 26 | va_start(ap, format); |
| 26 | 27 | vfprintf(stderr, format, ap); |
| 27 | 28 | va_end(ap); |
| @@ -87,14 +88,17 @@ static char *env_expand(const char *name) · 59 unmodified lines | ||
| 87 | 88 | return xstrdup(value); |
| 88 | 89 | } |
| 89 | 90 | |
| 90 | −void env_write_dep(FILE *f, const char *autoconfig_name) | |
| 91 | +void env_write_dep(struct gstr *s) | |
| 91 | 92 | { |
| 92 | 93 | struct env *e, *tmp; |
| 93 | 94 | |
| 94 | 95 | list_for_each_entry_safe(e, tmp, &env_list, node) { |
| 95 | − fprintf(f, "ifneq \"$(%s)\" \"%s\"\n", e->name, e->value); | |
| 96 | − fprintf(f, "%s: FORCE\n", autoconfig_name); | |
| 97 | − fprintf(f, "endif\n"); | |
| 96 | + str_printf(s, | |
| 97 | + "\n" | |
| 98 | + "ifneq \"$(%s)\" \"%s\"\n" | |
| 99 | + "$(autoconfig): FORCE\n" | |
| 100 | + "endif\n", | |
| 101 | + e->name, e->value); | |
| 98 | 102 | env_del(e); |
| 99 | 103 | } |
| 100 | 104 | } |
| @@ -119,7 +123,7 @@ static char *do_error_if(int argc, char *argv[]) · 18 unmodified lines | ||
| 119 | 123 | |
| 120 | 124 | static char *do_filename(int argc, char *argv[]) |
| 121 | 125 | { |
| 122 | − return xstrdup(current_file->name); | |
| 126 | + return xstrdup(cur_filename); | |
| 123 | 127 | } |
| 124 | 128 | |
| 125 | 129 | static char *do_info(int argc, char *argv[]) |
| @@ -181,8 +185,7 @@ static char *do_shell(int argc, char *argv[]) · 55 unmodified lines | ||
| 181 | 185 | static char *do_warning_if(int argc, char *argv[]) |
| 182 | 186 | { |
| 183 | 187 | if (!strcmp(argv[0], "y")) |
| 184 | − fprintf(stderr, "%s:%d: %s\n", | |
| 185 | − current_file->name, yylineno, argv[1]); | |
| 188 | + fprintf(stderr, "%s:%d: %s\n", cur_filename, yylineno, argv[1]); | |
| 186 | 189 | |
| 187 | 190 | return xstrdup(""); |
| 188 | 191 | } |
| @@ -0,0 +1,19 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | +#ifndef PREPROCESS_H | |
| 3 | +#define PREPROCESS_H | |
| 4 | + | |
| 5 | +enum variable_flavor { | |
| 6 | + VAR_SIMPLE, | |
| 7 | + VAR_RECURSIVE, | |
| 8 | + VAR_APPEND, | |
| 9 | +}; | |
| 10 | + | |
| 11 | +struct gstr; | |
| 12 | +void env_write_dep(struct gstr *gs); | |
| 13 | +void variable_add(const char *name, const char *value, | |
| 14 | + enum variable_flavor flavor); | |
| 15 | +void variable_all_del(void); | |
| 16 | +char *expand_dollar(const char **str); | |
| 17 | +char *expand_one_token(const char **str); | |
| 18 | + | |
| 19 | +#endif /* PREPROCESS_H */ | |
| @@ -1058,7 +1058,7 @@ void ConfigInfoView::menuInfo(void) · 1057 unmodified lines | ||
| 1058 | 1058 | stream << "<br><br>"; |
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | − stream << "defined at " << _menu->file->name << ":" | |
| 1061 | + stream << "defined at " << _menu->filename << ":" | |
| 1062 | 1062 | << _menu->lineno << "<br><br>"; |
| 1063 | 1063 | } |
| 1064 | 1064 | } |
| @@ -9,23 +9,27 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <string.h> |
| 10 | 10 | #include <regex.h> |
| 11 | 11 | |
| 12 | +#include "internal.h" | |
| 12 | 13 | #include "lkc.h" |
| 13 | 14 | |
| 14 | 15 | struct symbol symbol_yes = { |
| 15 | 16 | .name = "y", |
| 16 | 17 | .curr = { "y", yes }, |
| 18 | + .menus = LIST_HEAD_INIT(symbol_yes.menus), | |
| 17 | 19 | .flags = SYMBOL_CONST|SYMBOL_VALID, |
| 18 | 20 | }; |
| 19 | 21 | |
| 20 | 22 | struct symbol symbol_mod = { |
| 21 | 23 | .name = "m", |
| 22 | 24 | .curr = { "m", mod }, |
| 25 | + .menus = LIST_HEAD_INIT(symbol_mod.menus), | |
| 23 | 26 | .flags = SYMBOL_CONST|SYMBOL_VALID, |
| 24 | 27 | }; |
| 25 | 28 | |
| 26 | 29 | struct symbol symbol_no = { |
| 27 | 30 | .name = "n", |
| 28 | 31 | .curr = { "n", no }, |
| 32 | + .menus = LIST_HEAD_INIT(symbol_no.menus), | |
| 29 | 33 | .flags = SYMBOL_CONST|SYMBOL_VALID, |
| 30 | 34 | }; |
| 31 | 35 | |
| @@ -160,9 +164,8 @@ static void sym_set_changed(struct symbol *sym) · 128 unmodified lines | ||
| 160 | 164 | static void sym_set_all_changed(void) |
| 161 | 165 | { |
| 162 | 166 | struct symbol *sym; |
| 163 | − int i; | |
| 164 | 167 | |
| 165 | − for_all_symbols(i, sym) | |
| 168 | + for_all_symbols(sym) | |
| 166 | 169 | sym_set_changed(sym); |
| 167 | 170 | } |
| 168 | 171 | |
| @@ -475,9 +478,8 @@ void sym_calc_value(struct symbol *sym) · 306 unmodified lines | ||
| 475 | 478 | void sym_clear_all_valid(void) |
| 476 | 479 | { |
| 477 | 480 | struct symbol *sym; |
| 478 | − int i; | |
| 479 | 481 | |
| 480 | − for_all_symbols(i, sym) | |
| 482 | + for_all_symbols(sym) | |
| 481 | 483 | sym->flags &= ~SYMBOL_VALID; |
| 482 | 484 | conf_set_changed(true); |
| 483 | 485 | sym_calc_value(modules_sym); |
| @@ -803,14 +805,7 @@ bool sym_is_changeable(struct symbol *sym) · 319 unmodified lines | ||
| 803 | 805 | return sym->visible > sym->rev_dep.tri; |
| 804 | 806 | } |
| 805 | 807 | |
| 806 | −static unsigned strhash(const char *s) | |
| 807 | −{ | |
| 808 | − /* fnv32 hash */ | |
| 809 | − unsigned hash = 2166136261U; | |
| 810 | − for (; *s; s++) | |
| 811 | − hash = (hash ^ *s) * 0x01000193; | |
| 812 | − return hash; | |
| 813 | −} | |
| 808 | +HASHTABLE_DEFINE(sym_hashtable, SYMBOL_HASHSIZE); | |
| 814 | 809 | |
| 815 | 810 | struct symbol *sym_lookup(const char *name, int flags) |
| 816 | 811 | { |
| @@ -826,9 +821,9 @@ struct symbol *sym_lookup(const char *name, int flags) · 9 unmodified lines | ||
| 826 | 821 | case 'n': return &symbol_no; |
| 827 | 822 | } |
| 828 | 823 | } |
| 829 | − hash = strhash(name) % SYMBOL_HASHSIZE; | |
| 824 | + hash = strhash(name); | |
| 830 | 825 | |
| 831 | − for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) { | |
| 826 | + hash_for_each_possible(sym_hashtable, symbol, node, hash) { | |
| 832 | 827 | if (symbol->name && |
| 833 | 828 | !strcmp(symbol->name, name) && |
| 834 | 829 | (flags ? symbol->flags & flags |
| @@ -846,9 +841,9 @@ struct symbol *sym_lookup(const char *name, int flags) · 11 unmodified lines | ||
| 846 | 841 | symbol->name = new_name; |
| 847 | 842 | symbol->type = S_UNKNOWN; |
| 848 | 843 | symbol->flags = flags; |
| 844 | + INIT_LIST_HEAD(&symbol->menus); | |
| 849 | 845 | |
| 850 | − symbol->next = symbol_hash[hash]; | |
| 851 | − symbol_hash[hash] = symbol; | |
| 846 | + hash_add(sym_hashtable, &symbol->node, hash); | |
| 852 | 847 | |
| 853 | 848 | return symbol; |
| 854 | 849 | } |
| @@ -868,9 +863,9 @@ struct symbol *sym_find(const char *name) · 13 unmodified lines | ||
| 868 | 863 | case 'n': return &symbol_no; |
| 869 | 864 | } |
| 870 | 865 | } |
| 871 | − hash = strhash(name) % SYMBOL_HASHSIZE; | |
| 866 | + hash = strhash(name); | |
| 872 | 867 | |
| 873 | − for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) { | |
| 868 | + hash_for_each_possible(sym_hashtable, symbol, node, hash) { | |
| 874 | 869 | if (symbol->name && |
| 875 | 870 | !strcmp(symbol->name, name) && |
| 876 | 871 | !(symbol->flags & SYMBOL_CONST)) |
| @@ -930,7 +925,7 @@ struct symbol **sym_re_search(const char *pattern) · 53 unmodified lines | ||
| 930 | 925 | if (regcomp(&re, pattern, REG_EXTENDED|REG_ICASE)) |
| 931 | 926 | return NULL; |
| 932 | 927 | |
| 933 | − for_all_symbols(i, sym) { | |
| 928 | + for_all_symbols(sym) { | |
| 934 | 929 | if (sym->flags & SYMBOL_CONST || !sym->name) |
| 935 | 930 | continue; |
| 936 | 931 | if (regexec(&re, sym->name, 1, match, 0)) |
| @@ -1041,42 +1036,42 @@ static void sym_check_print_recursive(struct symbol *last_sym) · 104 unmodified lines | ||
| 1041 | 1036 | } |
| 1042 | 1037 | if (stack->sym == last_sym) |
| 1043 | 1038 | fprintf(stderr, "%s:%d:error: recursive dependency detected!\n", |
| 1044 | − prop->file->name, prop->lineno); | |
| 1039 | + prop->filename, prop->lineno); | |
| 1045 | 1040 | |
| 1046 | 1041 | if (sym_is_choice(sym)) { |
| 1047 | 1042 | fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n", |
| 1048 | − menu->file->name, menu->lineno, | |
| 1043 | + menu->filename, menu->lineno, | |
| 1049 | 1044 | sym->name ? sym->name : "<choice>", |
| 1050 | 1045 | next_sym->name ? next_sym->name : "<choice>"); |
| 1051 | 1046 | } else if (sym_is_choice_value(sym)) { |
| 1052 | 1047 | fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n", |
| 1053 | − menu->file->name, menu->lineno, | |
| 1048 | + menu->filename, menu->lineno, | |
| 1054 | 1049 | sym->name ? sym->name : "<choice>", |
| 1055 | 1050 | next_sym->name ? next_sym->name : "<choice>"); |
| 1056 | 1051 | } else if (stack->expr == &sym->dir_dep.expr) { |
| 1057 | 1052 | fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n", |
| 1058 | − prop->file->name, prop->lineno, | |
| 1053 | + prop->filename, prop->lineno, | |
| 1059 | 1054 | sym->name ? sym->name : "<choice>", |
| 1060 | 1055 | next_sym->name ? next_sym->name : "<choice>"); |
| 1061 | 1056 | } else if (stack->expr == &sym->rev_dep.expr) { |
| 1062 | 1057 | fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n", |
| 1063 | − prop->file->name, prop->lineno, | |
| 1058 | + prop->filename, prop->lineno, | |
| 1064 | 1059 | sym->name ? sym->name : "<choice>", |
| 1065 | 1060 | next_sym->name ? next_sym->name : "<choice>"); |
| 1066 | 1061 | } else if (stack->expr == &sym->implied.expr) { |
| 1067 | 1062 | fprintf(stderr, "%s:%d:\tsymbol %s is implied by %s\n", |
| 1068 | − prop->file->name, prop->lineno, | |
| 1063 | + prop->filename, prop->lineno, | |
| 1069 | 1064 | sym->name ? sym->name : "<choice>", |
| 1070 | 1065 | next_sym->name ? next_sym->name : "<choice>"); |
| 1071 | 1066 | } else if (stack->expr) { |
| 1072 | 1067 | fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n", |
| 1073 | − prop->file->name, prop->lineno, | |
| 1068 | + prop->filename, prop->lineno, | |
| 1074 | 1069 | sym->name ? sym->name : "<choice>", |
| 1075 | 1070 | prop_get_type_name(prop->type), |
| 1076 | 1071 | next_sym->name ? next_sym->name : "<choice>"); |
| 1077 | 1072 | } else { |
| 1078 | 1073 | fprintf(stderr, "%s:%d:\tsymbol %s %s is visible depending on %s\n", |
| 1079 | − prop->file->name, prop->lineno, | |
| 1074 | + prop->filename, prop->lineno, | |
| 1080 | 1075 | sym->name ? sym->name : "<choice>", |
| 1081 | 1076 | prop_get_type_name(prop->type), |
| 1082 | 1077 | next_sym->name ? next_sym->name : "<choice>"); |
| @@ -0,0 +1,22 @@ | ||
| 1 | +choice | |
| 2 | + prompt "choose A or B" | |
| 3 | + | |
| 4 | +config A | |
| 5 | + bool "A" | |
| 6 | + | |
| 7 | +config B | |
| 8 | + bool "B" | |
| 9 | + | |
| 10 | +endchoice | |
| 11 | + | |
| 12 | +choice | |
| 13 | + prompt "choose X or Y" | |
| 14 | + depends on B | |
| 15 | + | |
| 16 | +config X | |
| 17 | + bool "X" | |
| 18 | + | |
| 19 | +config Y | |
| 20 | + bool "Y" | |
| 21 | + | |
| 22 | +endchoice | |
| @@ -0,0 +1,34 @@ | ||
| 1 | +# SPDX-License-Identifier: GPL-2.0-only | |
| 2 | +""" | |
| 3 | +Randomize all dependent choices | |
| 4 | + | |
| 5 | +This is a somewhat tricky case for randconfig; the visibility of one choice is | |
| 6 | +determined by a member of another choice. Randconfig should be able to generate | |
| 7 | +all possible patterns. | |
| 8 | +""" | |
| 9 | + | |
| 10 | + | |
| 11 | +def test(conf): | |
| 12 | + | |
| 13 | + expected0 = False | |
| 14 | + expected1 = False | |
| 15 | + expected2 = False | |
| 16 | + | |
| 17 | + for i in range(100): | |
| 18 | + assert conf.randconfig(seed=i) == 0 | |
| 19 | + | |
| 20 | + if conf.config_matches('expected_config0'): | |
| 21 | + expected0 = True | |
| 22 | + elif conf.config_matches('expected_config1'): | |
| 23 | + expected1 = True | |
| 24 | + elif conf.config_matches('expected_config2'): | |
| 25 | + expected2 = True | |
| 26 | + else: | |
| 27 | + assert False | |
| 28 | + | |
| 29 | + if expected0 and expected1 and expected2: | |
| 30 | + break | |
| 31 | + | |
| 32 | + assert expected0 | |
| 33 | + assert expected1 | |
| 34 | + assert expected2 | |
| @@ -0,0 +1,6 @@ | ||
| 1 | +# | |
| 2 | +# Automatically generated file; DO NOT EDIT. | |
| 3 | +# Main menu | |
| 4 | +# | |
| 5 | +CONFIG_A=y | |
| 6 | +# CONFIG_B is not set | |
| @@ -0,0 +1,8 @@ | ||
| 1 | +# | |
| 2 | +# Automatically generated file; DO NOT EDIT. | |
| 3 | +# Main menu | |
| 4 | +# | |
| 5 | +# CONFIG_A is not set | |
| 6 | +CONFIG_B=y | |
| 7 | +CONFIG_X=y | |
| 8 | +# CONFIG_Y is not set | |
| @@ -0,0 +1,8 @@ | ||
| 1 | +# | |
| 2 | +# Automatically generated file; DO NOT EDIT. | |
| 3 | +# Main menu | |
| 4 | +# | |
| 5 | +# CONFIG_A is not set | |
| 6 | +CONFIG_B=y | |
| 7 | +# CONFIG_X is not set | |
| 8 | +CONFIG_Y=y | |
| @@ -0,0 +1,32 @@ | ||
| 1 | +choice | |
| 2 | + prompt "This is always invisible" | |
| 3 | + depends on n | |
| 4 | + | |
| 5 | +config DUMMY | |
| 6 | + bool "DUMMY" | |
| 7 | + | |
| 8 | +endchoice | |
| 9 | + | |
| 10 | +choice | |
| 11 | + prompt "Choose A or B" | |
| 12 | + | |
| 13 | +config A | |
| 14 | + bool "A" | |
| 15 | + | |
| 16 | +config B | |
| 17 | + bool "B" | |
| 18 | + | |
| 19 | +endchoice | |
| 20 | + | |
| 21 | +config FOO | |
| 22 | + bool "FOO" | |
| 23 | + depends on A | |
| 24 | + | |
| 25 | +choice | |
| 26 | + prompt "Choose X" | |
| 27 | + depends on FOO | |
| 28 | + | |
| 29 | +config X | |
| 30 | + bool "X" | |
| 31 | + | |
| 32 | +endchoice | |
| @@ -0,0 +1,18 @@ | ||
| 1 | +# SPDX-License-Identifier: GPL-2.0-only | |
| 2 | +""" | |
| 3 | +Randomize choices with correct dependencies | |
| 4 | + | |
| 5 | +When shuffling a choice may potentially disrupt certain dependencies, symbol | |
| 6 | +values must be recalculated. | |
| 7 | + | |
| 8 | +Related Linux commits: | |
| 9 | + - c8fb7d7e48d11520ad24808cfce7afb7b9c9f798 | |
| 10 | +""" | |
| 11 | + | |
| 12 | + | |
| 13 | +def test(conf): | |
| 14 | + for i in range(20): | |
| 15 | + assert conf.randconfig(seed=i) == 0 | |
| 16 | + assert (conf.config_matches('expected_config0') or | |
| 17 | + conf.config_matches('expected_config1') or | |
| 18 | + conf.config_matches('expected_config2')) | |
| @@ -0,0 +1,8 @@ | ||
| 1 | +# | |
| 2 | +# Automatically generated file; DO NOT EDIT. | |
| 3 | +# Main menu | |
| 4 | +# | |
| 5 | +CONFIG_A=y | |
| 6 | +# CONFIG_B is not set | |
| 7 | +CONFIG_FOO=y | |
| 8 | +CONFIG_X=y | |
| @@ -0,0 +1,7 @@ | ||
| 1 | +# | |
| 2 | +# Automatically generated file; DO NOT EDIT. | |
| 3 | +# Main menu | |
| 4 | +# | |
| 5 | +CONFIG_A=y | |
| 6 | +# CONFIG_B is not set | |
| 7 | +# CONFIG_FOO is not set | |
| @@ -0,0 +1,6 @@ | ||
| 1 | +# | |
| 2 | +# Automatically generated file; DO NOT EDIT. | |
| 3 | +# Main menu | |
| 4 | +# | |
| 5 | +# CONFIG_A is not set | |
| 6 | +CONFIG_B=y | |
| @@ -154,12 +154,10 @@ class Conf: · 153 unmodified lines | ||
| 154 | 154 | defconfig_path = os.path.join(self._test_dir, defconfig) |
| 155 | 155 | return self._run_conf('--defconfig={}'.format(defconfig_path)) |
| 156 | 156 | |
| 157 | − def _allconfig(self, mode, all_config): | |
| 157 | + def _allconfig(self, mode, all_config, extra_env={}): | |
| 158 | 158 | if all_config: |
| 159 | 159 | all_config_path = os.path.join(self._test_dir, all_config) |
| 160 | − extra_env = {'KCONFIG_ALLCONFIG': all_config_path} | |
| 161 | − else: | |
| 162 | − extra_env = {} | |
| 160 | + extra_env['KCONFIG_ALLCONFIG'] = all_config_path | |
| 163 | 161 | |
| 164 | 162 | return self._run_conf('--{}config'.format(mode), extra_env=extra_env) |
| 165 | 163 | |
| @@ -195,13 +193,19 @@ class Conf: · 29 unmodified lines | ||
| 195 | 193 | """ |
| 196 | 194 | return self._allconfig('alldef', all_config) |
| 197 | 195 | |
| 198 | − def randconfig(self, all_config=None): | |
| 196 | + def randconfig(self, all_config=None, seed=None): | |
| 199 | 197 | """Run randconfig. |
| 200 | 198 | |
| 201 | 199 | all_config: fragment config file for KCONFIG_ALLCONFIG (optional) |
| 200 | + seed: the seed for randconfig (optional) | |
| 202 | 201 | returncode: exit status of the Kconfig executable |
| 203 | 202 | """ |
| 204 | − return self._allconfig('rand', all_config) | |
| 203 | + if seed is not None: | |
| 204 | + extra_env = {'KCONFIG_SEED': hex(seed)} | |
| 205 | + else: | |
| 206 | + extra_env = {} | |
| 207 | + | |
| 208 | + return self._allconfig('rand', all_config, extra_env=extra_env) | |
| 205 | 209 | |
| 206 | 210 | def savedefconfig(self, dot_config): |
| 207 | 211 | """Run savedefconfig. |
| @@ -1,10 +1,10 @@ | ||
| 1 | −Kconfig:11:error: recursive dependency detected! | |
| 2 | −Kconfig:11: symbol B is selected by B | |
| 1 | +Kconfig:5:error: recursive dependency detected! | |
| 2 | +Kconfig:5: symbol A depends on A | |
| 3 | 3 | For a resolution refer to Documentation/kbuild/kconfig-language.rst |
| 4 | 4 | subsection "Kconfig recursive dependency limitations" |
| 5 | 5 | |
| 6 | −Kconfig:5:error: recursive dependency detected! | |
| 7 | −Kconfig:5: symbol A depends on A | |
| 6 | +Kconfig:11:error: recursive dependency detected! | |
| 7 | +Kconfig:11: symbol B is selected by B | |
| 8 | 8 | For a resolution refer to Documentation/kbuild/kconfig-language.rst |
| 9 | 9 | subsection "Kconfig recursive dependency limitations" |
| 10 | 10 | |
| @@ -14,9 +14,9 @@ Kconfig:21: symbol C2 depends on C1 · 3 unmodified lines | ||
| 14 | 14 | For a resolution refer to Documentation/kbuild/kconfig-language.rst |
| 15 | 15 | subsection "Kconfig recursive dependency limitations" |
| 16 | 16 | |
| 17 | −Kconfig:32:error: recursive dependency detected! | |
| 18 | −Kconfig:32: symbol D2 is selected by D1 | |
| 17 | +Kconfig:27:error: recursive dependency detected! | |
| 19 | 18 | Kconfig:27: symbol D1 depends on D2 |
| 19 | +Kconfig:32: symbol D2 is selected by D1 | |
| 20 | 20 | For a resolution refer to Documentation/kbuild/kconfig-language.rst |
| 21 | 21 | subsection "Kconfig recursive dependency limitations" |
| 22 | 22 | |
| @@ -26,13 +26,13 @@ Kconfig:42: symbol E2 is implied by E1 · 3 unmodified lines | ||
| 26 | 26 | For a resolution refer to Documentation/kbuild/kconfig-language.rst |
| 27 | 27 | subsection "Kconfig recursive dependency limitations" |
| 28 | 28 | |
| 29 | −Kconfig:60:error: recursive dependency detected! | |
| 30 | −Kconfig:60: symbol G depends on G | |
| 29 | +Kconfig:49:error: recursive dependency detected! | |
| 30 | +Kconfig:49: symbol F1 default value contains F2 | |
| 31 | +Kconfig:51: symbol F2 depends on F1 | |
| 31 | 32 | For a resolution refer to Documentation/kbuild/kconfig-language.rst |
| 32 | 33 | subsection "Kconfig recursive dependency limitations" |
| 33 | 34 | |
| 34 | −Kconfig:51:error: recursive dependency detected! | |
| 35 | −Kconfig:51: symbol F2 depends on F1 | |
| 36 | −Kconfig:49: symbol F1 default value contains F2 | |
| 35 | +Kconfig:60:error: recursive dependency detected! | |
| 36 | +Kconfig:60: symbol G depends on G | |
| 37 | 37 | For a resolution refer to Documentation/kbuild/kconfig-language.rst |
| 38 | 38 | subsection "Kconfig recursive dependency limitations" |
| @@ -7,25 +7,50 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <stdarg.h> |
| 8 | 8 | #include <stdlib.h> |
| 9 | 9 | #include <string.h> |
| 10 | + | |
| 11 | +#include "hashtable.h" | |
| 10 | 12 | #include "lkc.h" |
| 11 | 13 | |
| 14 | +unsigned int strhash(const char *s) | |
| 15 | +{ | |
| 16 | + /* fnv32 hash */ | |
| 17 | + unsigned int hash = 2166136261U; | |
| 18 | + | |
| 19 | + for (; *s; s++) | |
| 20 | + hash = (hash ^ *s) * 0x01000193; | |
| 21 | + return hash; | |
| 22 | +} | |
| 23 | + | |
| 24 | +/* hash table of all parsed Kconfig files */ | |
| 25 | +static HASHTABLE_DEFINE(file_hashtable, 1U << 11); | |
| 26 | + | |
| 27 | +struct file { | |
| 28 | + struct hlist_node node; | |
| 29 | + char name[]; | |
| 30 | +}; | |
| 31 | + | |
| 12 | 32 | /* file already present in list? If not add it */ |
| 13 | −struct file *file_lookup(const char *name) | |
| 33 | +const char *file_lookup(const char *name) | |
| 14 | 34 | { |
| 15 | 35 | struct file *file; |
| 36 | + size_t len; | |
| 37 | + int hash = strhash(name); | |
| 16 | 38 | |
| 17 | − for (file = file_list; file; file = file->next) { | |
| 18 | − if (!strcmp(name, file->name)) { | |
| 19 | − return file; | |
| 20 | − } | |
| 21 | − } | |
| 39 | + hash_for_each_possible(file_hashtable, file, node, hash) | |
| 40 | + if (!strcmp(name, file->name)) | |
| 41 | + return file->name; | |
| 22 | 42 | |
| 23 | − file = xmalloc(sizeof(*file)); | |
| 43 | + len = strlen(name); | |
| 44 | + file = xmalloc(sizeof(*file) + len + 1); | |
| 24 | 45 | memset(file, 0, sizeof(*file)); |
| 25 | − file->name = xstrdup(name); | |
| 26 | − file->next = file_list; | |
| 27 | − file_list = file; | |
| 28 | − return file; | |
| 46 | + memcpy(file->name, name, len); | |
| 47 | + file->name[len] = '\0'; | |
| 48 | + | |
| 49 | + hash_add(file_hashtable, &file->node, hash); | |
| 50 | + | |
| 51 | + str_printf(&autoconf_cmd, "\t%s \\\n", name); | |
| 52 | + | |
| 53 | + return file->name; | |
| 29 | 54 | } |
| 30 | 55 | |
| 31 | 56 | /* Allocate initial growable string */ |
| @@ -1050,7 +1050,9 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, · 1049 unmodified lines | ||
| 1050 | 1050 | sec_mismatch_count++; |
| 1051 | 1051 | |
| 1052 | 1052 | warn("%s: section mismatch in reference: %s+0x%x (section: %s) -> %s (section: %s)\n", |
| 1053 | − modname, fromsym, (unsigned int)(faddr - from->st_value), fromsec, tosym, tosec); | |
| 1053 | + modname, fromsym, | |
| 1054 | + (unsigned int)(faddr - (from ? from->st_value : 0)), | |
| 1055 | + fromsec, tosym, tosec); | |
| 1054 | 1056 | |
| 1055 | 1057 | if (mismatch->mismatch == EXTABLE_TO_NON_TEXT) { |
| 1056 | 1058 | if (match(tosec, mismatch->bad_tosec)) |
| @@ -24,24 +24,10 @@ if_enabled_echo() { · 23 unmodified lines | ||
| 24 | 24 | fi |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | −create_package() { | |
| 28 | − export DH_OPTIONS="-p${1}" | |
| 29 | − | |
| 30 | − dh_installdocs | |
| 31 | − dh_installchangelogs | |
| 32 | − dh_compress | |
| 33 | − dh_fixperms | |
| 34 | − dh_gencontrol | |
| 35 | − dh_md5sums | |
| 36 | − dh_builddeb -- ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} | |
| 37 | −} | |
| 38 | − | |
| 39 | 27 | install_linux_image () { |
| 40 | 28 | pname=$1 |
| 41 | 29 | pdir=debian/$1 |
| 42 | 30 | |
| 43 | − rm -rf ${pdir} | |
| 44 | − | |
| 45 | 31 | # Only some architectures with OF support have this target |
| 46 | 32 | if is_enabled CONFIG_OF_EARLY_FLATTREE && [ -d "${srctree}/arch/${SRCARCH}/boot/dts" ]; then |
| 47 | 33 | ${MAKE} -f ${srctree}/Makefile INSTALL_DTBS_PATH="${pdir}/usr/lib/linux-image-${KERNELRELEASE}" dtbs_install |
| @@ -109,8 +95,6 @@ install_linux_image () { · 61 unmodified lines | ||
| 109 | 95 | install_linux_image_dbg () { |
| 110 | 96 | pdir=debian/$1 |
| 111 | 97 | |
| 112 | − rm -rf ${pdir} | |
| 113 | − | |
| 114 | 98 | # Parse modules.order directly because 'make modules_install' may sign, |
| 115 | 99 | # compress modules, and then run unneeded depmod. |
| 116 | 100 | while read -r mod; do |
| @@ -140,8 +124,6 @@ install_kernel_headers () { · 23 unmodified lines | ||
| 140 | 124 | pdir=debian/$1 |
| 141 | 125 | version=${1#linux-headers-} |
| 142 | 126 | |
| 143 | − rm -rf $pdir | |
| 144 | − | |
| 145 | 127 | "${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}" |
| 146 | 128 | |
| 147 | 129 | mkdir -p $pdir/lib/modules/$version/ |
| @@ -151,8 +133,6 @@ install_kernel_headers () { · 3 unmodified lines | ||
| 151 | 133 | install_libc_headers () { |
| 152 | 134 | pdir=debian/$1 |
| 153 | 135 | |
| 154 | − rm -rf $pdir | |
| 155 | − | |
| 156 | 136 | $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH=$pdir/usr |
| 157 | 137 | |
| 158 | 138 | # move asm headers to /usr/include/<libc-machine>/asm to match the structure |
| @@ -161,21 +141,15 @@ install_libc_headers () { · 2 unmodified lines | ||
| 161 | 141 | mv "$pdir/usr/include/asm" "$pdir/usr/include/${DEB_HOST_MULTIARCH}" |
| 162 | 142 | } |
| 163 | 143 | |
| 164 | −rm -f debian/files | |
| 165 | − | |
| 166 | −packages_enabled=$(dh_listpackages) | |
| 167 | − | |
| 168 | −for package in ${packages_enabled} | |
| 169 | −do | |
| 170 | − case ${package} in | |
| 171 | − *-dbg) | |
| 172 | − install_linux_image_dbg "${package}";; | |
| 173 | − linux-image-*|user-mode-linux-*) | |
| 174 | − install_linux_image "${package}";; | |
| 175 | − linux-libc-dev) | |
| 176 | − install_libc_headers "${package}";; | |
| 177 | − linux-headers-*) | |
| 178 | − install_kernel_headers "${package}";; | |
| 179 | − esac | |
| 180 | − create_package "${package}" | |
| 181 | −done | |
| 144 | +package=$1 | |
| 145 | + | |
| 146 | +case "${package}" in | |
| 147 | +*-dbg) | |
| 148 | + install_linux_image_dbg "${package}";; | |
| 149 | +linux-image-*|user-mode-linux-*) | |
| 150 | + install_linux_image "${package}";; | |
| 151 | +linux-libc-dev) | |
| 152 | + install_libc_headers "${package}";; | |
| 153 | +linux-headers-*) | |
| 154 | + install_kernel_headers "${package}";; | |
| 155 | +esac | |
| @@ -11,28 +11,73 @@ ifneq (,$(filter-out parallel=1,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))) · 10 unmodified lines | ||
| 11 | 11 | MAKEFLAGS += -j$(NUMJOBS) |
| 12 | 12 | endif |
| 13 | 13 | |
| 14 | +# When KBUILD_VERBOSE is undefined (presumably you are directly working with | |
| 15 | +# the debianized tree), show verbose logs unless DEB_BUILD_OPTION=terse is set. | |
| 16 | +ifeq ($(origin KBUILD_VERBOSE),undefined) | |
| 17 | + ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS))) | |
| 18 | + export KBUILD_VERBOSE := 1 | |
| 19 | + else | |
| 20 | + Q := @ | |
| 21 | + endif | |
| 22 | +endif | |
| 23 | + | |
| 14 | 24 | revision = $(lastword $(subst -, ,$(shell dpkg-parsechangelog -S Version))) |
| 15 | 25 | CROSS_COMPILE ?= $(filter-out $(DEB_BUILD_GNU_TYPE)-, $(DEB_HOST_GNU_TYPE)-) |
| 16 | 26 | make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) KBUILD_BUILD_VERSION=$(revision) $(addprefix CROSS_COMPILE=,$(CROSS_COMPILE)) |
| 17 | 27 | |
| 28 | +binary-targets := $(addprefix binary-, image image-dbg headers libc-dev) | |
| 29 | + | |
| 30 | +all-packages = $(shell dh_listpackages) | |
| 31 | +image-package = $(filter linux-image-% user-%, $(filter-out %-dbg, $(all-packages))) | |
| 32 | +image-dbg-package = $(filter %-dbg, $(all-packages)) | |
| 33 | +libc-dev-package = $(filter linux-libc-dev, $(all-packages)) | |
| 34 | +headers-package = $(filter linux-headers-%, $(all-packages)) | |
| 35 | + | |
| 36 | +mk-files = $(patsubst binary-%,debian/%.files,$1) | |
| 37 | +package = $($(@:binary-%=%-package)) | |
| 38 | + | |
| 39 | +# DH_OPTION is an environment variable common for all debhelper commands. | |
| 40 | +# We could 'export' it, but here it is passed from the command line to clarify | |
| 41 | +# which package is being processed in the build log. | |
| 42 | +DH_OPTIONS = -p$(package) | |
| 43 | + | |
| 44 | +define binary | |
| 45 | + $(Q)dh_testdir $(DH_OPTIONS) | |
| 46 | + $(Q)dh_testroot $(DH_OPTIONS) | |
| 47 | + $(Q)dh_prep $(DH_OPTIONS) | |
| 48 | + $(Q)+$(MAKE) $(make-opts) run-command KBUILD_RUN_COMMAND='+$$(srctree)/scripts/package/builddeb $(package)' | |
| 49 | + $(Q)dh_installdocs $(DH_OPTIONS) | |
| 50 | + $(Q)dh_installchangelogs $(DH_OPTIONS) | |
| 51 | + $(Q)dh_compress $(DH_OPTIONS) | |
| 52 | + $(Q)dh_fixperms $(DH_OPTIONS) | |
| 53 | + $(Q)dh_gencontrol $(DH_OPTIONS) -- -f$(call mk-files,$@) | |
| 54 | + $(Q)dh_md5sums $(DH_OPTIONS) | |
| 55 | + $(Q)dh_builddeb $(DH_OPTIONS) -- $(addprefix -Z,$(KDEB_COMPRESS)) | |
| 56 | +endef | |
| 57 | + | |
| 58 | +.PHONY: $(binary-targets) | |
| 59 | +$(binary-targets): build-arch | |
| 60 | + $(Q)truncate -s0 $(call mk-files,$@) | |
| 61 | + $(if $(package),$(binary)) | |
| 62 | + | |
| 18 | 63 | .PHONY: binary binary-indep binary-arch |
| 19 | 64 | binary: binary-arch binary-indep |
| 20 | 65 | binary-indep: build-indep |
| 21 | −binary-arch: build-arch | |
| 22 | − $(MAKE) $(make-opts) \ | |
| 23 | − run-command KBUILD_RUN_COMMAND='+$$(srctree)/scripts/package/builddeb' | |
| 66 | +binary-arch: $(binary-targets) | |
| 67 | + $(Q)cat $(call mk-files,$^) > debian/files | |
| 24 | 68 | |
| 25 | 69 | .PHONY: build build-indep build-arch |
| 26 | 70 | build: build-arch build-indep |
| 27 | 71 | build-indep: |
| 28 | 72 | build-arch: |
| 29 | − $(MAKE) $(make-opts) olddefconfig | |
| 30 | − $(MAKE) $(make-opts) $(if $(filter um,$(ARCH)),,headers) all | |
| 73 | + $(Q)$(MAKE) $(make-opts) olddefconfig | |
| 74 | + $(Q)$(MAKE) $(make-opts) $(if $(filter um,$(ARCH)),,headers) all | |
| 31 | 75 | |
| 32 | 76 | .PHONY: clean |
| 33 | 77 | clean: |
| 34 | − rm -rf debian/files debian/linux-* debian/deb-env.vars* | |
| 35 | − $(MAKE) ARCH=$(ARCH) clean | |
| 78 | + $(Q)dh_clean | |
| 79 | + $(Q)rm -rf debian/deb-env.vars* debian/*.files | |
| 80 | + $(Q)$(MAKE) ARCH=$(ARCH) clean | |
| 36 | 81 | |
| 37 | 82 | # If DEB_HOST_ARCH is empty, it is likely that debian/rules was executed |
| 38 | 83 | # directly. Run 'dpkg-architecture --print-set --print-format=make' to |
| @@ -41,6 +86,6 @@ ifndef DEB_HOST_ARCH · 2 unmodified lines | ||
| 41 | 86 | include debian/deb-env.vars |
| 42 | 87 | |
| 43 | 88 | debian/deb-env.vars: |
| 44 | − dpkg-architecture -a$$(cat debian/arch) --print-set --print-format=make > $@.tmp | |
| 45 | − mv $@.tmp $@ | |
| 89 | + $(Q)dpkg-architecture -a$$(cat debian/arch) --print-set --print-format=make > $@.tmp | |
| 90 | + $(Q)mv $@.tmp $@ | |
| 46 | 91 | endif |
| @@ -61,11 +61,37 @@ cp $(%{make} %{makeflags} -s image_name) %{buildroot}/lib/modules/%{KERNELRELEAS · 60 unmodified lines | ||
| 61 | 61 | %{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install |
| 62 | 62 | cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE} |
| 63 | 63 | cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config |
| 64 | +if %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='test -d ${srctree}/arch/${SRCARCH}/boot/dts' 2>/dev/null; then | |
| 65 | + %{make} %{makeflags} INSTALL_DTBS_PATH=%{buildroot}/lib/modules/%{KERNELRELEASE}/dtb dtbs_install | |
| 66 | +fi | |
| 64 | 67 | ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build |
| 65 | 68 | %if %{with_devel} |
| 66 | 69 | %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}' |
| 67 | 70 | %endif |
| 68 | 71 | |
| 72 | +{ | |
| 73 | + for x in System.map config kernel modules.builtin \ | |
| 74 | + modules.builtin.modinfo modules.order vmlinuz; do | |
| 75 | + echo "/lib/modules/%{KERNELRELEASE}/${x}" | |
| 76 | + done | |
| 77 | + | |
| 78 | + for x in alias alias.bin builtin.alias.bin builtin.bin dep dep.bin \ | |
| 79 | + devname softdep symbols symbols.bin; do | |
| 80 | + echo "%ghost /lib/modules/%{KERNELRELEASE}/modules.${x}" | |
| 81 | + done | |
| 82 | + | |
| 83 | + for x in System.map config vmlinuz; do | |
| 84 | + echo "%ghost /boot/${x}-%{KERNELRELEASE}" | |
| 85 | + done | |
| 86 | + | |
| 87 | + if [ -d "%{buildroot}/lib/modules/%{KERNELRELEASE}/dtb" ];then | |
| 88 | + echo "/lib/modules/%{KERNELRELEASE}/dtb" | |
| 89 | + find "%{buildroot}/lib/modules/%{KERNELRELEASE}/dtb" -printf "%%%ghost /boot/dtb-%{KERNELRELEASE}/%%P\n" | |
| 90 | + fi | |
| 91 | + | |
| 92 | + echo "%exclude /lib/modules/%{KERNELRELEASE}/build" | |
| 93 | +} > %{buildroot}/kernel.list | |
| 94 | + | |
| 69 | 95 | %clean |
| 70 | 96 | rm -rf %{buildroot} |
| 71 | 97 | |
| @@ -78,23 +104,23 @@ for file in vmlinuz System.map config; do · 6 unmodified lines | ||
| 78 | 104 | cp "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}" |
| 79 | 105 | fi |
| 80 | 106 | done |
| 107 | +if [ -d "/lib/modules/%{KERNELRELEASE}/dtb" ] && \ | |
| 108 | + ! diff -rq "/lib/modules/%{KERNELRELEASE}/dtb" "/boot/dtb-%{KERNELRELEASE}" >/dev/null 2>&1; then | |
| 109 | + rm -rf "/boot/dtb-%{KERNELRELEASE}" | |
| 110 | + cp -r "/lib/modules/%{KERNELRELEASE}/dtb" "/boot/dtb-%{KERNELRELEASE}" | |
| 111 | +fi | |
| 112 | +if [ ! -e "/lib/modules/%{KERNELRELEASE}/modules.dep" ]; then | |
| 113 | + /usr/sbin/depmod %{KERNELRELEASE} | |
| 114 | +fi | |
| 81 | 115 | |
| 82 | 116 | %preun |
| 83 | −if [ -x /sbin/new-kernel-pkg ]; then | |
| 84 | −new-kernel-pkg --remove %{KERNELRELEASE} --rminitrd --initrdfile=/boot/initramfs-%{KERNELRELEASE}.img | |
| 85 | −elif [ -x /usr/bin/kernel-install ]; then | |
| 117 | +if [ -x /usr/bin/kernel-install ]; then | |
| 86 | 118 | kernel-install remove %{KERNELRELEASE} |
| 87 | 119 | fi |
| 88 | 120 | |
| 89 | −%postun | |
| 90 | −if [ -x /sbin/update-bootloader ]; then | |
| 91 | −/sbin/update-bootloader --remove %{KERNELRELEASE} | |
| 92 | −fi | |
| 93 | − | |
| 94 | −%files | |
| 121 | +%files -f %{buildroot}/kernel.list | |
| 95 | 122 | %defattr (-, root, root) |
| 96 | −/lib/modules/%{KERNELRELEASE} | |
| 97 | −%exclude /lib/modules/%{KERNELRELEASE}/build | |
| 123 | +%exclude /kernel.list | |
| 98 | 124 | |
| 99 | 125 | %files headers |
| 100 | 126 | %defattr (-, root, root) |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | # Most of this file is copied from tools/lib/traceevent/Makefile |
| 3 | 3 | |
| 4 | 4 | RM ?= rm |
| 5 | −srctree = $(abs_srctree) | |
| 5 | +srctree := $(realpath $(srctree)) | |
| 6 | 6 | |
| 7 | 7 | VERSION_SCRIPT := libbpf.map |
| 8 | 8 | LIBBPF_VERSION := $(shell \ |