mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 01/13] kconfig: add IS_PROPER helper
Date: Wed, 16 Oct 2024 11:01:38 +0200	[thread overview]
Message-ID: <20241016090150.3963002-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20241016090150.3963002-1-a.fatoum@pengutronix.de>

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@pengutronix.de>
---
 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




  reply	other threads:[~2024-10-16  9:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16  9:01 [PATCH 00/13] Remove dependency on ld --gc-section in PBL Ahmad Fatoum
2024-10-16  9:01 ` Ahmad Fatoum [this message]
2024-10-16  9:01 ` [PATCH 02/13] lib: random: add stubs for PBL Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 03/13] bootsource: stub out when in PBL Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 04/13] crypto: provide crypto_memneq for PBL Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 05/13] cdev: stub out cdev_read/write " Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 06/13] libfile: stub out file descriptor API " Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 07/13] environment: stub out environment " Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 08/13] of: stub out live tree API when using PBL Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 09/13] errno: stub out perror/strerror API when built for PBL Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 10/13] xfuncs: stub out " Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 11/13] stdio: stub out basprintf and friends " Ahmad Fatoum
2024-10-16  9:40   ` [PATCH] fixup! errno: stub out perror/strerror API " Ahmad Fatoum
2024-10-16  9:40   ` [PATCH 11/13] stdio: stub out basprintf and friends " Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 12/13] memory: stub out request_barebox_region " Ahmad Fatoum
2024-10-16  9:01 ` [PATCH 13/13] malloc: add PBL stubs Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241016090150.3963002-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox