Message ID | 20180220215954.4092811-2-arnd@arndb.de |
---|---|
State | New |
Headers | show |
Series | ARM: hacks for link-time optimization | expand |
On Tue, 20 Feb 2018, Arnd Bergmann wrote: > This fails during deflate_xip_data.sh > > /home/arnd/cross-gcc/bin/arm-linux-gnueabi-objcopy -O binary -R .comment -S vmlinux arch/arm/boot/xipImage && /bin/bash -c '/git/arm-soc/arch/arm/boot/deflate_xip_data.sh vmlinux arch/arm/boot/xipImage || { rm -f arch/arm/boot/xipImage; false; }' > make -f /git/arm-soc/scripts/Makefile.modpost > + sym_val __data_loc > + sed -n / __data_loc$/{s/ .*$//p;q} > + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux > /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] > + local val=ac74c0f4 > + [ ac74c0f4 ] > + echo 2893332724 > + __data_loc=2893332724 > + sym_val _edata_loc > + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux > + sed -n / _edata_loc$/{s/ .*$//p;q} > /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] > + local val=ac7b8744 > + [ ac7b8744 ] > + echo 2893776708 > + _edata_loc=2893776708 > + sym_val _xiprom > + sed -n / _xiprom$/{s/ .*$//p;q} > + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux > /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] > > Obviously we want to make the combination work, no idea why it doesn't. > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- > arch/arm/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig > index 823e397ee0f3..8ed0f664f86f 100644 > --- a/arch/arm/Kconfig > +++ b/arch/arm/Kconfig > @@ -1976,6 +1976,7 @@ endchoice > config XIP_KERNEL > bool "Kernel Execute-In-Place from ROM" > depends on !ARM_LPAE && !ARCH_MULTIPLATFORM > + depends on !LTO You should move this to config XIP_DEFLATED_DATA instead. Nicolas
On Wed, Feb 21, 2018 at 4:01 AM, Nicolas Pitre <nicolas.pitre@linaro.org> wrote: > On Tue, 20 Feb 2018, Arnd Bergmann wrote: > >> This fails during deflate_xip_data.sh >> >> /home/arnd/cross-gcc/bin/arm-linux-gnueabi-objcopy -O binary -R .comment -S vmlinux arch/arm/boot/xipImage && /bin/bash -c '/git/arm-soc/arch/arm/boot/deflate_xip_data.sh vmlinux arch/arm/boot/xipImage || { rm -f arch/arm/boot/xipImage; false; }' >> make -f /git/arm-soc/scripts/Makefile.modpost >> + sym_val __data_loc >> + sed -n / __data_loc$/{s/ .*$//p;q} >> + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux >> /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] >> + local val=ac74c0f4 >> + [ ac74c0f4 ] >> + echo 2893332724 >> + __data_loc=2893332724 >> + sym_val _edata_loc >> + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux >> + sed -n / _edata_loc$/{s/ .*$//p;q} >> /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] >> + local val=ac7b8744 >> + [ ac7b8744 ] >> + echo 2893776708 >> + _edata_loc=2893776708 >> + sym_val _xiprom >> + sed -n / _xiprom$/{s/ .*$//p;q} >> + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux >> /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] >> >> Obviously we want to make the combination work, no idea why it doesn't. >> > > You should move this to config XIP_DEFLATED_DATA instead. Right, makes sense. I'd still prever nm to not crash, but that would be a small improvement. Arnd
On Wed, 21 Feb 2018, Arnd Bergmann wrote: > On Wed, Feb 21, 2018 at 4:01 AM, Nicolas Pitre <nicolas.pitre@linaro.org> wrote: > > On Tue, 20 Feb 2018, Arnd Bergmann wrote: > > > >> This fails during deflate_xip_data.sh > >> > >> /home/arnd/cross-gcc/bin/arm-linux-gnueabi-objcopy -O binary -R .comment -S vmlinux arch/arm/boot/xipImage && /bin/bash -c '/git/arm-soc/arch/arm/boot/deflate_xip_data.sh vmlinux arch/arm/boot/xipImage || { rm -f arch/arm/boot/xipImage; false; }' > >> make -f /git/arm-soc/scripts/Makefile.modpost > >> + sym_val __data_loc > >> + sed -n / __data_loc$/{s/ .*$//p;q} > >> + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux > >> /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] > >> + local val=ac74c0f4 > >> + [ ac74c0f4 ] > >> + echo 2893332724 > >> + __data_loc=2893332724 > >> + sym_val _edata_loc > >> + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux > >> + sed -n / _edata_loc$/{s/ .*$//p;q} > >> /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] > >> + local val=ac7b8744 > >> + [ ac7b8744 ] > >> + echo 2893776708 > >> + _edata_loc=2893776708 > >> + sym_val _xiprom > >> + sed -n / _xiprom$/{s/ .*$//p;q} > >> + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux > >> /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] > >> > >> Obviously we want to make the combination work, no idea why it doesn't. > >> > > > > You should move this to config XIP_DEFLATED_DATA instead. > > Right, makes sense. I'd still prever nm to not crash, but that would be a small > improvement. I'll have a look at nm. However this feature is linked to head-inflate-data.c (your patch #5/7) and I have no obvious quick solution in mind for that one. Nicolas
On Tue, 20 Feb 2018, Arnd Bergmann wrote: > This fails during deflate_xip_data.sh > > /home/arnd/cross-gcc/bin/arm-linux-gnueabi-objcopy -O binary -R .comment -S vmlinux arch/arm/boot/xipImage && /bin/bash -c '/git/arm-soc/arch/arm/boot/deflate_xip_data.sh vmlinux arch/arm/boot/xipImage || { rm -f arch/arm/boot/xipImage; false; }' > make -f /git/arm-soc/scripts/Makefile.modpost > + sym_val __data_loc > + sed -n / __data_loc$/{s/ .*$//p;q} > + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux > /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] > + local val=ac74c0f4 > + [ ac74c0f4 ] > + echo 2893332724 > + __data_loc=2893332724 > + sym_val _edata_loc > + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux > + sed -n / _edata_loc$/{s/ .*$//p;q} > /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] > + local val=ac7b8744 > + [ ac7b8744 ] > + echo 2893776708 > + _edata_loc=2893776708 > + sym_val _xiprom > + sed -n / _xiprom$/{s/ .*$//p;q} > + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux > /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] > > Obviously we want to make the combination work, no idea why it doesn't. Well, it does work regardless of the noise. Here the nm output is piped into sed, and the later exits early when it finds what it is looking for, causing nm to complain about the broken pipe. Here's a patch silencing this bogus error message and fixing other minor issues. ----- >8 Subject: [PATCH] ARM: deflate_xip_data.sh: minor fixes Send nm complaints about broken pipe (when sed exits early) to /dev/null. All errors should be printed to stderr. Don't trap on normal exit so the trap can return an error code. Signed-off-by: Nicolas Pitre <nico@linaro.org> diff --git a/arch/arm/boot/deflate_xip_data.sh b/arch/arm/boot/deflate_xip_data.sh index 1189598a25..5e7d758ebd 100755 --- a/arch/arm/boot/deflate_xip_data.sh +++ b/arch/arm/boot/deflate_xip_data.sh @@ -30,7 +30,7 @@ esac sym_val() { # extract hex value for symbol in $1 - local val=$($NM "$VMLINUX" | sed -n "/ $1$/{s/ .*$//p;q}") + local val=$($NM "$VMLINUX" 2>/dev/null | sed -n "/ $1\$/{s/ .*$//p;q}") [ "$val" ] || { echo "can't find $1 in $VMLINUX" 1>&2; exit 1; } # convert from hex to decimal echo $((0x$val)) @@ -48,12 +48,12 @@ data_end=$(($_edata_loc - $base_offset)) file_end=$(stat -c "%s" "$XIPIMAGE") if [ "$file_end" != "$data_end" ]; then printf "end of xipImage doesn't match with _edata_loc (%#x vs %#x)\n" \ - $(($file_end + $base_offset)) $_edata_loc 2>&1 + $(($file_end + $base_offset)) $_edata_loc 1>&2 exit 1; fi # be ready to clean up -trap 'rm -f "$XIPIMAGE.tmp"' 0 1 2 3 +trap 'rm -f "$XIPIMAGE.tmp"; exit 1' 1 2 3 # substitute the data section by a compressed version $DD if="$XIPIMAGE" count=$data_start iflag=count_bytes of="$XIPIMAGE.tmp"
On Mon, Mar 12, 2018 at 3:40 AM, Nicolas Pitre <nicolas.pitre@linaro.org> wrote: > On Tue, 20 Feb 2018, Arnd Bergmann wrote: >> Obviously we want to make the combination work, no idea why it doesn't. > > Well, it does work regardless of the noise. Here the nm output is piped > into sed, and the later exits early when it finds what it is looking > for, causing nm to complain about the broken pipe. > > Here's a patch silencing this bogus error message and fixing other minor > issues. > > ----- >8 > Subject: [PATCH] ARM: deflate_xip_data.sh: minor fixes > > Send nm complaints about broken pipe (when sed exits early) to /dev/null. > All errors should be printed to stderr. > Don't trap on normal exit so the trap can return an error code. > > Signed-off-by: Nicolas Pitre <nico@linaro.org> Ah, that explains it, thanks! Tested-by: Arnd Bergmann <arnd@arndb.de> > diff --git a/arch/arm/boot/deflate_xip_data.sh b/arch/arm/boot/deflate_xip_data.sh > index 1189598a25..5e7d758ebd 100755 > --- a/arch/arm/boot/deflate_xip_data.sh > +++ b/arch/arm/boot/deflate_xip_data.sh > @@ -30,7 +30,7 @@ esac > > sym_val() { > # extract hex value for symbol in $1 > - local val=$($NM "$VMLINUX" | sed -n "/ $1$/{s/ .*$//p;q}") > + local val=$($NM "$VMLINUX" 2>/dev/null | sed -n "/ $1\$/{s/ .*$//p;q}") > [ "$val" ] || { echo "can't find $1 in $VMLINUX" 1>&2; exit 1; } > # convert from hex to decimal > echo $((0x$val)) > @@ -48,12 +48,12 @@ data_end=$(($_edata_loc - $base_offset)) > file_end=$(stat -c "%s" "$XIPIMAGE") > if [ "$file_end" != "$data_end" ]; then > printf "end of xipImage doesn't match with _edata_loc (%#x vs %#x)\n" \ > - $(($file_end + $base_offset)) $_edata_loc 2>&1 > + $(($file_end + $base_offset)) $_edata_loc 1>&2 > exit 1; > fi > > # be ready to clean up > -trap 'rm -f "$XIPIMAGE.tmp"' 0 1 2 3 > +trap 'rm -f "$XIPIMAGE.tmp"; exit 1' 1 2 3 > > # substitute the data section by a compressed version > $DD if="$XIPIMAGE" count=$data_start iflag=count_bytes of="$XIPIMAGE.tmp"
On Mon, Mar 12, 2018 at 2:52 PM, Arnd Bergmann <arnd@arndb.de> wrote: > On Mon, Mar 12, 2018 at 3:40 AM, Nicolas Pitre <nicolas.pitre@linaro.org> wrote: >> On Tue, 20 Feb 2018, Arnd Bergmann wrote: > >>> Obviously we want to make the combination work, no idea why it doesn't. >> >> Well, it does work regardless of the noise. Here the nm output is piped >> into sed, and the later exits early when it finds what it is looking >> for, causing nm to complain about the broken pipe. >> >> Here's a patch silencing this bogus error message and fixing other minor >> issues. >> >> ----- >8 >> Subject: [PATCH] ARM: deflate_xip_data.sh: minor fixes >> >> Send nm complaints about broken pipe (when sed exits early) to /dev/null. >> All errors should be printed to stderr. >> Don't trap on normal exit so the trap can return an error code. >> >> Signed-off-by: Nicolas Pitre <nico@linaro.org> > > Ah, that explains it, thanks! > > Tested-by: Arnd Bergmann <arnd@arndb.de> Nevermind, I confused it with a different problem that I'm running into with randconfig builds: arm-linux-gnueabi-nm: 'arch/arm/boot/compressed/../../../../vmlinux': No such file I applied your patch, and it did not happen for a couple of randconfigs, but that is now back. So I did not test the bug you are fixing, and the thing that I thought you fixed is still there. Arnd
On Mon, 12 Mar 2018, Arnd Bergmann wrote: > On Mon, Mar 12, 2018 at 2:52 PM, Arnd Bergmann <arnd@arndb.de> wrote: > > On Mon, Mar 12, 2018 at 3:40 AM, Nicolas Pitre <nicolas.pitre@linaro.org> wrote: > >> On Tue, 20 Feb 2018, Arnd Bergmann wrote: > > > >>> Obviously we want to make the combination work, no idea why it doesn't. > >> > >> Well, it does work regardless of the noise. Here the nm output is piped > >> into sed, and the later exits early when it finds what it is looking > >> for, causing nm to complain about the broken pipe. > >> > >> Here's a patch silencing this bogus error message and fixing other minor > >> issues. > >> > >> ----- >8 > >> Subject: [PATCH] ARM: deflate_xip_data.sh: minor fixes > >> > >> Send nm complaints about broken pipe (when sed exits early) to /dev/null. > >> All errors should be printed to stderr. > >> Don't trap on normal exit so the trap can return an error code. > >> > >> Signed-off-by: Nicolas Pitre <nico@linaro.org> > > > > Ah, that explains it, thanks! > > > > Tested-by: Arnd Bergmann <arnd@arndb.de> > > > Nevermind, I confused it with a different problem that I'm running into > with randconfig builds: At least you no longer get the "broken pipe" warning as your initial report showed, right? > arm-linux-gnueabi-nm: 'arch/arm/boot/compressed/../../../../vmlinux': > No such file That is weird. The Makefile has: cmd_mkxip = $(cmd_objcopy) && $(cmd_deflate_xip_data) $(obj)/xipImage: vmlinux FORCE $(call if_changed,mkxip) So the objcopy must succeed at producing vmlinux for deflate_xip_data (where nm is used) to be called. Do you have a .config for this issue? Nicolas
On Mon, 12 Mar 2018, Nicolas Pitre wrote: > On Mon, 12 Mar 2018, Arnd Bergmann wrote: > > > arm-linux-gnueabi-nm: 'arch/arm/boot/compressed/../../../../vmlinux': > > No such file > > That is weird. The Makefile has: > > cmd_mkxip = $(cmd_objcopy) && $(cmd_deflate_xip_data) > > $(obj)/xipImage: vmlinux FORCE > $(call if_changed,mkxip) > > So the objcopy must succeed at producing vmlinux for deflate_xip_data > (where nm is used) to be called. Correction: vmlinux is a dependency not a product, so it must be there for this rule to be executed, and it is input to both objcopy and nm. Nicolas
On Mon, Mar 12, 2018 at 6:00 PM, Nicolas Pitre <nicolas.pitre@linaro.org> wrote: > On Mon, 12 Mar 2018, Arnd Bergmann wrote: > >> On Mon, Mar 12, 2018 at 2:52 PM, Arnd Bergmann <arnd@arndb.de> wrote: >> > On Mon, Mar 12, 2018 at 3:40 AM, Nicolas Pitre <nicolas.pitre@linaro.org> wrote: >> >> On Tue, 20 Feb 2018, Arnd Bergmann wrote: >> > >> >>> Obviously we want to make the combination work, no idea why it doesn't. >> >> >> >> Well, it does work regardless of the noise. Here the nm output is piped >> >> into sed, and the later exits early when it finds what it is looking >> >> for, causing nm to complain about the broken pipe. >> >> >> >> Here's a patch silencing this bogus error message and fixing other minor >> >> issues. >> >> >> >> ----- >8 >> >> Subject: [PATCH] ARM: deflate_xip_data.sh: minor fixes >> >> >> >> Send nm complaints about broken pipe (when sed exits early) to /dev/null. >> >> All errors should be printed to stderr. >> >> Don't trap on normal exit so the trap can return an error code. >> >> >> >> Signed-off-by: Nicolas Pitre <nico@linaro.org> >> > >> > Ah, that explains it, thanks! >> > >> > Tested-by: Arnd Bergmann <arnd@arndb.de> >> >> >> Nevermind, I confused it with a different problem that I'm running into >> with randconfig builds: > > At least you no longer get the "broken pipe" warning as your initial > report showed, right? I don't know, my recent tests are all without the LTO patch series, so I don't get that one anyway. >> arm-linux-gnueabi-nm: 'arch/arm/boot/compressed/../../../../vmlinux': >> No such file > > That is weird. The Makefile has: > > cmd_mkxip = $(cmd_objcopy) && $(cmd_deflate_xip_data) > > $(obj)/xipImage: vmlinux FORCE > $(call if_changed,mkxip) > > So the objcopy must succeed at producing vmlinux for deflate_xip_data > (where nm is used) to be called. > > Do you have a .config for this issue? I only get it while doing randconfig builds with my scripts, maybe one out of three times, but don't ever get when rebuilding the configs later. I have never figured out how to reproduce it reliably other than with my randconfig script: #!/bin/bash RAND_DIR=build/rand LOG_DIR=rand PARALLEL="-j30" # number of CPUs on build system MAKE="make O=${RAND_DIR} -sk ${PARALLEL}" export CCACHE_DISABLE=1 # no point in ccache for random builds buildone() { mkdir -p ${RAND_DIR} ${LOG_DIR} eval `${MAKE} randconfig 2>&1 | grep KCONFIG_SEED=` export KCONFIG_SEED ${MAKE} allrandom.config > /dev/null rm -rf ${RAND_DIR}/arch/arm64/kernel/vdso ID=${KCONFIG_SEED} cp ${RAND_DIR}/.config ${LOG_DIR}/$ID-config if ${MAKE} > ${LOG_DIR}/$ID-output 2>&1 ; then mv ${LOG_DIR}/$ID-output ${LOG_DIR}/$ID-success echo $ID `date` success else mv ${LOG_DIR}/$ID-output ${LOG_DIR}/$ID-failure echo $ID `date` failed ${MAKE} fi ${MAKE} clean } buildone Arnd
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 823e397ee0f3..8ed0f664f86f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1976,6 +1976,7 @@ endchoice config XIP_KERNEL bool "Kernel Execute-In-Place from ROM" depends on !ARM_LPAE && !ARCH_MULTIPLATFORM + depends on !LTO help Execute-In-Place allows the kernel to run from non-volatile storage directly addressable by the CPU, such as NOR flash. This saves RAM
This fails during deflate_xip_data.sh /home/arnd/cross-gcc/bin/arm-linux-gnueabi-objcopy -O binary -R .comment -S vmlinux arch/arm/boot/xipImage && /bin/bash -c '/git/arm-soc/arch/arm/boot/deflate_xip_data.sh vmlinux arch/arm/boot/xipImage || { rm -f arch/arm/boot/xipImage; false; }' make -f /git/arm-soc/scripts/Makefile.modpost + sym_val __data_loc + sed -n / __data_loc$/{s/ .*$//p;q} + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] + local val=ac74c0f4 + [ ac74c0f4 ] + echo 2893332724 + __data_loc=2893332724 + sym_val _edata_loc + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux + sed -n / _edata_loc$/{s/ .*$//p;q} /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] + local val=ac7b8744 + [ ac7b8744 ] + echo 2893776708 + _edata_loc=2893776708 + sym_val _xiprom + sed -n / _xiprom$/{s/ .*$//p;q} + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] Obviously we want to make the combination work, no idea why it doesn't. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+) -- 2.9.0