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] Kbuild: include arch/ Makefile before other directories
Date: Mon,  5 Jun 2023 08:37:19 +0200	[thread overview]
Message-ID: <20230605063719.1431079-1-a.fatoum@pengutronix.de> (raw)

Unless overridden by SORT*, LD will place sections matched by wildcards
in the order they were seen in the link. So far, this meant that
arch/ initcalls and device trees compiled into barebox proper, were
always last.

For platforms with PBL or with only one device tree in barebox proper,
this didn't matter much, but when enabling the of_manipulation selftest,
a second device tree would be built into barebox on kvx, openrisc and
some MIPS.

Because all directories appear before arch/, this had the effect that
on kvx, openrisc and some MIPS, __dtb_start would end up pointing at the
test's device tree instead of the board device tree breaking the build.

Switching the affected platforms to use PBL would be one fix for the
issue, but there's a simple one: let's do what Linux does in its
top-level Kbuild file and have arch/ not be the last in sequence.

This may fause fallout for code that depended on specific ordering of
initcalls or other linker-defined lists, which would need to be fixed.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
While a fix, I think this needs to sit a while in next first.
---
 Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 711cba7bed29..4fdb8f1b41af 100644
--- a/Makefile
+++ b/Makefile
@@ -586,11 +586,12 @@ endif
 # We need some generic definitions.
 include $(srctree)/scripts/Makefile.lib
 
-# Objects we will link into barebox / subdirs we need to visit
-common-y		:= common/ drivers/ commands/ lib/ crypto/ net/ fs/ firmware/ test/
 
+# Objects we will link into barebox / subdirs we need to visit
 include $(srctree)/arch/$(SRCARCH)/Makefile
 
+common-y		+= common/ drivers/ commands/ lib/ crypto/ net/ fs/ firmware/ test/
+
 ifdef need-config
 ifdef may-sync-config
 # Read in dependencies to all Kconfig* files, make sure to run syncconfig if
-- 
2.39.2




             reply	other threads:[~2023-06-05  6:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05  6:37 Ahmad Fatoum [this message]
2023-06-13  8:04 ` Ahmad Fatoum
2023-06-13  9:16 ` Sascha Hauer
2023-06-13 10:18   ` 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=20230605063719.1431079-1-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