Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

arm: fix boot looping when building with GCC 14 #80579

Merged

Conversation

fabiobaltieri
Copy link
Member

@fabiobaltieri fabiobaltieri commented Oct 29, 2024

Fix a boot loop when building with GCC on ARM platforms due to some extra optimizations introduced in GCC 14 combined with some missing specs on an asm block.

Fixes #80542

Tested on an NPCX9, GCC 14.2.0 of some flavor

Move the _main argument to the input list rather than the output one on
the asm block and change the spec to "r". The ASM block does not return,
so it does not make sense for it to expect any output.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add "memory" to the clobber list"

From GCC 14 the compiler optimizes away memory accesses that do not
impact the asm block. Adding the memory to the clobber list lets the
compiler know that the memory state is to be preserved.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
@fabiobaltieri fabiobaltieri added this to the v4.0.0 milestone Oct 29, 2024
coreboot-org-bot pushed a commit to coreboot/zephyr-cros that referenced this pull request Oct 29, 2024
Move the _main argument to the input list rather than the output one on
the asm block and change the spec to "r". The ASM block does not return,
so it does not make sense for it to expect any output.

zephyrproject-rtos/zephyr#80579

BUG=b:376282914

Change-Id: Ie6f1ab781bdc8d0de87353bcf48e2c4ade2d4dc1
Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5975475
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
coreboot-org-bot pushed a commit to coreboot/zephyr-cros that referenced this pull request Oct 29, 2024
Add "memory" to the clobber list"

From GCC 14 the compiler optimizes away memory accesses that do not
impact the asm block. Adding the memory to the clobber list lets the
compiler know that the memory state is to be preserved.

zephyrproject-rtos/zephyr#80579

BUG=b:376282914

Change-Id: I990e2256d0019361b3ef1f736095ebca3806a6e1
Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5976801
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
Tested-by: Jeremy Bettis <jbettis@chromium.org>
@stephanosio stephanosio added the backport v3.7-branch Request backport to the v3.7-branch label Oct 30, 2024
@mmahadevan108 mmahadevan108 merged commit 63890e2 into zephyrproject-rtos:main Oct 31, 2024
25 checks passed
@fabiobaltieri fabiobaltieri deleted the arm-gcc14-asm-fix branch October 31, 2024 19:24
coreboot-org-bot pushed a commit to coreboot/zephyr-cros that referenced this pull request Nov 5, 2024
This reverts commit 00ff8b6.

Reason for revert: Commit landed upstream in zephyrproject-rtos/zephyr@63890e2

Original change's description:
> FROMPULL: arch: arm: cortex_m: add memory to the clobber list
>
> Add "memory" to the clobber list"
>
> From GCC 14 the compiler optimizes away memory accesses that do not
> impact the asm block. Adding the memory to the clobber list lets the
> compiler know that the memory state is to be preserved.
>
> zephyrproject-rtos/zephyr#80579
>
> BUG=b:376282914
>
> Change-Id: I990e2256d0019361b3ef1f736095ebca3806a6e1
> Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
> Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5976801
> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
> Tested-by: Jeremy Bettis <jbettis@chromium.org>

BUG=b:376282914

Change-Id: I8458857a2e52c8174257d0d3e94ac766dcf54027
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5994230
Tested-by: Yuval Peress <peress@google.com>
Auto-Submit: Yuval Peress <peress@google.com>
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Commit-Queue: Yuval Peress <peress@google.com>
coreboot-org-bot pushed a commit to coreboot/zephyr-cros that referenced this pull request Nov 5, 2024
This reverts commit 1307455.

Reason for revert: Commit landed upstream in zephyrproject-rtos/zephyr@7015a0e

Original change's description:
> FROMPULL: arch: arm: cortex_m: move _main in input list
>
> Move the _main argument to the input list rather than the output one on
> the asm block and change the spec to "r". The ASM block does not return,
> so it does not make sense for it to expect any output.
>
> zephyrproject-rtos/zephyr#80579
>
> BUG=b:376282914
>
> Change-Id: Ie6f1ab781bdc8d0de87353bcf48e2c4ade2d4dc1
> Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
> Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5975475
> Tested-by: Jeremy Bettis <jbettis@chromium.org>
> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>

BUG=b:376282914

Change-Id: I189e76cbfed650a98be338f9cd5c1aa79d396b47
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5991739
Auto-Submit: Yuval Peress <peress@google.com>
Commit-Queue: Yuval Peress <peress@google.com>
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: Yuval Peress <peress@google.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area: ARM ARM (32-bit) Architecture backport v3.7-branch Request backport to the v3.7-branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hard fault on boot w/ GCC 14 on Cortex-M
6 participants