* Question: LTO and failing objcopy in "u-boot-initial-env" target
@ 2021-10-22 15:16 Patrick DELAUNAY
2021-10-22 19:19 ` Adam Ford
2021-10-22 19:25 ` Marek Behún
0 siblings, 2 replies; 6+ messages in thread
From: Patrick DELAUNAY @ 2021-10-22 15:16 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Tom Rini, Marek Behún, Simon Glass, Patrice CHOTARD,
Marek Vasut, U-Boot STM32
Hi,
I made tests with LTO option activated on stm32mp15 boards but if have a
issue
with the U-Boot target "u-boot-initial-env" (this command used by YOCTO)
$> make u-boot-initial-env
...
GENENV u-boot-initial-env
arm-none-linux-gnueabihf-objcopy: env/common.o: can't dump section
'.rodata.default_environment' - it does not exist: file format not
recognized
sed: can't read u-boot-initial-env: No such file or directory
make[1]: *** [/local/home/frq07632/views/u-boot/Makefile:2315:
u-boot-initial-env] Error 2
make[1]: Leaving directory
'/local/home/frq07632/views/build/stm32mp15_defconfig'
make: *** [Makefile:177: sub-make] Error 2
But I reproduced it with sandbox:
$> make sandbox_defconfig
$> make all
$> make u-boot-initial-env
....
LTO u-boot
OBJCOPY u-boot-nodtb.bin
COPY u-boot.bin
GENENV u-boot-initial-env
objcopy: env/common.o: can't dump section '.rodata.default_environment'
- it does not exist: file format not recognized
sed: can't read u-boot-initial-env: No such file or directory
make: *** [Makefile:2315: u-boot-initial-env] Error 2
Do you already know this issue for other board which activate the LTO
feature ?
I don't see any remarks about this issue on mailing list.
Today I am known how to solve this issue.
PS: The same command is executed in "scripts/get_default_envs.sh"
Regards
Patrick
I am ussing gcc 10.2
gcc version 10.2.1 20201103 (GNU Toolchain for the A-profile
Architecture 10.2-2020.11 (arm-10.16))
And the name of the section change with LTO: .gnu.lto_default_environment.*
for exmaple:
$> arm-none-linux-gnueabihf-objdump -x -g -S common.o
common.o: file format elf32-littlearm
common.o
architecture: armv7, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000
private flags = 5000000: [Version5 EABI]
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000000 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000000 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000000 00000000 00000000 00000034 2**0
ALLOC
3 .gnu.debuglto_.debug_info 000010a5 00000000 00000000 00000034 2**0
CONTENTS, RELOC, READONLY, EXCLUDE
4 .gnu.debuglto_.debug_abbrev 000002a1 00000000 00000000 000010d9 2**0
CONTENTS, READONLY, EXCLUDE
5 .gnu.debuglto_.debug_line 00000214 00000000 00000000 0000137a 2**0
CONTENTS, READONLY, EXCLUDE
6 .gnu.debuglto_.debug_str 000012e3 00000000 00000000 0000158e 2**0
CONTENTS, READONLY, EXCLUDE
7 .gnu.lto_.profile.69d69ac49136740e 0000000b 00000000 00000000
00002871 2**0
CONTENTS, READONLY, EXCLUDE
8 .gnu.lto_.icf.69d69ac49136740e 0000007b 00000000 00000000
0000287c 2**0
CONTENTS, READONLY, EXCLUDE
9 .gnu.lto_.ipa_sra.69d69ac49136740e 0000008c 00000000 00000000
000028f7 2**0
CONTENTS, READONLY, EXCLUDE
10 .gnu.lto_.inline.69d69ac49136740e 000002bc 00000000 00000000
00002983 2**0
CONTENTS, READONLY, EXCLUDE
11 .gnu.lto_.jmpfuncs.69d69ac49136740e 0000031c 00000000 00000000
00002c3f 2**0
CONTENTS, READONLY, EXCLUDE
12 .gnu.lto_.pureconst.69d69ac49136740e 0000002f 00000000 00000000
00002f5b 2**0
CONTENTS, READONLY, EXCLUDE
13 .gnu.lto_.lto.69d69ac49136740e 00000008 00000000 00000000
00002f8a 2**0
CONTENTS, READONLY, EXCLUDE
14 .gnu.lto_default_environment.154.69d69ac49136740e 00000507
00000000 00000000 00002f92 2**0
CONTENTS, READONLY, EXCLUDE
15 .gnu.lto_env_htab.155.69d69ac49136740e 00000062 00000000 00000000
00003499 2**0
CONTENTS, READONLY, EXCLUDE
16 .gnu.lto_env_get_yesno.156.69d69ac49136740e 00000244 00000000
00000000 000034fb 2**0
CONTENTS, READONLY, EXCLUDE
17 .gnu.lto_env_get_default.157.69d69ac49136740e 000003dc 00000000
00000000 0000373f 2**0
CONTENTS, READONLY, EXCLUDE
18 .gnu.lto_env_set_default.158.69d69ac49136740e 000004bf 00000000
00000000 00003b1b 2**0
CONTENTS, READONLY, EXCLUDE
19 .gnu.lto_env_set_default_vars.159.69d69ac49136740e 000001c1
00000000 00000000 00003fda 2**0
CONTENTS, READONLY, EXCLUDE
20 .gnu.lto_env_import.160.69d69ac49136740e 00000582 00000000
00000000 0000419b 2**0
CONTENTS, READONLY, EXCLUDE
21 .gnu.lto_env_check_redund.162.69d69ac49136740e 0000088a 00000000
00000000 0000471d 2**0
CONTENTS, READONLY, EXCLUDE
22 .gnu.lto_env_import_redund.163.69d69ac49136740e 00000461 00000000
00000000 00004fa7 2**0
CONTENTS, READONLY, EXCLUDE
23 .gnu.lto_env_export.164.69d69ac49136740e 000003a0 00000000
00000000 00005408 2**0
CONTENTS, READONLY, EXCLUDE
24 .gnu.lto_env_relocate.165.69d69ac49136740e 00000231 00000000
00000000 000057a8 2**0
CONTENTS, READONLY, EXCLUDE
25 .gnu.lto_env_complete.166.69d69ac49136740e 00000880 00000000
00000000 000059d9 2**0
CONTENTS, READONLY, EXCLUDE
26 .gnu.lto_env_relocate.part.0.203.69d69ac49136740e 000001ab
00000000 00000000 00006259 2**0
CONTENTS, READONLY, EXCLUDE
27 .gnu.lto_.symbol_nodes.69d69ac49136740e 000001f2 00000000
00000000 00006404 2**0
CONTENTS, READONLY, EXCLUDE
28 .gnu.lto_.refs.69d69ac49136740e 0000004f 00000000 00000000
000065f6 2**0
CONTENTS, READONLY, EXCLUDE
29 .gnu.lto_.decls.69d69ac49136740e 00001fbf 00000000 00000000
00006645 2**0
CONTENTS, READONLY, EXCLUDE
30 .gnu.lto_.symtab.69d69ac49136740e 000002de 00000000 00000000
00008604 2**0
CONTENTS, READONLY, EXCLUDE
31 .gnu.lto_.ext_symtab.69d69ac49136740e 00000039 00000000 00000000
000088e2 2**0
CONTENTS, READONLY, EXCLUDE
32 .gnu.lto_.opts 000001d6 00000000 00000000 0000891b 2**0
CONTENTS, READONLY, EXCLUDE
33 .comment 0000005e 00000000 00000000 00008af1 2**0
CONTENTS, READONLY
34 .note.GNU-stack 00000000 00000000 00000000 00008b4f 2**0
CONTENTS, READONLY
35 .ARM.attributes 00000031 00000000 00000000 00008b4f 2**0
CONTENTS, READONLY
SYMBOL TABLE:
00000000 l df *ABS* 00000000 common.c
00000000 l d .text 00000000 .text
00000000 l d .data 00000000 .data
00000000 l d .bss 00000000 .bss
00000000 l d .gnu.debuglto_.debug_info 00000000
.gnu.debuglto_.debug_info
00000000 l d .gnu.debuglto_.debug_abbrev 00000000
.gnu.debuglto_.debug_abbrev
00000000 l d .gnu.debuglto_.debug_line 00000000
.gnu.debuglto_.debug_line
00000000 l d .gnu.debuglto_.debug_str 00000000
.gnu.debuglto_.debug_str
00000000 l d .gnu.lto_.profile.69d69ac49136740e 00000000
.gnu.lto_.profile.69d69ac49136740e
00000000 l d .gnu.lto_.icf.69d69ac49136740e 00000000
.gnu.lto_.icf.69d69ac49136740e
00000000 l d .gnu.lto_.ipa_sra.69d69ac49136740e 00000000
.gnu.lto_.ipa_sra.69d69ac49136740e
00000000 l d .gnu.lto_.inline.69d69ac49136740e 00000000
.gnu.lto_.inline.69d69ac49136740e
00000000 l d .gnu.lto_.jmpfuncs.69d69ac49136740e 00000000
.gnu.lto_.jmpfuncs.69d69ac49136740e
00000000 l d .gnu.lto_.pureconst.69d69ac49136740e 00000000
.gnu.lto_.pureconst.69d69ac49136740e
00000000 l d .gnu.lto_.lto.69d69ac49136740e 00000000
.gnu.lto_.lto.69d69ac49136740e
00000000 l d .gnu.lto_default_environment.154.69d69ac49136740e
00000000 .gnu.lto_default_environment.154.69d69ac49136740e
00000000 l d .gnu.lto_env_htab.155.69d69ac49136740e00000000
.gnu.lto_env_htab.155.69d69ac49136740e
00000000 l d .gnu.lto_env_get_yesno.156.69d69ac49136740e 00000000
.gnu.lto_env_get_yesno.156.69d69ac49136740e
00000000 l d .gnu.lto_env_get_default.157.69d69ac49136740e 00000000
.gnu.lto_env_get_default.157.69d69ac49136740e
00000000 l d .gnu.lto_env_set_default.158.69d69ac49136740e 00000000
.gnu.lto_env_set_default.158.69d69ac49136740e
00000000 l d .gnu.lto_env_set_default_vars.159.69d69ac49136740e
00000000 .gnu.lto_env_set_default_vars.159.69d69ac49136740e
00000000 l d .gnu.lto_env_import.160.69d69ac49136740e 00000000
.gnu.lto_env_import.160.69d69ac49136740e
00000000 l d .gnu.lto_env_check_redund.162.69d69ac49136740e 00000000
.gnu.lto_env_check_redund.162.69d69ac49136740e
00000000 l d .gnu.lto_env_import_redund.163.69d69ac49136740e
00000000 .gnu.lto_env_import_redund.163.69d69ac49136740e
00000000 l d .gnu.lto_env_export.164.69d69ac49136740e 00000000
.gnu.lto_env_export.164.69d69ac49136740e
00000000 l d .gnu.lto_env_relocate.165.69d69ac49136740e 00000000
.gnu.lto_env_relocate.165.69d69ac49136740e
00000000 l d .gnu.lto_env_complete.166.69d69ac49136740e 00000000
.gnu.lto_env_complete.166.69d69ac49136740e
00000000 l d .gnu.lto_env_relocate.part.0.203.69d69ac49136740e
00000000 .gnu.lto_env_relocate.part.0.203.69d69ac49136740e
00000000 l d .gnu.lto_.symbol_nodes.69d69ac49136740e 00000000
.gnu.lto_.symbol_nodes.69d69ac49136740e
00000000 l d .gnu.lto_.refs.69d69ac49136740e 00000000
.gnu.lto_.refs.69d69ac49136740e
00000000 l d .gnu.lto_.decls.69d69ac49136740e 00000000
.gnu.lto_.decls.69d69ac49136740e
00000000 l d .gnu.lto_.symtab.69d69ac49136740e 00000000
.gnu.lto_.symtab.69d69ac49136740e
00000000 l d .gnu.lto_.ext_symtab.69d69ac49136740e 00000000
.gnu.lto_.ext_symtab.69d69ac49136740e
00000000 l d .gnu.lto_.opts 00000000 .gnu.lto_.opts
00000000 l d .note.GNU-stack 00000000 .note.GNU-stack
00000000 l d .comment 00000000 .comment
00000000 l d .ARM.attributes 00000000 .ARM.attributes
00000000 w .gnu.debuglto_.debug_info 00000000 .hidden
common.c.2c9afba8
00000001 O *COM* 00000001 __gnu_lto_slim
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Question: LTO and failing objcopy in "u-boot-initial-env" target
2021-10-22 15:16 Question: LTO and failing objcopy in "u-boot-initial-env" target Patrick DELAUNAY
@ 2021-10-22 19:19 ` Adam Ford
2021-10-22 19:26 ` Marek Behún
2021-10-22 19:25 ` Marek Behún
1 sibling, 1 reply; 6+ messages in thread
From: Adam Ford @ 2021-10-22 19:19 UTC (permalink / raw)
To: Patrick DELAUNAY
Cc: U-Boot Mailing List, Tom Rini, Marek Behún, Simon Glass,
Patrice CHOTARD, Marek Vasut, U-Boot STM32
On Fri, Oct 22, 2021 at 10:16 AM Patrick DELAUNAY
<patrick.delaunay@foss.st.com> wrote:
>
> Hi,
>
>
> I made tests with LTO option activated on stm32mp15 boards but if have a
> issue
>
> with the U-Boot target "u-boot-initial-env" (this command used by YOCTO)
>
>
> $> make u-boot-initial-env
>
> ...
>
> GENENV u-boot-initial-env
> arm-none-linux-gnueabihf-objcopy: env/common.o: can't dump section
> '.rodata.default_environment' - it does not exist: file format not
> recognized
> sed: can't read u-boot-initial-env: No such file or directory
> make[1]: *** [/local/home/frq07632/views/u-boot/Makefile:2315:
> u-boot-initial-env] Error 2
> make[1]: Leaving directory
> '/local/home/frq07632/views/build/stm32mp15_defconfig'
> make: *** [Makefile:177: sub-make] Error 2
>
>
> But I reproduced it with sandbox:
>
> $> make sandbox_defconfig
>
> $> make all
>
> $> make u-boot-initial-env
>
> ....
>
> LTO u-boot
> OBJCOPY u-boot-nodtb.bin
> COPY u-boot.bin
> GENENV u-boot-initial-env
> objcopy: env/common.o: can't dump section '.rodata.default_environment'
> - it does not exist: file format not recognized
> sed: can't read u-boot-initial-env: No such file or directory
> make: *** [Makefile:2315: u-boot-initial-env] Error 2
>
>
>
> Do you already know this issue for other board which activate the LTO
> feature ?
>
> I don't see any remarks about this issue on mailing list.
>
> Today I am known how to solve this issue.
I ran this:
arm-linux-gnueabihf-objdump env/common.o -t |grep default_environment
|awk '{print $4}'
to generate the name of the section:
.gnu.lto_default_environment.188.408aacacdb8e4907
I modified the Makefile to search for default_environment, then use
output of that as a parameter to $OBJCOPY, and that appears to work.
=====
diff --git a/Makefile b/Makefile
index 5194e4dc78..a80cf94ba1 100644
--- a/Makefile
+++ b/Makefile
@@ -2303,7 +2303,7 @@ endif
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
quiet_cmd_genenv = GENENV $@
-cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@
env/common.o; \
+cmd_genenv = $(OBJCOPY) --dump-section `${OBJDUMP} env/common.o -t
|grep default_environment |awk '{print $$4}'`=$@ env/common.o; \
sed --in-place -e 's/\x00/\x0A/g' $@
u-boot-initial-env: u-boot.bin
=====
...
make -f ./scripts/Makefile.build obj=arch/arm/dts dtbs
test -e arch/arm/dts/logicpd-torpedo-37xx-devkit.dtb || ( \
echo >&2; \
echo >&2 "Device Tree Source
(arch/arm/dts/logicpd-torpedo-37xx-devkit.dtb) is not correctly
specified."; \
echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'"; \
echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument"; \
echo >&2; \
/bin/false)
cat u-boot-nodtb.bin dts/dt.dtb > u-boot-dtb.bin
cp u-boot-dtb.bin u-boot.bin
arm-linux-gnueabihf-objcopy --dump-section
`arm-linux-gnueabihf-objdump env/common.o -t |grep default_environment
|awk '{print $4}'`=u-boot-initial-env env/common.o; sed --in-place -e
's/\x00/\x0A/g' u-boot-initial-env
$ ls -l u-boot-initial-env
-rw-rw-r-- 1 aford aford 1202 Oct 22 14:16 u-boot-initial-env
I am not sure it's the right solution, but it appears to work for me
on a board that uses LTO. I didn't try it with a board that doesn't
use LTO.
adam
>
>
> PS: The same command is executed in "scripts/get_default_envs.sh"
>
>
> Regards
>
> Patrick
>
>
>
> I am ussing gcc 10.2
>
> gcc version 10.2.1 20201103 (GNU Toolchain for the A-profile
> Architecture 10.2-2020.11 (arm-10.16))
>
>
> And the name of the section change with LTO: .gnu.lto_default_environment.*
>
> for exmaple:
>
>
> $> arm-none-linux-gnueabihf-objdump -x -g -S common.o
>
> common.o: file format elf32-littlearm
> common.o
> architecture: armv7, flags 0x00000011:
> HAS_RELOC, HAS_SYMS
> start address 0x00000000
> private flags = 5000000: [Version5 EABI]
>
> Sections:
> Idx Name Size VMA LMA File off Algn
> 0 .text 00000000 00000000 00000000 00000034 2**0
> CONTENTS, ALLOC, LOAD, READONLY, CODE
> 1 .data 00000000 00000000 00000000 00000034 2**0
> CONTENTS, ALLOC, LOAD, DATA
> 2 .bss 00000000 00000000 00000000 00000034 2**0
> ALLOC
> 3 .gnu.debuglto_.debug_info 000010a5 00000000 00000000 00000034 2**0
> CONTENTS, RELOC, READONLY, EXCLUDE
> 4 .gnu.debuglto_.debug_abbrev 000002a1 00000000 00000000 000010d9 2**0
> CONTENTS, READONLY, EXCLUDE
> 5 .gnu.debuglto_.debug_line 00000214 00000000 00000000 0000137a 2**0
> CONTENTS, READONLY, EXCLUDE
> 6 .gnu.debuglto_.debug_str 000012e3 00000000 00000000 0000158e 2**0
> CONTENTS, READONLY, EXCLUDE
> 7 .gnu.lto_.profile.69d69ac49136740e 0000000b 00000000 00000000
> 00002871 2**0
> CONTENTS, READONLY, EXCLUDE
> 8 .gnu.lto_.icf.69d69ac49136740e 0000007b 00000000 00000000
> 0000287c 2**0
> CONTENTS, READONLY, EXCLUDE
> 9 .gnu.lto_.ipa_sra.69d69ac49136740e 0000008c 00000000 00000000
> 000028f7 2**0
> CONTENTS, READONLY, EXCLUDE
> 10 .gnu.lto_.inline.69d69ac49136740e 000002bc 00000000 00000000
> 00002983 2**0
> CONTENTS, READONLY, EXCLUDE
> 11 .gnu.lto_.jmpfuncs.69d69ac49136740e 0000031c 00000000 00000000
> 00002c3f 2**0
> CONTENTS, READONLY, EXCLUDE
> 12 .gnu.lto_.pureconst.69d69ac49136740e 0000002f 00000000 00000000
> 00002f5b 2**0
> CONTENTS, READONLY, EXCLUDE
> 13 .gnu.lto_.lto.69d69ac49136740e 00000008 00000000 00000000
> 00002f8a 2**0
> CONTENTS, READONLY, EXCLUDE
> 14 .gnu.lto_default_environment.154.69d69ac49136740e 00000507
> 00000000 00000000 00002f92 2**0
> CONTENTS, READONLY, EXCLUDE
> 15 .gnu.lto_env_htab.155.69d69ac49136740e 00000062 00000000 00000000
> 00003499 2**0
> CONTENTS, READONLY, EXCLUDE
> 16 .gnu.lto_env_get_yesno.156.69d69ac49136740e 00000244 00000000
> 00000000 000034fb 2**0
> CONTENTS, READONLY, EXCLUDE
> 17 .gnu.lto_env_get_default.157.69d69ac49136740e 000003dc 00000000
> 00000000 0000373f 2**0
> CONTENTS, READONLY, EXCLUDE
> 18 .gnu.lto_env_set_default.158.69d69ac49136740e 000004bf 00000000
> 00000000 00003b1b 2**0
> CONTENTS, READONLY, EXCLUDE
> 19 .gnu.lto_env_set_default_vars.159.69d69ac49136740e 000001c1
> 00000000 00000000 00003fda 2**0
> CONTENTS, READONLY, EXCLUDE
> 20 .gnu.lto_env_import.160.69d69ac49136740e 00000582 00000000
> 00000000 0000419b 2**0
> CONTENTS, READONLY, EXCLUDE
> 21 .gnu.lto_env_check_redund.162.69d69ac49136740e 0000088a 00000000
> 00000000 0000471d 2**0
> CONTENTS, READONLY, EXCLUDE
> 22 .gnu.lto_env_import_redund.163.69d69ac49136740e 00000461 00000000
> 00000000 00004fa7 2**0
> CONTENTS, READONLY, EXCLUDE
> 23 .gnu.lto_env_export.164.69d69ac49136740e 000003a0 00000000
> 00000000 00005408 2**0
> CONTENTS, READONLY, EXCLUDE
> 24 .gnu.lto_env_relocate.165.69d69ac49136740e 00000231 00000000
> 00000000 000057a8 2**0
> CONTENTS, READONLY, EXCLUDE
> 25 .gnu.lto_env_complete.166.69d69ac49136740e 00000880 00000000
> 00000000 000059d9 2**0
> CONTENTS, READONLY, EXCLUDE
> 26 .gnu.lto_env_relocate.part.0.203.69d69ac49136740e 000001ab
> 00000000 00000000 00006259 2**0
> CONTENTS, READONLY, EXCLUDE
> 27 .gnu.lto_.symbol_nodes.69d69ac49136740e 000001f2 00000000
> 00000000 00006404 2**0
> CONTENTS, READONLY, EXCLUDE
> 28 .gnu.lto_.refs.69d69ac49136740e 0000004f 00000000 00000000
> 000065f6 2**0
> CONTENTS, READONLY, EXCLUDE
> 29 .gnu.lto_.decls.69d69ac49136740e 00001fbf 00000000 00000000
> 00006645 2**0
> CONTENTS, READONLY, EXCLUDE
> 30 .gnu.lto_.symtab.69d69ac49136740e 000002de 00000000 00000000
> 00008604 2**0
> CONTENTS, READONLY, EXCLUDE
> 31 .gnu.lto_.ext_symtab.69d69ac49136740e 00000039 00000000 00000000
> 000088e2 2**0
> CONTENTS, READONLY, EXCLUDE
> 32 .gnu.lto_.opts 000001d6 00000000 00000000 0000891b 2**0
> CONTENTS, READONLY, EXCLUDE
> 33 .comment 0000005e 00000000 00000000 00008af1 2**0
> CONTENTS, READONLY
> 34 .note.GNU-stack 00000000 00000000 00000000 00008b4f 2**0
> CONTENTS, READONLY
> 35 .ARM.attributes 00000031 00000000 00000000 00008b4f 2**0
> CONTENTS, READONLY
> SYMBOL TABLE:
> 00000000 l df *ABS* 00000000 common.c
> 00000000 l d .text 00000000 .text
> 00000000 l d .data 00000000 .data
> 00000000 l d .bss 00000000 .bss
> 00000000 l d .gnu.debuglto_.debug_info 00000000
> .gnu.debuglto_.debug_info
> 00000000 l d .gnu.debuglto_.debug_abbrev 00000000
> .gnu.debuglto_.debug_abbrev
> 00000000 l d .gnu.debuglto_.debug_line 00000000
> .gnu.debuglto_.debug_line
> 00000000 l d .gnu.debuglto_.debug_str 00000000
> .gnu.debuglto_.debug_str
> 00000000 l d .gnu.lto_.profile.69d69ac49136740e 00000000
> .gnu.lto_.profile.69d69ac49136740e
> 00000000 l d .gnu.lto_.icf.69d69ac49136740e 00000000
> .gnu.lto_.icf.69d69ac49136740e
> 00000000 l d .gnu.lto_.ipa_sra.69d69ac49136740e 00000000
> .gnu.lto_.ipa_sra.69d69ac49136740e
> 00000000 l d .gnu.lto_.inline.69d69ac49136740e 00000000
> .gnu.lto_.inline.69d69ac49136740e
> 00000000 l d .gnu.lto_.jmpfuncs.69d69ac49136740e 00000000
> .gnu.lto_.jmpfuncs.69d69ac49136740e
> 00000000 l d .gnu.lto_.pureconst.69d69ac49136740e 00000000
> .gnu.lto_.pureconst.69d69ac49136740e
> 00000000 l d .gnu.lto_.lto.69d69ac49136740e 00000000
> .gnu.lto_.lto.69d69ac49136740e
> 00000000 l d .gnu.lto_default_environment.154.69d69ac49136740e
> 00000000 .gnu.lto_default_environment.154.69d69ac49136740e
> 00000000 l d .gnu.lto_env_htab.155.69d69ac49136740e00000000
> .gnu.lto_env_htab.155.69d69ac49136740e
> 00000000 l d .gnu.lto_env_get_yesno.156.69d69ac49136740e 00000000
> .gnu.lto_env_get_yesno.156.69d69ac49136740e
> 00000000 l d .gnu.lto_env_get_default.157.69d69ac49136740e 00000000
> .gnu.lto_env_get_default.157.69d69ac49136740e
> 00000000 l d .gnu.lto_env_set_default.158.69d69ac49136740e 00000000
> .gnu.lto_env_set_default.158.69d69ac49136740e
> 00000000 l d .gnu.lto_env_set_default_vars.159.69d69ac49136740e
> 00000000 .gnu.lto_env_set_default_vars.159.69d69ac49136740e
> 00000000 l d .gnu.lto_env_import.160.69d69ac49136740e 00000000
> .gnu.lto_env_import.160.69d69ac49136740e
> 00000000 l d .gnu.lto_env_check_redund.162.69d69ac49136740e 00000000
> .gnu.lto_env_check_redund.162.69d69ac49136740e
> 00000000 l d .gnu.lto_env_import_redund.163.69d69ac49136740e
> 00000000 .gnu.lto_env_import_redund.163.69d69ac49136740e
> 00000000 l d .gnu.lto_env_export.164.69d69ac49136740e 00000000
> .gnu.lto_env_export.164.69d69ac49136740e
> 00000000 l d .gnu.lto_env_relocate.165.69d69ac49136740e 00000000
> .gnu.lto_env_relocate.165.69d69ac49136740e
> 00000000 l d .gnu.lto_env_complete.166.69d69ac49136740e 00000000
> .gnu.lto_env_complete.166.69d69ac49136740e
> 00000000 l d .gnu.lto_env_relocate.part.0.203.69d69ac49136740e
> 00000000 .gnu.lto_env_relocate.part.0.203.69d69ac49136740e
> 00000000 l d .gnu.lto_.symbol_nodes.69d69ac49136740e 00000000
> .gnu.lto_.symbol_nodes.69d69ac49136740e
> 00000000 l d .gnu.lto_.refs.69d69ac49136740e 00000000
> .gnu.lto_.refs.69d69ac49136740e
> 00000000 l d .gnu.lto_.decls.69d69ac49136740e 00000000
> .gnu.lto_.decls.69d69ac49136740e
> 00000000 l d .gnu.lto_.symtab.69d69ac49136740e 00000000
> .gnu.lto_.symtab.69d69ac49136740e
> 00000000 l d .gnu.lto_.ext_symtab.69d69ac49136740e 00000000
> .gnu.lto_.ext_symtab.69d69ac49136740e
> 00000000 l d .gnu.lto_.opts 00000000 .gnu.lto_.opts
> 00000000 l d .note.GNU-stack 00000000 .note.GNU-stack
> 00000000 l d .comment 00000000 .comment
> 00000000 l d .ARM.attributes 00000000 .ARM.attributes
> 00000000 w .gnu.debuglto_.debug_info 00000000 .hidden
> common.c.2c9afba8
> 00000001 O *COM* 00000001 __gnu_lto_slim
>
>
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: Question: LTO and failing objcopy in "u-boot-initial-env" target
2021-10-22 19:19 ` Adam Ford
@ 2021-10-22 19:26 ` Marek Behún
2021-10-22 19:49 ` Adam Ford
0 siblings, 1 reply; 6+ messages in thread
From: Marek Behún @ 2021-10-22 19:26 UTC (permalink / raw)
To: Adam Ford
Cc: Patrick DELAUNAY, U-Boot Mailing List, Tom Rini, Simon Glass,
Patrice CHOTARD, Marek Vasut, U-Boot STM32
On Fri, 22 Oct 2021 14:19:16 -0500
Adam Ford <aford173@gmail.com> wrote:
> I am not sure it's the right solution, but it appears to work for me
> on a board that uses LTO. I didn't try it with a board that doesn't
> use LTO.
Need to be tested with GCC as well as Clang.
Marek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Question: LTO and failing objcopy in "u-boot-initial-env" target
2021-10-22 19:26 ` Marek Behún
@ 2021-10-22 19:49 ` Adam Ford
2021-10-23 17:25 ` Tom Rini
0 siblings, 1 reply; 6+ messages in thread
From: Adam Ford @ 2021-10-22 19:49 UTC (permalink / raw)
To: Marek Behún
Cc: Patrick DELAUNAY, U-Boot Mailing List, Tom Rini, Simon Glass,
Patrice CHOTARD, Marek Vasut, U-Boot STM32
On Fri, Oct 22, 2021 at 2:26 PM Marek Behún <marek.behun@nic.cz> wrote:
>
> On Fri, 22 Oct 2021 14:19:16 -0500
> Adam Ford <aford173@gmail.com> wrote:
>
> > I am not sure it's the right solution, but it appears to work for me
> > on a board that uses LTO. I didn't try it with a board that doesn't
> > use LTO.
>
> Need to be tested with GCC as well as Clang.
Agreed.
I turned off LTO, and got an error, so I updated the diff to:
diff --git a/Makefile b/Makefile
index 5194e4dc78..386180e935 100644
--- a/Makefile
+++ b/Makefile
@@ -2303,7 +2303,7 @@ endif
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
quiet_cmd_genenv = GENENV $@
-cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@
env/common.o; \
+cmd_genenv = $(OBJCOPY) --dump-section `${OBJDUMP} env/common.o -t
|grep -m1 default_environment |awk '{print $$4}'`=$@ env/common.o; \
sed --in-place -e 's/\x00/\x0A/g' $@
u-boot-initial-env: u-boot.bin
It now appears to build without error with LTO enabled and disabled.
>
> Marek
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: Question: LTO and failing objcopy in "u-boot-initial-env" target
2021-10-22 19:49 ` Adam Ford
@ 2021-10-23 17:25 ` Tom Rini
0 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2021-10-23 17:25 UTC (permalink / raw)
To: Adam Ford
Cc: Marek Behún, Patrick DELAUNAY, U-Boot Mailing List,
Simon Glass, Patrice CHOTARD, Marek Vasut, U-Boot STM32
[-- Attachment #1: Type: text/plain, Size: 1408 bytes --]
On Fri, Oct 22, 2021 at 02:49:17PM -0500, Adam Ford wrote:
> On Fri, Oct 22, 2021 at 2:26 PM Marek Behún <marek.behun@nic.cz> wrote:
> >
> > On Fri, 22 Oct 2021 14:19:16 -0500
> > Adam Ford <aford173@gmail.com> wrote:
> >
> > > I am not sure it's the right solution, but it appears to work for me
> > > on a board that uses LTO. I didn't try it with a board that doesn't
> > > use LTO.
> >
> > Need to be tested with GCC as well as Clang.
>
> Agreed.
>
> I turned off LTO, and got an error, so I updated the diff to:
>
>
> diff --git a/Makefile b/Makefile
> index 5194e4dc78..386180e935 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2303,7 +2303,7 @@ endif
> $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
>
> quiet_cmd_genenv = GENENV $@
> -cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@
> env/common.o; \
> +cmd_genenv = $(OBJCOPY) --dump-section `${OBJDUMP} env/common.o -t
> |grep -m1 default_environment |awk '{print $$4}'`=$@ env/common.o; \
> sed --in-place -e 's/\x00/\x0A/g' $@
>
> u-boot-initial-env: u-boot.bin
>
>
> It now appears to build without error with LTO enabled and disabled.
I think LLVM is just not supportable without a different set of logic,
as env/common.o just isn't quite the same (with LTO it's an IR file,
without it's an object, but doesn't quite have that section?).
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Question: LTO and failing objcopy in "u-boot-initial-env" target
2021-10-22 15:16 Question: LTO and failing objcopy in "u-boot-initial-env" target Patrick DELAUNAY
2021-10-22 19:19 ` Adam Ford
@ 2021-10-22 19:25 ` Marek Behún
1 sibling, 0 replies; 6+ messages in thread
From: Marek Behún @ 2021-10-22 19:25 UTC (permalink / raw)
To: Patrick DELAUNAY
Cc: U-Boot Mailing List, Tom Rini, Simon Glass, Patrice CHOTARD,
Marek Vasut, U-Boot STM32
On Fri, 22 Oct 2021 17:16:18 +0200
Patrick DELAUNAY <patrick.delaunay@foss.st.com> wrote:
> Hi,
>
>
> I made tests with LTO option activated on stm32mp15 boards but if have a
> issue
>
> with the U-Boot target "u-boot-initial-env" (this command used by YOCTO)
>
>
> $> make u-boot-initial-env
>
> ...
>
> GENENV u-boot-initial-env
> arm-none-linux-gnueabihf-objcopy: env/common.o: can't dump section
> '.rodata.default_environment' - it does not exist: file format not
> recognized
> sed: can't read u-boot-initial-env: No such file or directory
> make[1]: *** [/local/home/frq07632/views/u-boot/Makefile:2315:
> u-boot-initial-env] Error 2
> make[1]: Leaving directory
> '/local/home/frq07632/views/build/stm32mp15_defconfig'
> make: *** [Makefile:177: sub-make] Error 2
>
>
> But I reproduced it with sandbox:
>
> $> make sandbox_defconfig
>
> $> make all
>
> $> make u-boot-initial-env
>
> ....
>
> LTO u-boot
> OBJCOPY u-boot-nodtb.bin
> COPY u-boot.bin
> GENENV u-boot-initial-env
> objcopy: env/common.o: can't dump section '.rodata.default_environment'
> - it does not exist: file format not recognized
> sed: can't read u-boot-initial-env: No such file or directory
> make: *** [Makefile:2315: u-boot-initial-env] Error 2
>
>
>
> Do you already know this issue for other board which activate the LTO
> feature ?
>
> I don't see any remarks about this issue on mailing list.
>
> Today I am known how to solve this issue.
>
>
> PS: The same command is executed in "scripts/get_default_envs.sh"
Seems that that script isn't executed in code integration, otherwise I
would have noticed this.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-10-23 17:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22 15:16 Question: LTO and failing objcopy in "u-boot-initial-env" target Patrick DELAUNAY
2021-10-22 19:19 ` Adam Ford
2021-10-22 19:26 ` Marek Behún
2021-10-22 19:49 ` Adam Ford
2021-10-23 17:25 ` Tom Rini
2021-10-22 19:25 ` Marek Behún
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.