From: Ash Logan <ash+lists@heyquark.com>
To: gentoo-embedded@lists.gentoo.org
Cc: lily@lilysthings.org, loganisamazing@outlook.com
Subject: [gentoo-embedded] Best way to handle custom gcc patches for a CPU errata?
Date: Sun, 21 Jan 2024 14:56:25 +1100 [thread overview]
Message-ID: <c1cc9f01-9052-4b68-b9f3-b669cb9554c0@heyquark.com> (raw)
Hi!
I'm working on Linux for the Wii U [1], sporting the "Espresso" - a CPU
that unfortunately has an errata, requiring some extra instructions to
be added to atomic operations. I would like to build Gentoo with a
patched compiler that applies this workaround.
I've drafted up patches for gcc (and glibc) that apply the relevant
changes [2]. Right now they are enabled by setting -mcpu=espresso. There
is a similar errata in the PowerPC 405 that is handled the same way
upstream.
I am wondering what the best way to set this up for regular use is? I've
been using a custom target triple (powerpc-espresso-linux-gnu) and
EXTRA_ECONF="--with-cpu=espresso" (setting the default -mcpu), but this
seems suboptimal - it's very easy to miss the extra_econf when e.g. gcc
gets pulled in as a dep of some other package. I've made things work
with package.use flags [3] but it kinda feels like a kludge - is there a
better option?
My end goal is to ship a Gentoo image out to users that will allow them
to either emerge new packages on-device or target with crossdev/binpkgs.
I can think of a few other strategies:
- Apply the patches but not the EXTRA_ECONF, possibly using a generic
target triple (powerpc-unknown-linux-gnu) and ask users nicely to always
keep -mcpu=espresso in their CFLAGS. I worry that packages built without
that flag will cause data corruption, though.
- Modify the patches to unconditionally apply the workaround regardless
of -mcpu. Such a compiler would produce suboptimal (but presumably not
broken) code for all other targets.
- Find some way in the gcc build system to make
powerpc-espresso-linux-gnu synonymous with --with-cpu=espresso, since
Gentoo already handles the custom target triple just fine.
I would really appreciate any advice regarding the best approach for me
to take here. I'm a bit newer to Gentoo but it feels like a great fit
for this situation!
Ta,
~ashquarky
[1] https://linux-wiiu.org
[2] https://gitlab.com/linux-wiiu/smp-patches
[3] https://gitlab.com/linux-wiiu/smp-patches#using-gentoo
reply other threads:[~2024-01-21 3:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=c1cc9f01-9052-4b68-b9f3-b669cb9554c0@heyquark.com \
--to=ash+lists@heyquark.com \
--cc=gentoo-embedded@lists.gentoo.org \
--cc=lily@lilysthings.org \
--cc=loganisamazing@outlook.com \
/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