diff mbox

[02/11] pc-bios/s390-ccw: Use correct strip when cross-compiling

Message ID 1460044433-19282-3-git-send-email-sergey.fedorov@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

sergey.fedorov@linaro.org April 7, 2016, 3:53 p.m. UTC
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(-)

Comments

Cornelia Huck April 7, 2016, 4:18 p.m. UTC | #1
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>

Any reason you use two different email addresses here? :)

> ---
>  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
> 

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>

I can take this through my queue for 2.7, if nothing else depends on it.
Sergey Fedorov April 7, 2016, 4:22 p.m. UTC | #2
On 07/04/16 19:18, Cornelia Huck 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>
> Any reason you use two different email addresses here? :)

I'd like people could reach me after my @linaro.org account get
disabled. That's why I put my private address. On the other hand, I'd
like to signify I did this work under Linaro. That's why I put another
s-o-b tag.

Thanks,
Sergey

>
>> ---
>>  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
>>
> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>
> I can take this through my queue for 2.7, if nothing else depends on it.
>
Sergey Fedorov April 18, 2016, 1:15 p.m. UTC | #3
On 07/04/16 19:18, Cornelia Huck wrote:
> On Thu,  7 Apr 2016 18:53:44 +0300
> Sergey Fedorov <sergey.fedorov@linaro.org> wrote:
(snip)
>> ---
>>  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
>>
> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>
> I can take this through my queue for 2.7, if nothing else depends on it.
>

Yes, please :)

Kind regards,
Sergey
Cornelia Huck April 18, 2016, 2:51 p.m. UTC | #4
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.
Cornelia Huck April 18, 2016, 3:34 p.m. UTC | #5
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?
Sergey Fedorov April 18, 2016, 3:47 p.m. UTC | #6
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 :)

Kind regards,
Sergey
Sergey Fedorov April 21, 2016, 5:36 p.m. UTC | #7
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
Alex Bennée April 21, 2016, 5:49 p.m. UTC | #8
Sergey Fedorov <serge.fdrv@gmail.com> writes:

> 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)

Ohh that's cool. I wonder if it could be used to solve the tcg/tests
problem?

>
>
> 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


--
Alex Bennée
Sergey Fedorov April 21, 2016, 6:56 p.m. UTC | #9
On 21/04/16 20:49, Alex Bennée wrote:
> Sergey Fedorov <serge.fdrv@gmail.com> writes:
>
>> 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)
> Ohh that's cool. I wonder if it could be used to solve the tcg/tests
> problem?

Which problem? :)

Kind regards,
Sergey
Cornelia Huck April 22, 2016, 8:08 a.m. UTC | #10
On Thu, 21 Apr 2016 20:36:49 +0300
Sergey Fedorov <serge.fdrv@gmail.com> wrote:

> 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 <...>

This one has the drawback of having to add architectures manually,
though.

> 
> 
> 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 <...>

I agree. This would probably be the easiest way.
Paolo Bonzini May 9, 2016, 12:49 p.m. UTC | #11
On 22/04/2016 10:08, Cornelia Huck wrote:
>> > 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 <...>
> I agree. This would probably be the easiest way.
> 

$(CROSS_PREFIX) is a build->host cross prefix (tool running on build
machine, producing output for the machine that QEMU runs on).  The ones
in roms/Makefile are build->target cross prefix (tool running on build
machine, producing output for the machine that QEMU emulates).

So roms/Makefile is the way to go.

Paolo
Sergey Fedorov May 10, 2016, 10:47 a.m. UTC | #12
On 09/05/16 15:49, Paolo Bonzini wrote:
>
> On 22/04/2016 10:08, Cornelia Huck wrote:
>>>> 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 <...>
>> I agree. This would probably be the easiest way.
>>
> $(CROSS_PREFIX) is a build->host cross prefix (tool running on build
> machine, producing output for the machine that QEMU runs on).  The ones
> in roms/Makefile are build->target cross prefix (tool running on build
> machine, producing output for the machine that QEMU emulates).
>
> So roms/Makefile is the way to go.

You're right, thanks. I suspect there should be some way to move this
stuff from roms/Makefile.

Kind regards,
Sergey
diff mbox

Patch

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