clang-14 fixes
cover clang-14 fixes
This series contains a few clang-14 fixes to partly resolve the problems shown by [1].
The event_dump problem is that the symbol name is not printed by addr2line even though it seems to be present:
Without LTO:
$ addr2line -e u-boot.clang14.no-lto 4a37f addr2line: DWARF error: invalid or unhandled FORM value: 0x23 vbe_simple.c:?
$ nm u-boot.clang14.no-lto |grep 4a37f 000000000004a37f t bootmeth_vbe_simple_ft_fixup
With LTO is even worse:
$ addr2line -e u-boot.clang14.lto 2d2ee0 addr2line: DWARF error: invalid or unhandled FORM value: 0x23 ??:0
$ nm u-boot.clang14.lto |grep 4dad1 000000000004dad1 t bootmeth_vbe_simple_ft_fixup
Perhaps this is a bug in addr2line or the clang DWARF output?
[1] https://source.denx.de/u-boot/u-boot/-/jobs/510282#L287
Simon Glass (3):
dm: core: Fix lists_bind_fdt() using non-existent of_match
event: Drop the path when checking event-list filenames
test: Drop unwanted option in event_dump.py
drivers/core/lists.c | 4 +++- scripts/event_dump.py | 2 -- test/py/tests/test_event_dump.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.38.0.rc1.362.ged0d419d3c-goog
PATCH 1/3 dm: core: Fix lists_bind_fdt() using non-existent of_match
The call to device_bind_with_driver_data() passes id->data but if the entry has no of_match then the id has not been set by the selected driver.
Normally this passes unnoticed since a previous driver likely had an of_match value, so the id is set to that. Of course it is not correct to pass the id->data from a different driver.
With clang-14 the driver ordering is such that the id is never actually set in the 'bind /usb@1 usb_ether' line in test_bind_unbind_with_node() thus causing a crash.
Fix this by passing 0 if the of_match for a driver does not exist.
---
drivers/core/lists.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/core/lists.c +3 -1
@@ -222,6 +222,7 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp,log_debug (" - attempt to match compatible string '%s'\n" , compat); + id =NULL ;for (entry = driver; entry != driver + n_ents; entry++) {if (drv) {if (drv != entry)
@@ -250,7 +251,8 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp, entry->name, entry->of_match->compatible, id->compatible); ret =device_bind_with_driver_data (parent, entry, name, - id->data, node, &dev); + id ? id->data :0 , node, + &dev);if (ret == -ENODEV ) {log_debug ("Driver '%s' refuses to bind\n" , entry->name);continue ;
Signature · 1 line
2.38.0.rc1.362.ged0d419d3c-goog
Re: [PATCH 1/3] dm: core: Fix lists_bind_fdt() using non-existent of_match
The call to device_bind_with_driver_data() passes id->data but if the entry has no of_match then the id has not been set by the selected driver.
Normally this passes unnoticed since a previous driver likely had an of_match value, so the id is set to that. Of course it is not correct to pass the id->data from a different driver.
With clang-14 the driver ordering is such that the id is never actually set in the 'bind /usb@1 usb_ether' line in test_bind_unbind_with_node() thus causing a crash.
Fix this by passing 0 if the of_match for a driver does not exist.
---
drivers/core/lists.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Applied to u-boot-dm, thanks!
PATCH 2/3 event: Drop the path when checking event-list filenames
In reply to Simon GlassThis path does not seem to be present in clang-14 for some reason. Relax the regular expression so that the test works, at least for non-LTO.
---
test/py/tests/test_event_dump.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
test/py/tests/test_event_dump.py +2 -2
@@ -16,6 +16,6 @@ def test_event_dump(u_boot_console): out = util.run_and_log(cons, ['scripts/event_dump.py', sandbox]) expect = '''.*Event type Id Source location -------------------- ------------------------------ ------------------------------ -EVT_FT_FIXUP bootmeth_vbe_simple_ft_fixup .*boot/vbe_simple.c:.* -EVT_MISC_INIT_F sandbox_misc_init_f .*arch/sandbox/cpu/start.c:''' +EVT_FT_FIXUP bootmeth_vbe_simple_ft_fixup .*vbe_simple.c:.* +EVT_MISC_INIT_F sandbox_misc_init_f .*start.c:''' assert re.match(expect, out, re.MULTILINE) is not None
Signature · 1 line
2.38.0.rc1.362.ged0d419d3c-goog
Re: [PATCH 2/3] event: Drop the path when checking event-list filenames
This path does not seem to be present in clang-14 for some reason. Relax the regular expression so that the test works, at least for non-LTO.
---
test/py/tests/test_event_dump.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Applied to u-boot-dm, thanks!
PATCH 3/3 test: Drop unwanted option in event_dump.py
In reply to Simon GlassThis option is not used. Drop it.
---
scripts/event_dump.py | 2 -- 1 file changed, 2 deletions(-)
scripts/event_dump.py +0 -2
@@ -108,8 +108,6 @@ def main(argv): parser.add_argument('elf', type=str, help='ELF file to decode') parser.add_argument('-e', '--endian', type=str, default='auto', help='Big-endian image') - parser.add_argument('-t', '--test', action='store_true', - help='Big-endian image') args = parser.parse_args(argv) show_event_spy_list(args.elf, args.endian)
Signature · 1 line
2.38.0.rc1.362.ged0d419d3c-goog
Re: [PATCH 3/3] test: Drop unwanted option in event_dump.py
This option is not used. Drop it.
---
scripts/event_dump.py | 2 -- 1 file changed, 2 deletions(-)
Applied to u-boot-dm, thanks!
Hi Tom,
Quoted 22 lines · Simon Glass
This series contains a few clang-14 fixes to partly resolve the problems shown by [1].
The
event_dumpproblem is that the symbol name is not printed by addr2line even though it seems to be present:Without LTO:
$ addr2line -e u-boot.clang14.no-lto 4a37f addr2line: DWARF error: invalid or unhandled FORM value: 0x23 vbe_simple.c:?$ nm u-boot.clang14.no-lto |grep 4a37f 000000000004a37f t bootmeth_vbe_simple_ft_fixupWith LTO is even worse:
$ addr2line -e u-boot.clang14.lto 2d2ee0 addr2line: DWARF error: invalid or unhandled FORM value: 0x23 ??:0
Quoted 6 lines
$ nm u-boot.clang14.lto |grep 4dad1 000000000004dad1 t bootmeth_vbe_simple_ft_fixupPerhaps this is a bug in addr2line or the clang DWARF output?
I should have mentioned that I can respin the series to deal with this, perhaps by not requiring the function name to be present when clang is used (or just at all?)
Plus I have one more patch to add for the LTO stuff.
Let me know what you think and I can respin this this.
Quoted 7 lines
Simon Glass (3):
dm: core: Fixlists_bind_fdt()using non-existentof_match
event: Drop the path when checking event-list filenames
test: Drop unwanted option inevent_dump.py
Quoted 8 lines
drivers/core/lists.c | 4 +++- scripts/event_dump.py | 2 -- test/py/tests/test_event_dump.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-)--
2.38.0.rc1.362.ged0d419d3c-goog
Regards,
Simon
Quoted 32 lines · Simon Glass
Hi Tom,
Quoted 22 lines · Simon Glass
This series contains a few clang-14 fixes to partly resolve the problems shown by [1].
The
event_dumpproblem is that the symbol name is not printed by addr2line even though it seems to be present:Without LTO:
$ addr2line -e u-boot.clang14.no-lto 4a37f addr2line: DWARF error: invalid or unhandled FORM value: 0x23 vbe_simple.c:?$ nm u-boot.clang14.no-lto |grep 4a37f 000000000004a37f t bootmeth_vbe_simple_ft_fixupWith LTO is even worse:
$ addr2line -e u-boot.clang14.lto 2d2ee0 addr2line: DWARF error: invalid or unhandled FORM value: 0x23 ??:0Quoted 6 lines
$ nm u-boot.clang14.lto |grep 4dad1 000000000004dad1 t bootmeth_vbe_simple_ft_fixupPerhaps this is a bug in addr2line or the clang DWARF output?
Quoted 7 lines
I should have mentioned that I can respin the series to deal with this, perhaps by not requiring the function name to be present when clang is used (or just at all?)
Plus I have one more patch to add for the LTO stuff.
Let me know what you think and I can respin this this.
Maybe it's worth raising a question on one of the LLVM lists? This seems fairly odd.
I would like to move to LLVM-14 / gcc-12.2 for CI, for v2023.01, but there's still other warnings to be fixed too, so we have a little time yet.
Signature · 1 line
Tom
Hi Tom,
Quoted 40 lines · Tom Rini
Quoted 38 lines · Simon Glass
Hi Tom,
Quoted 22 lines · Simon Glass
This series contains a few clang-14 fixes to partly resolve the problems shown by [1].
The
event_dumpproblem is that the symbol name is not printed by addr2line even though it seems to be present:Without LTO:
$ addr2line -e u-boot.clang14.no-lto 4a37f addr2line: DWARF error: invalid or unhandled FORM value: 0x23 vbe_simple.c:?$ nm u-boot.clang14.no-lto |grep 4a37f 000000000004a37f t bootmeth_vbe_simple_ft_fixupWith LTO is even worse:
$ addr2line -e u-boot.clang14.lto 2d2ee0 addr2line: DWARF error: invalid or unhandled FORM value: 0x23 ??:0Quoted 6 lines
$ nm u-boot.clang14.lto |grep 4dad1 000000000004dad1 t bootmeth_vbe_simple_ft_fixupPerhaps this is a bug in addr2line or the clang DWARF output?
I should have mentioned that I can respin the series to deal with this, perhaps by not requiring the function name to be present when clang is used (or just at all?)
Plus I have one more patch to add for the LTO stuff.
Quoted 8 lines
Quoted 1 line
Let me know what you think and I can respin this this.
Maybe it's worth raising a question on one of the LLVM lists? This seems fairly odd.
I would like to move to LLVM-14 / gcc-12.2 for CI, for v2023.01, but there's still other warnings to be fixed too, so we have a little time yet.
It looks like you fixed this with the dwarf change.
Regards,
Simon
Quoted 45 lines · Simon Glass
Hi Tom,
Quoted 42 lines · Tom Rini
Quoted 39 lines · Simon Glass
Hi Tom,
Quoted 22 lines · Simon Glass
This series contains a few clang-14 fixes to partly resolve the problems shown by [1].
The
event_dumpproblem is that the symbol name is not printed by addr2line even though it seems to be present:Without LTO:
$ addr2line -e u-boot.clang14.no-lto 4a37f addr2line: DWARF error: invalid or unhandled FORM value: 0x23 vbe_simple.c:?$ nm u-boot.clang14.no-lto |grep 4a37f 000000000004a37f t bootmeth_vbe_simple_ft_fixupWith LTO is even worse:
$ addr2line -e u-boot.clang14.lto 2d2ee0 addr2line: DWARF error: invalid or unhandled FORM value: 0x23 ??:0Quoted 6 lines
$ nm u-boot.clang14.lto |grep 4dad1 000000000004dad1 t bootmeth_vbe_simple_ft_fixupPerhaps this is a bug in addr2line or the clang DWARF output?
I should have mentioned that I can respin the series to deal with this, perhaps by not requiring the function name to be present when clang is used (or just at all?)
Plus I have one more patch to add for the LTO stuff.
Let me know what you think and I can respin this this.
Quoted 8 lines
Quoted 6 lines
Maybe it's worth raising a question on one of the LLVM lists? This seems fairly odd.
I would like to move to LLVM-14 / gcc-12.2 for CI, for v2023.01, but there's still other warnings to be fixed too, so we have a little time yet.
It looks like you fixed this with the dwarf change.
Yes, the dwarf change addresses this, and I'll be picking that up for next as well.
Signature · 1 line
Tom