mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <>
To: Ahmad Fatoum <>
Cc:, Jules Maselbas <>
Subject: Re: [PATCH v3] ARM: document arm_setup_stack() pitfalls
Date: Sat, 2 Oct 2021 10:54:27 +0200
Message-ID: <> (raw)
In-Reply-To: <>

On Fri, Sep 17, 2021 at 02:11:52PM +0200, Ahmad Fatoum wrote:
> Many arm32 board entry points use arm_setup_stack() to set up
> the stack from C code. This necessitates using __naked, which
> probably has been our most frequent cause of misscompiled C code.
> GCC is quite clear that:
>   Only basic asm statements can safely be included in naked functions
>   While using extended asm or a mixture of basic asm and C code may
>   appear to work, they cannot be depended upon to work reliably and
>   are not supported.
> But some boards use it anyway, because it's nice to avoid writing
> assembly. Reading generated assembly to spot compiler miscompilation
> isn't that nice though, so add some documentation, comments
> and compiler diagnostics to hopefully reduce future porting effort.
> Signed-off-by: Ahmad Fatoum <>
> ---
> v2 -> v3:
>   - fix typos (Uwe)
>   - use better matching CONFIG_CPU_64 instead of CONFIG_CPU_V8
>   - clarify 'bad' stack manipulation
> v1 -> v2:
>   - fix commit message title

Applied, thanks


Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       |  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

barebox mailing list

      reply	other threads:[~2021-10-02  8:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17 12:11 Ahmad Fatoum
2021-10-02  8:54 ` Sascha Hauer [this message]

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:

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

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ \
	public-inbox-index barebox

Example config snippet for mirrors.

AGPL code for this site: git clone