We depend on -ffunction-sections -fdata-sections at a lot of places and fail the link without due to undefined references. This is especially needed for obj-pbl-y code as the files usually have other functions depending on barebox proper infrastructure, but that is never called. This works so far, but breaks for two things: LTO and using PBL on sandbox. Both I have not managed to get the linker not to complain about the undefined references in the ultimately unreferenced code. Therefore, let's solve this a different way: Add an IS_PROPER macro and have the stubs defined when !IS_PROPER. This has the nice side effect of compile testing the stubs during PBL build, so forgotten semicolons are more likely to be noticed during development instead of CI run. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- include/linux/kconfig.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index 58f68adbbadf..8d31584c0c2a 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h @@ -33,4 +33,14 @@ */ #define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option)) +/* + * IS_PROPER(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', or 'm' + * and file is being compiled for barebox proper, 0 otherwise. + */ +#ifndef __PBL__ +#define IS_PROPER(option) IS_ENABLED(option) +#else +#define IS_PROPER(option) 0 +#endif + #endif /* __LINUX_KCONFIG_H */ -- 2.39.5