diff mbox

[kvm-unit-tests,2/2] arm/arm64 config: Fix arch_clean rule

Message ID 1441185926-61587-3-git-send-email-a.spyridakis@virtualopensystems.com
State New
Headers show

Commit Message

Alexander Spyridakis Sept. 2, 2015, 9:25 a.m. UTC
Properly clean any generated object and binary files after a 'make clean',
this fixes an issue when trying to reconfigure between arm and arm64.

Signed-off-by: Alexander Spyridakis <a.spyridakis@virtualopensystems.com>
---
 config/config-arm.mak   | 2 ++
 config/config-arm64.mak | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Andrew Jones Sept. 4, 2015, 10:48 a.m. UTC | #1
On Wed, Sep 02, 2015 at 11:25:26AM +0200, Alexander Spyridakis wrote:
> Properly clean any generated object and binary files after a 'make clean',
> this fixes an issue when trying to reconfigure between arm and arm64.

Are you also running configure (with the opposite arch selected) after
'make clean'? If not, then that could be the source of your problems.
Anyway, please describe the issues you're seeing because I don't see
what this patch is doing that isn't already being done. The lines this
patch adds are already there. See the arm_clean target in
config/config-arm-common.mak.

Thanks,
drew

> 
> Signed-off-by: Alexander Spyridakis <a.spyridakis@virtualopensystems.com>
> ---
>  config/config-arm.mak   | 2 ++
>  config/config-arm64.mak | 3 ++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/config/config-arm.mak b/config/config-arm.mak
> index ae6c2e7..68fab62 100644
> --- a/config/config-arm.mak
> +++ b/config/config-arm.mak
> @@ -21,3 +21,5 @@ tests =
>  include config/config-arm-common.mak
>  
>  arch_clean: arm_clean
> +	$(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \
> +	$(TEST_DIR)/.*.d lib/arm/.*.d
> diff --git a/config/config-arm64.mak b/config/config-arm64.mak
> index d61b703..a0bc1b3 100644
> --- a/config/config-arm64.mak
> +++ b/config/config-arm64.mak
> @@ -17,4 +17,5 @@ tests =
>  include config/config-arm-common.mak
>  
>  arch_clean: arm_clean
> -	$(RM) lib/arm64/.*.d
> +	$(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \
> +	$(TEST_DIR)/.*.d lib/arm64/.*.d
> -- 
> 2.1.4
> 
>
Alexander Spyridakis Sept. 4, 2015, 1:48 p.m. UTC | #2
On 4 September 2015 at 12:48, Andrew Jones <drjones@redhat.com> wrote:
> Are you also running configure (with the opposite arch selected) after
> 'make clean'? If not, then that could be the source of your problems.
> Anyway, please describe the issues you're seeing because I don't see
> what this patch is doing that isn't already being done. The lines this
> patch adds are already there. See the arm_clean target in
> config/config-arm-common.mak.

Steps to reproduce my issue:
> ./configure --arch=arm --cross-prefix=arm-linux-gnueabihf-
> make
> ./configure --arch=arm64 --cross-prefix=aarch64-linux-gnu-
> make clean && make
> arm/selftest.o: error adding symbols: File in wrong format

I would expect that after 'make clean', the object and binary files
are removed. Instead they are not and I have to manually remove them
before rebuilding. Running 'make clean' before and/or after
reconfiguring still produces the same issue for me.

Thanks.
Alexander Spyridakis Sept. 4, 2015, 1:53 p.m. UTC | #3
On 4 September 2015 at 12:48, Andrew Jones <drjones@redhat.com> wrote:
> The lines this
> patch adds are already there. See the arm_clean target in
> config/config-arm-common.mak.

I see your point now. Maybe then "arm_clean" should be changed in
"arch_clean" in config-arm-common.mak?

Regards.
Andrew Jones Sept. 4, 2015, 2:05 p.m. UTC | #4
On Fri, Sep 04, 2015 at 03:48:35PM +0200, Alexander Spyridakis wrote:
> On 4 September 2015 at 12:48, Andrew Jones <drjones@redhat.com> wrote:
> > Are you also running configure (with the opposite arch selected) after
> > 'make clean'? If not, then that could be the source of your problems.
> > Anyway, please describe the issues you're seeing because I don't see
> > what this patch is doing that isn't already being done. The lines this
> > patch adds are already there. See the arm_clean target in
> > config/config-arm-common.mak.
> 
> Steps to reproduce my issue:
> > ./configure --arch=arm --cross-prefix=arm-linux-gnueabihf-
> > make
> > ./configure --arch=arm64 --cross-prefix=aarch64-linux-gnu-
> > make clean && make
> > arm/selftest.o: error adding symbols: File in wrong format

This doesn't reproduce for me. I did the following, and it worked
fine.

make distclean
./configure --arch=arm --cross-prefix=arm-linux-gnu-
make
./configure --arch=arm64 --cross-prefix=aarch64-linux-gnu-
make clean && make


But anyway I would suggest you do your 'make clean' or even a
'make distclean' *before* running configure the second time.
Otherwise you'll leave old object files around from the previously
configured arch. I.e. you want 'make clean' to apply to the
currently built config, not the new (not yet built) config.

drew

> 
> I would expect that after 'make clean', the object and binary files
> are removed. Instead they are not and I have to manually remove them
> before rebuilding. Running 'make clean' before and/or after
> reconfiguring still produces the same issue for me.
> 
> Thanks.
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrew Jones Sept. 4, 2015, 2:08 p.m. UTC | #5
On Fri, Sep 04, 2015 at 03:53:46PM +0200, Alexander Spyridakis wrote:
> On 4 September 2015 at 12:48, Andrew Jones <drjones@redhat.com> wrote:
> > The lines this
> > patch adds are already there. See the arm_clean target in
> > config/config-arm-common.mak.
> 
> I see your point now. Maybe then "arm_clean" should be changed in
> "arch_clean" in config-arm-common.mak?

No, the dependency chain for 'make clean' is

clean
  arch_clean (this either arm's or arm64's)
    arm_clean (this is for both arm and arm64)

> 
> Regards.
>
Peter Maydell Sept. 4, 2015, 2:18 p.m. UTC | #6
On 4 September 2015 at 15:05, Andrew Jones <drjones@redhat.com> wrote:
> But anyway I would suggest you do your 'make clean' or even a
> 'make distclean' *before* running configure the second time.
> Otherwise you'll leave old object files around from the previously
> configured arch. I.e. you want 'make clean' to apply to the
> currently built config, not the new (not yet built) config.

Separate object directories is usually the best approach if
you regularly want to build multiple configurations IMHO...

thanks
-- PMM
Alexander Spyridakis Sept. 4, 2015, 2:53 p.m. UTC | #7
On 4 September 2015 at 16:05, Andrew Jones <drjones@redhat.com> wrote:
> This doesn't reproduce for me. I did the following, and it worked
> fine.
>
> make distclean
> ./configure --arch=arm --cross-prefix=arm-linux-gnu-
> make
> ./configure --arch=arm64 --cross-prefix=aarch64-linux-gnu-
> make clean && make

This is very troubling then as with the same commands the binaries are
still there. I need to check what's wrong with my setup, although I
managed to have the same issue on a newly created docker container...

Thanks for trying to replicate, I will investigate more.
Alexander Spyridakis Sept. 7, 2015, 1:35 p.m. UTC | #8
On 4 September 2015 at 16:05, Andrew Jones <drjones@redhat.com> wrote:
> This doesn't reproduce for me. I did the following, and it worked
> fine.
>
> make distclean
> ./configure --arch=arm --cross-prefix=arm-linux-gnu-
> make
> ./configure --arch=arm64 --cross-prefix=aarch64-linux-gnu-
> make clean && make

Ok I think I found the issue:

config-arm-common.mak:
>arm_clean: libfdt_clean asm_offsets_clean
>    $(RM) $(TEST_DIR)/*.{o,flat,elf} $(libeabi) $(eabiobjs) \
>          $(TEST_DIR)/.*.d lib/arm/.*.d

config-x86-common.mak:
>arch_clean:
>    $(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \
>    $(TEST_DIR)/.*.d lib/x86/.*.d

I think the arm case tries to be too clever and on many systems it
fails (tested on debian:jessie,sid and ubuntu:14.04,15.04). Basically
the expression for the arm case fails to resolve, while using the
simpler x86 way works as expected.

So is the following change acceptable in config-arm-common.mak?
> arm_clean: libfdt_clean asm_offsets_clean
>-       $(RM) $(TEST_DIR)/*.{o,flat,elf} $(libeabi) $(eabiobjs) \
>-             $(TEST_DIR)/.*.d lib/arm/.*.d
>+       $(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \
>+               $(libeabi) $(eabiobjs) $(TEST_DIR)/.*.d lib/arm/.*.d

Thanks.
diff mbox

Patch

diff --git a/config/config-arm.mak b/config/config-arm.mak
index ae6c2e7..68fab62 100644
--- a/config/config-arm.mak
+++ b/config/config-arm.mak
@@ -21,3 +21,5 @@  tests =
 include config/config-arm-common.mak
 
 arch_clean: arm_clean
+	$(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \
+	$(TEST_DIR)/.*.d lib/arm/.*.d
diff --git a/config/config-arm64.mak b/config/config-arm64.mak
index d61b703..a0bc1b3 100644
--- a/config/config-arm64.mak
+++ b/config/config-arm64.mak
@@ -17,4 +17,5 @@  tests =
 include config/config-arm-common.mak
 
 arch_clean: arm_clean
-	$(RM) lib/arm64/.*.d
+	$(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \
+	$(TEST_DIR)/.*.d lib/arm64/.*.d