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.
In file included from drivers/pci/pcie_brcmstb.c:21:
In function 'field_multiplier',
inlined from 'field_mask' at include/linux/bitfield.h:121:17,
inlined from 'u32_encode_bits' at include/linux/bitfield.h:153:1,
inlined from 'u32p_replace_bits' at include/linux/bitfield.h:153:1,
inlined from 'brcm_pcie_set_outbound_win' at drivers/pci/pcie_brcmstb.c:408:2:include/linux/bitfield.h:115:3: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
115 | __bad_mask();
| ^~~~~~~~~~~~In function 'field_multiplier',
inlined from 'u32_encode_bits' at include/linux/bitfield.h:153:1,
inlined from 'u32p_replace_bits' at include/linux/bitfield.h:153:1,
inlined from 'brcm_pcie_set_outbound_win' at drivers/pci/pcie_brcmstb.c:408:2:include/linux/bitfield.h:115:3: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
115 | __bad_mask();
| ^~~~~~~~~~~~In function 'field_multiplier',
inlined from 'field_mask' at include/linux/bitfield.h:121:17,
inlined from 'u32_encode_bits' at include/linux/bitfield.h:153:1,
inlined from 'u32p_replace_bits' at include/linux/bitfield.h:153:1,
inlined from 'brcm_pcie_set_outbound_win' at drivers/pci/pcie_brcmstb.c:410:2:include/linux/bitfield.h:115:3: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
115 | __bad_mask();
| ^~~~~~~~~~~~In function 'field_multiplier',
inlined from 'u32_encode_bits' at include/linux/bitfield.h:153:1,
inlined from 'u32p_replace_bits' at include/linux/bitfield.h:153:1,
inlined from 'brcm_pcie_set_outbound_win' at drivers/pci/pcie_brcmstb.c:410:2:include/linux/bitfield.h:115:3: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
115 | __bad_mask();
| ^~~~~~~~~~~~In function 'field_multiplier',
inlined from 'field_mask' at include/linux/bitfield.h:121:17,
inlined from 'u32_encode_bits' at include/linux/bitfield.h:153:1,
inlined from 'u32p_replace_bits' at include/linux/bitfield.h:153:1,
inlined from 'brcm_pcie_set_outbound_win' at drivers/pci/pcie_brcmstb.c:418:2:include/linux/bitfield.h:115:3: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
115 | __bad_mask();
| ^~~~~~~~~~~~In function 'field_multiplier',
inlined from 'u32_encode_bits' at include/linux/bitfield.h:153:1,
inlined from 'u32p_replace_bits' at include/linux/bitfield.h:153:1,
inlined from 'brcm_pcie_set_outbound_win' at drivers/pci/pcie_brcmstb.c:418:2:include/linux/bitfield.h:115:3: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
115 | __bad_mask();
| ^~~~~~~~~~~~In function 'field_multiplier',
inlined from 'field_mask' at include/linux/bitfield.h:121:17,
inlined from 'u32_encode_bits' at include/linux/bitfield.h:153:1,
inlined from 'u32p_replace_bits' at include/linux/bitfield.h:153:1,
inlined from 'brcm_pcie_set_outbound_win' at drivers/pci/pcie_brcmstb.c:424:2:include/linux/bitfield.h:115:3: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
115 | __bad_mask();
| ^~~~~~~~~~~~In function 'field_multiplier',
inlined from 'u32_encode_bits' at include/linux/bitfield.h:153:1,
inlined from 'u32p_replace_bits' at include/linux/bitfield.h:153:1,
inlined from 'brcm_pcie_set_outbound_win' at drivers/pci/pcie_brcmstb.c:424:2:include/linux/bitfield.h:115:3: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
115 | __bad_mask();
| ^~~~~~~~~~~~In function 'field_multiplier',
inlined from 'field_mask' at include/linux/bitfield.h:121:17,
inlined from 'u32_encode_bits' at include/linux/bitfield.h:153:1,
inlined from 'u32p_replace_bits' at include/linux/bitfield.h:153:1,
inlined from 'brcm_pcie_probe' at drivers/pci/pcie_brcmstb.c:478:2:include/linux/bitfield.h:115:3: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
115 | __bad_mask();
| ^~~~~~~~~~~~In function 'field_multiplier',
inlined from 'u32_encode_bits' at include/linux/bitfield.h:153:1,
inlined from 'u32p_replace_bits' at include/linux/bitfield.h:153:1,
inlined from 'brcm_pcie_probe' at drivers/pci/pcie_brcmstb.c:478:2:include/linux/bitfield.h:115:3: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
115 | __bad_mask();
| ^~~~~~~~~~~~In function 'field_multiplier',
inlined from 'field_mask' at include/linux/bitfield.h:121:17,
inlined from 'u32_encode_bits' at include/linux/bitfield.h:153:1,
inlined from 'u32p_replace_bits' at include/linux/bitfield.h:153:1,
inlined from 'brcm_pcie_probe' at drivers/pci/pcie_brcmstb.c:488:2:include/linux/bitfield.h:115:3: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
115 | __bad_mask();
| ^~~~~~~~~~~~In function 'field_multiplier',
inlined from 'u32_encode_bits' at include/linux/bitfield.h:153:1,
inlined from 'u32p_replace_bits' at include/linux/bitfield.h:153:1,
inlined from 'brcm_pcie_probe' at drivers/pci/pcie_brcmstb.c:488:2:include/linux/bitfield.h:115:3: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
115 | __bad_mask();
| ^~~~~~~~~~~~
LD drivers/rng/built-in.o
make[2]: *** [scripts/Makefile.build:266: drivers/pci/pcie_brcmstb.o] Error 1
make[1]: *** [scripts/Makefile.build:419: drivers/pci] Error 2
make[1]: *** Waiting for unfinished jobs....
CC drivers/usb/gadget/udc/udc-core.o
CC drivers/usb/host/usb-uclass.o
CC drivers/usb/host/xhci.o
CC drivers/usb/host/xhci-mem.o
CC drivers/usb/host/xhci-ring.o
CC drivers/usb/host/xhci-pci.o
CC fs/fs.o
CC fs/fs_internal.o
CC env/env.o
CC env/common.o
CC fs/fat/fat_write.o
LD drivers/video/built-in.o
CC fs/ext4/ext4fs.o
CC net/arp.omake: *** [Makefile:1730: drivers] Error 2
make: *** Waiting for unfinished jobs....
CC net/bootp.o
In file included from include/dm/device_compat.h:15,
from drivers/usb/gadget/udc/udc-core.c:16:drivers/usb/gadget/udc/udc-core.c: In function 'usb_gadget_remove_driver':include/linux/build_bug.h:67:51: error: size of unnamed array is negative
67 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
| ^include/dm/device_compat.h:87:3: note: in expansion of macro 'BUILD_BUG_ON'
87 | BUILD_BUG_ON(!__same_type(dev, struct udevice *)); \
| ^~~~~~~~~~~~
include/dm/device_compat.h:117:2: note: in expansion of macro '__dev_printk'
117 | __dev_printk(LOGL_DEBUG, dev, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/usb/gadget/udc/udc-core.c:227:2: note: in expansion of macro 'dev_dbg'
227 | dev_dbg(&udc->dev, "unregistering UDC driver [%s]\n",
| ^~~~~~~drivers/usb/gadget/udc/udc-core.c: In function 'usb_del_gadget_udc':include/linux/build_bug.h:67:51: error: size of unnamed array is negative
67 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
| ^include/dm/device_compat.h:87:3: note: in expansion of macro 'BUILD_BUG_ON'
87 | BUILD_BUG_ON(!__same_type(dev, struct udevice *)); \
| ^~~~~~~~~~~~
include/dm/device_compat.h:109:2: note: in expansion of macro '__dev_printk'
109 | __dev_printk(LOGL_ERR, dev, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/usb/gadget/udc/udc-core.c:254:2: note: in expansion of macro 'dev_err'
254 | dev_err(gadget->dev.parent, "gadget not registered.\n");
| ^~~~~~~include/linux/build_bug.h:67:51: error: size of unnamed array is negative
67 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
| ^include/dm/device_compat.h:87:3: note: in expansion of macro 'BUILD_BUG_ON'
87 | BUILD_BUG_ON(!__same_type(dev, struct udevice *)); \
| ^~~~~~~~~~~~
include/dm/device_compat.h:119:2: note: in expansion of macro '__dev_printk'
119 | __dev_printk(LOGL_DEBUG_CONTENT, dev, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/usb/gadget/udc/udc-core.c:260:2: note: in expansion of macro 'dev_vdbg'
260 | dev_vdbg(gadget->dev.parent, "unregistering gadget\n");
| ^~~~~~~~drivers/usb/gadget/udc/udc-core.c: In function 'udc_bind_to_driver':include/linux/build_bug.h:67:51: error: size of unnamed array is negative
67 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
| ^include/dm/device_compat.h:87:3: note: in expansion of macro 'BUILD_BUG_ON'
87 | BUILD_BUG_ON(!__same_type(dev, struct udevice *)); \
| ^~~~~~~~~~~~
include/dm/device_compat.h:117:2: note: in expansion of macro '__dev_printk'
117 | __dev_printk(LOGL_DEBUG, dev, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/usb/gadget/udc/udc-core.c:297:2: note: in expansion of macro 'dev_dbg'
297 | dev_dbg(&udc->dev, "registering UDC driver [%s]\n",
| ^~~~~~~include/linux/build_bug.h:67:51: error: size of unnamed array is negative
67 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
| ^include/dm/device_compat.h:87:3: note: in expansion of macro 'BUILD_BUG_ON'
87 | BUILD_BUG_ON(!__same_type(dev, struct udevice *)); \
| ^~~~~~~~~~~~
include/dm/device_compat.h:109:2: note: in expansion of macro '__dev_printk'
109 | __dev_printk(LOGL_ERR, dev, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/usb/gadget/udc/udc-core.c:317:3: note: in expansion of macro 'dev_err'
317 | dev_err(&udc->dev, "failed to start %s: %d\n",
| ^~~~~~~make[1]: *** [scripts/Makefile.build:266: drivers/usb/gadget/udc/udc-core.o] Error 1
make: *** [Makefile:1730: drivers/usb/gadget/udc] Error 2
Quoted 5 lines · Oleh Kravchenko
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
Quoted 8 lines
Here the commands how to quickly reprodice the problem:
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnueabi- export KCFLAGS=-O0
makerpi_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.
Signature · 1 line
Tom
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
Quoted 23 lines
9 лист. 2021 р. о 20:52 Tom Rini <[email protected]> пише:
Quoted 5 lines · Oleh Kravchenko
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
Quoted 8 lines
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.
Signature · 1 line
Tom
Hi Oleh,
Quoted 4 lines · Oleh Kravchenko
Hello Tom,
for what reason it's not supported?I'm finding that very useful for debugging.
Perhaps try -Og
--Sean
Quoted 32 lines
Only a few issues with conditional compilation breaks it.
Also this issue reproducible if -DDEBUG=1 is used.
--
Best regards,
Oleh KravchenkoQuoted 23 lines
9 лист. 2021 р. о 20:52 Tom Rini <[email protected]> пише:
Quoted 5 lines · Oleh Kravchenko
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
Quoted 8 lines
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.
Signature · 1 line
Tom
Quoted 9 lines · Sean Anderson
Hi Oleh,
Quoted 4 lines · Oleh Kravchenko
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.
Signature · 1 line
Tom