From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atIXA-0003X2-Jj for qemu-devel@nongnu.org; Thu, 21 Apr 2016 13:36:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1atIX7-0007bn-CZ for qemu-devel@nongnu.org; Thu, 21 Apr 2016 13:36:56 -0400 Received: from mail-lf0-x22a.google.com ([2a00:1450:4010:c07::22a]:36260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atIX6-0007bW-Ot for qemu-devel@nongnu.org; Thu, 21 Apr 2016 13:36:53 -0400 Received: by mail-lf0-x22a.google.com with SMTP id g184so65131858lfb.3 for ; Thu, 21 Apr 2016 10:36:52 -0700 (PDT) References: <1460044433-19282-1-git-send-email-sergey.fedorov@linaro.org> <1460044433-19282-3-git-send-email-sergey.fedorov@linaro.org> <20160418165116.4a27b947.cornelia.huck@de.ibm.com> <20160418173409.44564649.cornelia.huck@de.ibm.com> <5715019C.60203@gmail.com> From: Sergey Fedorov Message-ID: <57190FB1.2070001@gmail.com> Date: Thu, 21 Apr 2016 20:36:49 +0300 MIME-Version: 1.0 In-Reply-To: <5715019C.60203@gmail.com> Content-Type: multipart/alternative; boundary="------------050401010103060501040304" Subject: Re: [Qemu-devel] [PATCH 02/11] pc-bios/s390-ccw: Use correct strip when cross-compiling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck , Sergey Fedorov Cc: qemu-devel@nongnu.org, =?UTF-8?Q?Alex_Benn=c3=a9e?= , Paolo Bonzini , Peter Crosthwaite , Richard Henderson , Christian Borntraeger , Alexander Graf This is a multi-part message in MIME format. --------------050401010103060501040304 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 18/04/16 18:47, Sergey Fedorov wrote: > On 18/04/16 18:34, Cornelia Huck wrote: >> On Mon, 18 Apr 2016 16:51:16 +0200 >> Cornelia Huck wrote: >> >>> On Thu, 7 Apr 2016 18:53:44 +0300 >>> Sergey Fedorov wrote: >>> >>>> From: Sergey Fedorov >>>> >>>> Signed-off-by: Sergey Fedorov >>>> Signed-off-by: Sergey Fedorov >>>> --- >>>> pc-bios/s390-ccw/Makefile | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile >>>> index 4208cb429593..5ce6d4ccbaf5 100644 >>>> --- a/pc-bios/s390-ccw/Makefile >>>> +++ b/pc-bios/s390-ccw/Makefile >>>> @@ -20,7 +20,7 @@ s390-ccw.elf: $(OBJECTS) >>>> $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS)," Building $(TARGET_DIR)$@") >>>> >>>> s390-ccw.img: s390-ccw.elf >>>> - $(call quiet-command,strip --strip-unneeded $< -o $@," Stripping $(TARGET_DIR)$@") >>>> + $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@," Stripping $(TARGET_DIR)$@") >>>> >>>> $(OBJECTS): Makefile >>>> >>> Thanks, applied to s390-next. >> Uhm, scratch that. >> >> This fails to build with --disable-strip, as $STRIP is unset in that >> case: >> >> Building s390-ccw/s390-ccw.elf >> Stripping s390-ccw/s390-ccw.img >> /bin/sh: --strip-unneeded: command not found >> make[1]: *** [s390-ccw.img] Error 127 >> >> >> The catch is that we always want to strip that binary. Care to send a >> patch that deals with that? >> > I see the problem. I don't promise to fix it soon, but I could try > dealing with this as I have time. I don't mind if someone else can just > fix it with their own patch :) It's not straightforward to fix. We need to detect a correct cross-prefix for strip. There is something in roms/Makefile: # # cross compiler auto detection # path := $(subst :, ,$(PATH)) system := $(shell uname -s | tr "A-Z" "a-z") # first find cross binutils in path find-cross-ld = $(firstword $(wildcard $(patsubst %,%/$(1)-*$(system)*-ld,$(path)))) # then check we have cross gcc too find-cross-gcc = $(firstword $(wildcard $(patsubst %ld,%gcc,$(call find-cross-ld,$(1))))) # finally strip off path + toolname so we get the prefix find-cross-prefix = $(subst gcc,,$(notdir $(call find-cross-gcc,$(1)))) powerpc64_cross_prefix := $(call find-cross-prefix,powerpc64) powerpc_cross_prefix := $(call find-cross-prefix,powerpc) x86_64_cross_prefix := $(call find-cross-prefix,x86_64) and then: $(powerpc_cross_prefix)strip <...> However, to solve this problem, it would be enough to export ${cross_prefix} from configure to config-host.mak and do like this: $(CROSS_PREFIX)strip <...> Kind regards, Sergey --------------050401010103060501040304 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 7bit
On 18/04/16 18:47, Sergey Fedorov wrote:
On 18/04/16 18:34, Cornelia Huck wrote:
On Mon, 18 Apr 2016 16:51:16 +0200
Cornelia Huck <cornelia.huck@de.ibm.com> wrote:

On Thu,  7 Apr 2016 18:53:44 +0300
Sergey Fedorov <sergey.fedorov@linaro.org> wrote:

From: Sergey Fedorov <serge.fdrv@gmail.com>

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
---
 pc-bios/s390-ccw/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile
index 4208cb429593..5ce6d4ccbaf5 100644
--- a/pc-bios/s390-ccw/Makefile
+++ b/pc-bios/s390-ccw/Makefile
@@ -20,7 +20,7 @@ s390-ccw.elf: $(OBJECTS)
 	$(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),"  Building $(TARGET_DIR)$@")

 s390-ccw.img: s390-ccw.elf
-	$(call quiet-command,strip --strip-unneeded $< -o $@,"  Stripping $(TARGET_DIR)$@")
+	$(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,"  Stripping $(TARGET_DIR)$@")

 $(OBJECTS): Makefile

Thanks, applied to s390-next.
Uhm, scratch that.

This fails to build with --disable-strip, as $STRIP is unset in that
case:

  Building s390-ccw/s390-ccw.elf
  Stripping s390-ccw/s390-ccw.img
/bin/sh: --strip-unneeded: command not found
make[1]: *** [s390-ccw.img] Error 127


The catch is that we always want to strip that binary. Care to send a
patch that deals with that?

I see the problem. I don't promise to fix it soon, but I could try
dealing with this as I have time. I don't mind if someone else can just
fix it with their own patch :)

It's not straightforward to fix. We need to detect a correct cross-prefix for strip. There is something in roms/Makefile:

#
# cross compiler auto detection
#
path := $(subst :, ,$(PATH))
system := $(shell uname -s | tr "A-Z" "a-z")

# first find cross binutils in path
find-cross-ld = $(firstword $(wildcard $(patsubst %,%/$(1)-*$(system)*-ld,$(path))))
# then check we have cross gcc too
find-cross-gcc = $(firstword $(wildcard $(patsubst %ld,%gcc,$(call find-cross-ld,$(1)))))
# finally strip off path + toolname so we get the prefix
find-cross-prefix = $(subst gcc,,$(notdir $(call find-cross-gcc,$(1))))

powerpc64_cross_prefix := $(call find-cross-prefix,powerpc64)
powerpc_cross_prefix := $(call find-cross-prefix,powerpc)
x86_64_cross_prefix := $(call find-cross-prefix,x86_64)

and then:

$(powerpc_cross_prefix)strip <...>

However, to solve this problem, it would be enough to export ${cross_prefix} from configure to config-host.mak and do like this:

$(CROSS_PREFIX)strip <...>

Kind regards,
Sergey
--------------050401010103060501040304--