diff mbox series

binutils: apply override toolchain-clang last

Message ID 20220929033210.13292-1-kai.kang@windriver.com
State New
Headers show
Series binutils: apply override toolchain-clang last | expand

Commit Message

Kai Sept. 29, 2022, 3:32 a.m. UTC
From: Kai Kang <kai.kang@windriver.com>

It disables gprofng for toolchain clang, so it should clear GPROFNG_ALTS
when clang is used. But override 'toolchain-clang' is applied before
overrides 'TRANSLATED_TARGET_ARCH' such as x86-64, then GPROFNG_ALTS is
still set and not cleared. Append 'forcevariable' to apply it last then
make it work as expected.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 meta/recipes-devtools/binutils/binutils.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Purdie Sept. 29, 2022, 6:49 a.m. UTC | #1
On Thu, 2022-09-29 at 11:32 +0800, kai wrote:
> From: Kai Kang <kai.kang@windriver.com>
> 
> It disables gprofng for toolchain clang, so it should clear GPROFNG_ALTS
> when clang is used. But override 'toolchain-clang' is applied before
> overrides 'TRANSLATED_TARGET_ARCH' such as x86-64, then GPROFNG_ALTS is
> still set and not cleared. Append 'forcevariable' to apply it last then
> make it work as expected.
> 
> Signed-off-by: Kai Kang <kai.kang@windriver.com>
> ---
>  meta/recipes-devtools/binutils/binutils.inc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-devtools/binutils/binutils.inc b/meta/recipes-devtools/binutils/binutils.inc
> index 4dde387a8a..c7113f8a1f 100644
> --- a/meta/recipes-devtools/binutils/binutils.inc
> +++ b/meta/recipes-devtools/binutils/binutils.inc
> @@ -50,7 +50,7 @@ GPROFNG_ALTS:x86-64 = "${GPROFNGS}"
>  GPROFNG_ALTS:aarch64 = "${GPROFNGS}"
>  
>  # it disables gprofng for clang and musl in the bb file
> -GPROFNG_ALTS:toolchain-clang = ""
> +GPROFNG_ALTS:toolchain-clang:forcevariable = ""
>  GPROFNG_ALTS:libc-musl = ""
>  
>  LDGOLD_ALTS ?= "ld.gold dwp"

I've never wanted to see forcevariable used in layers, it is really
there as a last resort for end users. There must be some other way we
can arrange this?

Cheers,

Richard
Kai Sept. 29, 2022, 7:13 a.m. UTC | #2
On 9/29/22 14:49, Richard Purdie wrote:
> On Thu, 2022-09-29 at 11:32 +0800, kai wrote:
>> From: Kai Kang <kai.kang@windriver.com>
>>
>> It disables gprofng for toolchain clang, so it should clear GPROFNG_ALTS
>> when clang is used. But override 'toolchain-clang' is applied before
>> overrides 'TRANSLATED_TARGET_ARCH' such as x86-64, then GPROFNG_ALTS is
>> still set and not cleared. Append 'forcevariable' to apply it last then
>> make it work as expected.
>>
>> Signed-off-by: Kai Kang <kai.kang@windriver.com>
>> ---
>>   meta/recipes-devtools/binutils/binutils.inc | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/meta/recipes-devtools/binutils/binutils.inc b/meta/recipes-devtools/binutils/binutils.inc
>> index 4dde387a8a..c7113f8a1f 100644
>> --- a/meta/recipes-devtools/binutils/binutils.inc
>> +++ b/meta/recipes-devtools/binutils/binutils.inc
>> @@ -50,7 +50,7 @@ GPROFNG_ALTS:x86-64 = "${GPROFNGS}"
>>   GPROFNG_ALTS:aarch64 = "${GPROFNGS}"
>>   
>>   # it disables gprofng for clang and musl in the bb file
>> -GPROFNG_ALTS:toolchain-clang = ""
>> +GPROFNG_ALTS:toolchain-clang:forcevariable = ""
>>   GPROFNG_ALTS:libc-musl = ""
>>   
>>   LDGOLD_ALTS ?= "ld.gold dwp"
> I've never wanted to see forcevariable used in layers, it is really
> there as a last resort for end users. There must be some other way we
> can arrange this?

It could clear GPROFNG_ALTS for toolchain-clang in python anonymous 
function. I'll send for review.

Regards,
Kai

>
> Cheers,
>
> Richard
Richard Purdie Sept. 29, 2022, 7:21 a.m. UTC | #3
On Thu, 2022-09-29 at 15:13 +0800, kai wrote:
> On 9/29/22 14:49, Richard Purdie wrote:
> > On Thu, 2022-09-29 at 11:32 +0800, kai wrote:
> > > From: Kai Kang <kai.kang@windriver.com>
> > > 
> > > It disables gprofng for toolchain clang, so it should clear GPROFNG_ALTS
> > > when clang is used. But override 'toolchain-clang' is applied before
> > > overrides 'TRANSLATED_TARGET_ARCH' such as x86-64, then GPROFNG_ALTS is
> > > still set and not cleared. Append 'forcevariable' to apply it last then
> > > make it work as expected.
> > > 
> > > Signed-off-by: Kai Kang <kai.kang@windriver.com>
> > > ---
> > >   meta/recipes-devtools/binutils/binutils.inc | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/meta/recipes-devtools/binutils/binutils.inc b/meta/recipes-devtools/binutils/binutils.inc
> > > index 4dde387a8a..c7113f8a1f 100644
> > > --- a/meta/recipes-devtools/binutils/binutils.inc
> > > +++ b/meta/recipes-devtools/binutils/binutils.inc
> > > @@ -50,7 +50,7 @@ GPROFNG_ALTS:x86-64 = "${GPROFNGS}"
> > >   GPROFNG_ALTS:aarch64 = "${GPROFNGS}"
> > >   
> > >   # it disables gprofng for clang and musl in the bb file
> > > -GPROFNG_ALTS:toolchain-clang = ""
> > > +GPROFNG_ALTS:toolchain-clang:forcevariable = ""
> > >   GPROFNG_ALTS:libc-musl = ""
> > >   
> > >   LDGOLD_ALTS ?= "ld.gold dwp"
> > I've never wanted to see forcevariable used in layers, it is really
> > there as a last resort for end users. There must be some other way we
> > can arrange this?
> 
> It could clear GPROFNG_ALTS for toolchain-clang in python anonymous 
> function. I'll send for review.

GPROFNG:toolchain-clang = ""

might work?

Cheers,

Richard
Kai Sept. 29, 2022, 7:36 a.m. UTC | #4
On 9/29/22 15:21, Richard Purdie wrote:
> On Thu, 2022-09-29 at 15:13 +0800, kai wrote:
>> On 9/29/22 14:49, Richard Purdie wrote:
>>> On Thu, 2022-09-29 at 11:32 +0800, kai wrote:
>>>> From: Kai Kang <kai.kang@windriver.com>
>>>>
>>>> It disables gprofng for toolchain clang, so it should clear GPROFNG_ALTS
>>>> when clang is used. But override 'toolchain-clang' is applied before
>>>> overrides 'TRANSLATED_TARGET_ARCH' such as x86-64, then GPROFNG_ALTS is
>>>> still set and not cleared. Append 'forcevariable' to apply it last then
>>>> make it work as expected.
>>>>
>>>> Signed-off-by: Kai Kang <kai.kang@windriver.com>
>>>> ---
>>>>    meta/recipes-devtools/binutils/binutils.inc | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/meta/recipes-devtools/binutils/binutils.inc b/meta/recipes-devtools/binutils/binutils.inc
>>>> index 4dde387a8a..c7113f8a1f 100644
>>>> --- a/meta/recipes-devtools/binutils/binutils.inc
>>>> +++ b/meta/recipes-devtools/binutils/binutils.inc
>>>> @@ -50,7 +50,7 @@ GPROFNG_ALTS:x86-64 = "${GPROFNGS}"
>>>>    GPROFNG_ALTS:aarch64 = "${GPROFNGS}"
>>>>    
>>>>    # it disables gprofng for clang and musl in the bb file
>>>> -GPROFNG_ALTS:toolchain-clang = ""
>>>> +GPROFNG_ALTS:toolchain-clang:forcevariable = ""
>>>>    GPROFNG_ALTS:libc-musl = ""
>>>>    
>>>>    LDGOLD_ALTS ?= "ld.gold dwp"
>>> I've never wanted to see forcevariable used in layers, it is really
>>> there as a last resort for end users. There must be some other way we
>>> can arrange this?
>> It could clear GPROFNG_ALTS for toolchain-clang in python anonymous
>> function. I'll send for review.
> GPROFNG:toolchain-clang = ""
>
> might work?

That should be the right way for both toolchain-clang and libc-musl.

Thanks a lot.

Kai

>
> Cheers,
>
> Richard
>
diff mbox series

Patch

diff --git a/meta/recipes-devtools/binutils/binutils.inc b/meta/recipes-devtools/binutils/binutils.inc
index 4dde387a8a..c7113f8a1f 100644
--- a/meta/recipes-devtools/binutils/binutils.inc
+++ b/meta/recipes-devtools/binutils/binutils.inc
@@ -50,7 +50,7 @@  GPROFNG_ALTS:x86-64 = "${GPROFNGS}"
 GPROFNG_ALTS:aarch64 = "${GPROFNGS}"
 
 # it disables gprofng for clang and musl in the bb file
-GPROFNG_ALTS:toolchain-clang = ""
+GPROFNG_ALTS:toolchain-clang:forcevariable = ""
 GPROFNG_ALTS:libc-musl = ""
 
 LDGOLD_ALTS ?= "ld.gold dwp"