All of lore.kernel.org
 help / color / mirror / Atom feed
* U-boot is broken with -O0?
@ 2021-11-09 18:33 Oleh Kravchenko
  2021-11-09 18:52 ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Oleh Kravchenko @ 2021-11-09 18:33 UTC (permalink / raw)
  To: u-boot; +Cc: Simon Glass, Tom Rini, Ilias Apalodimas, Alexandru Gagniuc

[-- Attachment #1: Type: text/plain, Size: 521 bytes --]

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.

[-- Attachment #2: build.log --]
[-- Type: text/x-log, Size: 10246 bytes --]

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.o
make: *** [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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: U-boot is broken with -O0?
  2021-11-09 18:33 U-boot is broken with -O0? Oleh Kravchenko
@ 2021-11-09 18:52 ` Tom Rini
  2021-11-09 19:31   ` Oleh Kravchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Rini @ 2021-11-09 18:52 UTC (permalink / raw)
  To: Oleh Kravchenko; +Cc: u-boot, Simon Glass, Ilias Apalodimas, Alexandru Gagniuc

[-- Attachment #1: Type: text/plain, Size: 662 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: U-boot is broken with -O0?
  2021-11-09 18:52 ` Tom Rini
@ 2021-11-09 19:31   ` Oleh Kravchenko
  2021-11-09 19:34     ` Sean Anderson
  0 siblings, 1 reply; 5+ messages in thread
From: Oleh Kravchenko @ 2021-11-09 19:31 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, Simon Glass, Ilias Apalodimas, Alexandru Gagniuc

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: U-boot is broken with -O0?
  2021-11-09 19:31   ` Oleh Kravchenko
@ 2021-11-09 19:34     ` Sean Anderson
  2021-11-09 19:37       ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Sean Anderson @ 2021-11-09 19:34 UTC (permalink / raw)
  To: Oleh Kravchenko, Tom Rini
  Cc: u-boot, Simon Glass, Ilias Apalodimas, Alexandru Gagniuc

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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: U-boot is broken with -O0?
  2021-11-09 19:34     ` Sean Anderson
@ 2021-11-09 19:37       ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2021-11-09 19:37 UTC (permalink / raw)
  To: Sean Anderson
  Cc: Oleh Kravchenko, u-boot, Simon Glass, Ilias Apalodimas,
	Alexandru Gagniuc

[-- Attachment #1: Type: text/plain, Size: 821 bytes --]

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.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-09 19:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09 18:33 U-boot is broken with -O0? Oleh Kravchenko
2021-11-09 18:52 ` Tom Rini
2021-11-09 19:31   ` Oleh Kravchenko
2021-11-09 19:34     ` Sean Anderson
2021-11-09 19:37       ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.