Skip to contentSkip to conversation

native.bbclass: Override TARGET_ flags too

PATCH In review Mike Crowe 3 participants 6 messages Apr 16, 2014

lore
Share & tools
lore

Mike Crowe

author
#0 lore raw

PATCH 1/1 native.bbclass: Override TARGET_ flags too

TARGET_LDFLAGS is currently defined in bitbake.conf to contain ${TARGET_LINK_HASH_STYLE} which differs between MIPS and other targets. Since TARGET_LDFLAGS is an exported variable it affects the hash of every shell task even if it is not used.

We don't want native recipe tasks to have different hashes purely because they happen to have been built in order to satisfy dependencies for different MACHINEs since this causes lots of churn in the native sysroot when switching between MACHINEs.

Making native.bbclass override TARGET_LDFLAGS to use BUILD_LDFLAGS ensures consistent hashes and is a sensible thing to be doing anyway.

Although they don't appear to have the same detrimental affect on task hashes TARGET_CPPFLAGS, TARGET_CFLAGS and TARGET_CXXFLAGS should be overridden too.

---
 meta/classes/native.bbclass | 4 ++++
 1 file changed, 4 insertions(+)
meta/classes/native.bbclass +4 -0
index 5a318d2..2d182f0 100644
@@ -26,6 +26,10 @@ TARGET_PREFIX = "${BUILD_PREFIX}"
 TARGET_CC_ARCH = "${BUILD_CC_ARCH}"
 TARGET_LD_ARCH = "${BUILD_LD_ARCH}"
 TARGET_AS_ARCH = "${BUILD_AS_ARCH}"
+TARGET_CPPFLAGS = "${BUILD_CPPFLAGS}"
+TARGET_CFLAGS = "${BUILD_CFLAGS}"
+TARGET_CXXFLAGS = "${BUILD_CXXFLAGS}"
+TARGET_LDFLAGS = "${BUILD_LDFLAGS}"
 TARGET_FPU = ""
 
 HOST_ARCH = "${BUILD_ARCH}"
Signature · 1 line
1.9.1
#1 lore raw
Quoted 5 lines · On Wednesday 16 April 2014 10:31:36 Mike Crowe wrote:

TARGET_LDFLAGS is currently defined in bitbake.conf to contain ${TARGET_LINK_HASH_STYLE} which differs between MIPS and other targets. Since TARGET_LDFLAGS is an exported variable it affects the hash of every shell task even if it is not used.

Quoted 7 lines

We don't want native recipe tasks to have different hashes purely because they happen to have been built in order to satisfy dependencies for different MACHINEs since this causes lots of churn in the native sysroot when switching between MACHINEs.

Making native.bbclass override TARGET_LDFLAGS to use BUILD_LDFLAGS ensures consistent hashes and is a sensible thing to be doing anyway.

Just to be clear, for a native recipe how is TARGET_LDFLAGS entering the signatures? AIUI there ought to be indirection such that LDFLAGS is used and that is set from BUILD_LDFLAGS for a native recipe rather than TARGET_LDFLAGS.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
author
#2 lore raw
Quoted 11 lines · Paul Eggleton
Quoted 10 lines · On Wednesday 16 April 2014 10:31:36 Mike Crowe wrote:

TARGET_LDFLAGS is currently defined in bitbake.conf to contain ${TARGET_LINK_HASH_STYLE} which differs between MIPS and other targets. Since TARGET_LDFLAGS is an exported variable it affects the hash of every shell task even if it is not used.

We don't want native recipe tasks to have different hashes purely because they happen to have been built in order to satisfy dependencies for different MACHINEs since this causes lots of churn in the native sysroot when switching between MACHINEs.

Quoted 7 lines
Quoted 2 lines

Making native.bbclass override TARGET_LDFLAGS to use BUILD_LDFLAGS ensures consistent hashes and is a sensible thing to be doing anyway.

Just to be clear, for a native recipe how is TARGET_LDFLAGS entering the signatures? AIUI there ought to be indirection such that LDFLAGS is used and that is set from BUILD_LDFLAGS for a native recipe rather than TARGET_LDFLAGS.

Because TARGET_LDFLAGS is an exported variable. LDFLAGS is set from TARGET_LDFLAGS but (prior to this patch) only LDFLAGS is set to BUILD_LDFLAGS; TARGET_LDFLAGS remains unchanged.

See thread "export TARGET_LDFLAGS and native sstate" <[email protected]> .

Should I improve the commit message?

Thanks.

Mike.

#3 lore raw
Quoted 23 lines · On Wednesday 16 April 2014 10:53:59 Mike Crowe wrote:
Quoted 13 lines · Paul Eggleton
Quoted 12 lines · On Wednesday 16 April 2014 10:31:36 Mike Crowe wrote:

TARGET_LDFLAGS is currently defined in bitbake.conf to contain ${TARGET_LINK_HASH_STYLE} which differs between MIPS and other targets. Since TARGET_LDFLAGS is an exported variable it affects the hash
of every shell task even if it is not used.

We don't want native recipe tasks to have different hashes purely because
they happen to have been built in order to satisfy dependencies for different MACHINEs since this causes lots of churn in the native sysroot when switching between MACHINEs.

Quoted 8 lines
Quoted 3 lines

Making native.bbclass override TARGET_LDFLAGS to use BUILD_LDFLAGS ensures
consistent hashes and is a sensible thing to be doing anyway.

Just to be clear, for a native recipe how is TARGET_LDFLAGS entering the signatures? AIUI there ought to be indirection such that LDFLAGS is used and that is set from BUILD_LDFLAGS for a native recipe rather than TARGET_LDFLAGS.

Quoted 8 lines

Because TARGET_LDFLAGS is an exported variable. LDFLAGS is set from TARGET_LDFLAGS but (prior to this patch) only LDFLAGS is set to BUILD_LDFLAGS; TARGET_LDFLAGS remains unchanged.

See thread "export TARGET_LDFLAGS and native sstate" <[email protected]> .

Should I improve the commit message?

Sorry, I had missed the other thread. If it's exported then we probably do need it to have the correct value.

Since this doesn't look like something recent though I'd like to understand why it being effectively wrong hasn't been an issue up to this point.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
author
#4 lore raw
Quoted 31 lines · Paul Eggleton
Quoted 30 lines · On Wednesday 16 April 2014 10:53:59 Mike Crowe wrote:
Quoted 13 lines · Paul Eggleton
Quoted 12 lines · On Wednesday 16 April 2014 10:31:36 Mike Crowe wrote:

TARGET_LDFLAGS is currently defined in bitbake.conf to contain ${TARGET_LINK_HASH_STYLE} which differs between MIPS and other targets. Since TARGET_LDFLAGS is an exported variable it affects the hash
of every shell task even if it is not used.

We don't want native recipe tasks to have different hashes purely because
they happen to have been built in order to satisfy dependencies for different MACHINEs since this causes lots of churn in the native sysroot when switching between MACHINEs.

Quoted 8 lines
Quoted 3 lines

Making native.bbclass override TARGET_LDFLAGS to use BUILD_LDFLAGS ensures
consistent hashes and is a sensible thing to be doing anyway.

Just to be clear, for a native recipe how is TARGET_LDFLAGS entering the signatures? AIUI there ought to be indirection such that LDFLAGS is used and that is set from BUILD_LDFLAGS for a native recipe rather than TARGET_LDFLAGS.

Because TARGET_LDFLAGS is an exported variable. LDFLAGS is set from TARGET_LDFLAGS but (prior to this patch) only LDFLAGS is set to BUILD_LDFLAGS; TARGET_LDFLAGS remains unchanged.

See thread "export TARGET_LDFLAGS and native sstate" <[email protected]> .

Quoted 7 lines
Quoted 1 line

Should I improve the commit message?

Sorry, I had missed the other thread. If it's exported then we probably do need it to have the correct value.

Since this doesn't look like something recent though I'd like to understand why it being effectively wrong hasn't been an issue up to this point.

Perhaps few people are building in the same source tree for both MIPS and non-MIPS. I don't think you'd notice otherwise.

Even then we only noticed because it seems to be a good way provoke races in building whilst unpopulating the sysroot (e.g. my recent fix for cmake-native vs libacl.)

Thanks.

Mike.

#5 lore raw
In reply to Paul Eggleton
Quoted 2 lines · Paul Eggleton

Since this doesn't look like something recent though I'd like to understand why it being effectively wrong hasn't been an issue up to this point.

because unless you build something like mips and arm in single workspace you don't have different TARGET_LDFLAGS
and issue remains latent. With mips we change the hash-style since mips can't support gnu style we have to use sysv and that changes the TARGET_LDFLAGS but it should not change the native/nativesdk flags only target flags