U-boot is broken with -O0?

Hello guys!
I think the CI verification job for u-boot patches should be updated to include CFLAGS like -O0 Because I'm not able to build u-boot for Raspberry Pi (or to another board) with -O0
Here the commands how to quickly reprodice the problem: export ARCH=arm64 export CROSS_COMPILE=aarch64-linux-gnueabi- export KCFLAGS=-O0 make rpi_4_defconfig make -j$(nproc)
I've attached part of the build log to this email.
P.S.: Sorry if I've added you to CC by mistake.

On Tue, Nov 09, 2021 at 08:33:33PM +0200, Oleh Kravchenko wrote:
Hello guys!
I think the CI verification job for u-boot patches should be updated to include CFLAGS like -O0 Because I'm not able to build u-boot for Raspberry Pi (or to another board) with -O0
Here the commands how to quickly reprodice the problem: export ARCH=arm64 export CROSS_COMPILE=aarch64-linux-gnueabi- export KCFLAGS=-O0 make rpi_4_defconfig make -j$(nproc)
I've attached part of the build log to this email.
You can't build a functional U-Boot with optimization globally disabled, it's just not supported.

Hello Tom, for what reason it's not supported?
I'm finding that very useful for debugging. Only a few issues with conditional compilation breaks it.
Also this issue reproducible if -DDEBUG=1 is used.
-- Best regards, Oleh Kravchenko
9 лист. 2021 р. о 20:52 Tom Rini trini@konsulko.com пише:
On Tue, Nov 09, 2021 at 08:33:33PM +0200, Oleh Kravchenko wrote:
Hello guys!
I think the CI verification job for u-boot patches should be updated to include CFLAGS like -O0 Because I'm not able to build u-boot for Raspberry Pi (or to another board) with -O0
Here the commands how to quickly reprodice the problem: export ARCH=arm64 export CROSS_COMPILE=aarch64-linux-gnueabi- export KCFLAGS=-O0 make rpi_4_defconfig make -j$(nproc)
I've attached part of the build log to this email.
You can't build a functional U-Boot with optimization globally disabled, it's just not supported.
-- Tom

Hi Oleh,
On 11/9/21 2:31 PM, Oleh Kravchenko wrote:
Hello Tom, for what reason it's not supported?
I'm finding that very useful for debugging.
Perhaps try -Og
--Sean
Only a few issues with conditional compilation breaks it.
Also this issue reproducible if -DDEBUG=1 is used.
-- Best regards, Oleh Kravchenko
9 лист. 2021 р. о 20:52 Tom Rini trini@konsulko.com пише:
On Tue, Nov 09, 2021 at 08:33:33PM +0200, Oleh Kravchenko wrote:
Hello guys!
I think the CI verification job for u-boot patches should be updated to include CFLAGS like -O0 Because I'm not able to build u-boot for Raspberry Pi (or to another board) with -O0
Here the commands how to quickly reprodice the problem: export ARCH=arm64 export CROSS_COMPILE=aarch64-linux-gnueabi- export KCFLAGS=-O0 make rpi_4_defconfig make -j$(nproc)
I've attached part of the build log to this email.
You can't build a functional U-Boot with optimization globally disabled, it's just not supported.
-- Tom

On Tue, Nov 09, 2021 at 02:34:41PM -0500, Sean Anderson wrote:
Hi Oleh,
On 11/9/21 2:31 PM, Oleh Kravchenko wrote:
Hello Tom, for what reason it's not supported?
I'm finding that very useful for debugging.
Perhaps try -Og
Yes. There are several places where we rely on the code being optimized at run time, if memory serves me correctly. And unless you're debugging a compiler problem, disabling optimization is the wrong way to go, modern debuggers (with debug symbols available of course) will see what's going on and tell you so just fine. If you have some specific area of code / file, you might be able to get away with disabling optimization there alone. But no, in these times "disable optimization, fire up the debugger" just isn't the right path.
participants (3)
-
Oleh Kravchenko
-
Sean Anderson
-
Tom Rini