Skip to contentSkip to conversation

toolchain: Correct test for external tools symlink creation

PATCH New Stany MARCEL 3 participants 8 messages Nov 1, 2011 – Nov 2, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 toolchain: Correct test for external tools symlink creation

When the external tools chain is installed in a path that match one of the first case test, all symlink are created to the external wrapper. The proposed solution is to test only the base name not the full path.

---
 toolchain/toolchain-external/ext-tool.mk |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
toolchain/toolchain-external/ext-tool.mk +2 -2
index 8287916..572917f 100644
@@ -318,9 +318,9 @@ $(STAMP_DIR)/ext-toolchain-installed: $(TOOLCHAIN_EXTERNAL_DEPENDENCIES)
 $(HOST_DIR)/usr/bin/ext-toolchain-wrapper: $(STAMP_DIR)/ext-toolchain-installed
 	mkdir -p $(HOST_DIR)/usr/bin; cd $(HOST_DIR)/usr/bin; \
 	for i in $(TOOLCHAIN_EXTERNAL_CROSS)*; do \
-		case "$$i" in \
+		base=$${i##*/}; \
+		case "$$base" in \
 		*cc|*cc-*|*++|*++-*|*cpp) \
-			base=$${i##*/}; \
 			ln -sf $(@F) $$base; \
 			;; \
 		*) \
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/2 toolchain: Add the possibility to have a mcpu option with wrapper

Permit to define the mcpu of the external toolchain wrapper, based on BR2_GCC_TARGET_CPU.

---
 toolchain/toolchain-external/ext-tool.mk           |    6 ++++++
 .../toolchain-external/ext-toolchain-wrapper.c     |    3 +++
 2 files changed, 9 insertions(+), 0 deletions(-)
toolchain/toolchain-external/ext-tool.mk +6 -0
index 572917f..640db5e 100644
@@ -129,6 +129,8 @@ TOOLCHAIN_EXTERNAL_WRAPPER_ARGS = \
 CC_TARGET_TUNE_:=$(call qstrip,$(BR2_GCC_TARGET_TUNE))
 CC_TARGET_ARCH_:=$(call qstrip,$(BR2_GCC_TARGET_ARCH))
 CC_TARGET_ABI_:=$(call qstrip,$(BR2_GCC_TARGET_ABI))
+CC_TARGET_CPU_:=$(call qstrip,$(BR2_GCC_TARGET_CPU))
+
 
 # march/mtune/floating point mode needs to be passed to the external toolchain
 # to select the right multilib variant
@@ -144,6 +146,10 @@ ifneq ($(CC_TARGET_ABI_),)
 TOOLCHAIN_EXTERNAL_CFLAGS += -mabi=$(CC_TARGET_ABI_)
 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ABI='"$(CC_TARGET_ABI_)"'
 endif
+ifneq ($(CC_TARGET_CPU_),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -mcpu=$(CC_TARGET_CPU_)
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_CPU='"$(CC_TARGET_CPU_)"'
+endif
 
 ifeq ($(BR2_SOFT_FLOAT),y)
 TOOLCHAIN_EXTERNAL_CFLAGS += -msoft-float
toolchain/toolchain-external/ext-toolchain-wrapper.c +3 -0
index 3e23061..b1a4fcb 100644
@@ -31,6 +31,9 @@ static char *predef_args[] = {
 #ifdef BR_ABI
 	"-mabi=" BR_ABI,
 #endif
+#ifdef BR_CPU
+	"-mcpu=" BR_CPU,
+#endif
 #ifdef BR_SOFTFLOAT
 	"-msoft-float",
 #endif /* BR_SOFTFLOAT */
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/2 toolchain: Add the possibility to have a mcpu option with wrapper

Stany, All,

Quoted 14 lines · On Tuesday 01 November 2011 01:53:39 Stany MARCEL wrote:

Permit to define the mcpu of the external toolchain wrapper, based on BR2_GCC_TARGET_CPU.

---
 toolchain/toolchain-external/ext-tool.mk           |    6 ++++++
 .../toolchain-external/ext-toolchain-wrapper.c     |    3 +++
 2 files changed, 9 insertions(+), 0 deletions(-)
toolchain/toolchain-external/ext-tool.mk +0 -0
index 572917f..640db5e 100644

toolchain/toolchain-external/ext-tool.mk TOOLCHAIN_EXTERNAL_WRAPPER_ARGS = \ · line 133

Quoted 5 lines
toolchain/toolchain-external/ext-tool.mk +2 -0
@@ -129,6 +129,8 @@ TOOLCHAIN_EXTERNAL_WRAPPER_ARGS = \
 CC_TARGET_TUNE_:=$(call qstrip,$(BR2_GCC_TARGET_TUNE))
 CC_TARGET_ARCH_:=$(call qstrip,$(BR2_GCC_TARGET_ARCH))
 CC_TARGET_ABI_:=$(call qstrip,$(BR2_GCC_TARGET_ABI))
+CC_TARGET_CPU_:=$(call qstrip,$(BR2_GCC_TARGET_CPU))
+

Spurious empty line.

toolchain/toolchain-external/ext-tool.mk ifneq ($(CC_TARGET_ABI_),) · line 152

Quoted 10 lines
toolchain/toolchain-external/ext-tool.mk +4 -0
 # march/mtune/floating point mode needs to be passed to the external toolchain
 # to select the right multilib variant
@@ -144,6 +146,10 @@ ifneq ($(CC_TARGET_ABI_),)
 TOOLCHAIN_EXTERNAL_CFLAGS += -mabi=$(CC_TARGET_ABI_)
 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ABI='"$(CC_TARGET_ABI_)"'
 endif
+ifneq ($(CC_TARGET_CPU_),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -mcpu=$(CC_TARGET_CPU_)
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_CPU='"$(CC_TARGET_CPU_)"'
+endif

Probably, you could try to stick the CPU setting near the ARCH and TUNE settings (ie. just before ABI, just after TUNE).

Quoted 8 lines
toolchain/toolchain-external/ext-tool.mk +0 -0
 ifeq ($(BR2_SOFT_FLOAT),y)
 TOOLCHAIN_EXTERNAL_CFLAGS += -msoft-float
toolchain/toolchain-external/ext-toolchain-wrapper.c +0 -0
index 3e23061..b1a4fcb 100644

toolchain/toolchain-external/ext-toolchain-wrapper.c static char *predef_args[] = { · line 36

Quoted 6 lines
toolchain/toolchain-external/ext-toolchain-wrapper.c +3 -0
@@ -31,6 +31,9 @@ static char *predef_args[] = {
 #ifdef BR_ABI
 	"-mabi=" BR_ABI,
 #endif
+#ifdef BR_CPU
+	"-mcpu=" BR_CPU,
+#endif

Ditto as above.

toolchain/toolchain-external/ext-toolchain-wrapper.c static char *predef_args[] = { · line 39

Quoted 4 lines
toolchain/toolchain-external/ext-toolchain-wrapper.c +0 -0
 #ifdef BR_SOFTFLOAT
 	"-msoft-float",
 #endif /* BR_SOFTFLOAT */

Otherwise, looks good to me:

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH v2 2/2 toolchain: Add the possibility to have a mcpu option with wrapper

Permit to define the mcpu of the external toolchain wrapper, based on BR2_GCC_TARGET_CPU.

---

Changes for v2:
* Spurious empty line removed
* CPU setting positionned above ABI one

 toolchain/toolchain-external/ext-tool.mk           |    5 +++++
 .../toolchain-external/ext-toolchain-wrapper.c     |    3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)
toolchain/toolchain-external/ext-tool.mk +5 -0
index 572917f..a52621c 100644
@@ -127,6 +127,7 @@ TOOLCHAIN_EXTERNAL_WRAPPER_ARGS = \
 	-DBR_SYSROOT='"$(STAGING_DIR)"'
 
 CC_TARGET_TUNE_:=$(call qstrip,$(BR2_GCC_TARGET_TUNE))
+CC_TARGET_CPU_:=$(call qstrip,$(BR2_GCC_TARGET_CPU))
 CC_TARGET_ARCH_:=$(call qstrip,$(BR2_GCC_TARGET_ARCH))
 CC_TARGET_ABI_:=$(call qstrip,$(BR2_GCC_TARGET_ABI))
 
@@ -140,6 +141,10 @@ ifneq ($(CC_TARGET_ARCH_),)
 TOOLCHAIN_EXTERNAL_CFLAGS += -march=$(CC_TARGET_ARCH_)
 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ARCH='"$(CC_TARGET_ARCH_)"'
 endif
+ifneq ($(CC_TARGET_CPU_),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -mcpu=$(CC_TARGET_CPU_)
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_CPU='"$(CC_TARGET_CPU_)"'
+endif
 ifneq ($(CC_TARGET_ABI_),)
 TOOLCHAIN_EXTERNAL_CFLAGS += -mabi=$(CC_TARGET_ABI_)
 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ABI='"$(CC_TARGET_ABI_)"'
toolchain/toolchain-external/ext-toolchain-wrapper.c +3 -0
index 3e23061..cc404f3 100644
@@ -28,6 +28,9 @@ static char *predef_args[] = {
 #ifdef BR_TUNE
 	"-mtune=" BR_TUNE,
 #endif /* BR_TUNE */
+#ifdef BR_CPU
+	"-mcpu=" BR_CPU,
+#endif
 #ifdef BR_ABI
 	"-mabi=" BR_ABI,
 #endif

--
1.7.1

#4 lore raw

PATCH v2 2/2 toolchain: Add the possibility to have a mcpu option with wrapper

Stany, All,

Quoted 4 lines · On Tuesday 01 November 2011 13:19:16 Stany MARCEL wrote:

Permit to define the mcpu of the external toolchain wrapper, based on BR2_GCC_TARGET_CPU.

Peter, I think this should go in before -rc as well.

Regards,
Yann E. MORIN.

Quoted 56 lines

---

Changes for v2:
* Spurious empty line removed
* CPU setting positionned above ABI one

 toolchain/toolchain-external/ext-tool.mk           |    5 +++++
 .../toolchain-external/ext-toolchain-wrapper.c     |    3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)
toolchain/toolchain-external/ext-tool.mk +5 -0
index 572917f..a52621c 100644
@@ -127,6 +127,7 @@ TOOLCHAIN_EXTERNAL_WRAPPER_ARGS = \
 	-DBR_SYSROOT='"$(STAGING_DIR)"'
 
 CC_TARGET_TUNE_:=$(call qstrip,$(BR2_GCC_TARGET_TUNE))
+CC_TARGET_CPU_:=$(call qstrip,$(BR2_GCC_TARGET_CPU))
 CC_TARGET_ARCH_:=$(call qstrip,$(BR2_GCC_TARGET_ARCH))
 CC_TARGET_ABI_:=$(call qstrip,$(BR2_GCC_TARGET_ABI))
 
@@ -140,6 +141,10 @@ ifneq ($(CC_TARGET_ARCH_),)
 TOOLCHAIN_EXTERNAL_CFLAGS += -march=$(CC_TARGET_ARCH_)
 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ARCH='"$(CC_TARGET_ARCH_)"'
 endif
+ifneq ($(CC_TARGET_CPU_),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -mcpu=$(CC_TARGET_CPU_)
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_CPU='"$(CC_TARGET_CPU_)"'
+endif
 ifneq ($(CC_TARGET_ABI_),)
 TOOLCHAIN_EXTERNAL_CFLAGS += -mabi=$(CC_TARGET_ABI_)
 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ABI='"$(CC_TARGET_ABI_)"'
toolchain/toolchain-external/ext-toolchain-wrapper.c +3 -1
index 3e23061..cc404f3 100644
@@ -28,6 +28,9 @@ static char *predef_args[] = {
 #ifdef BR_TUNE
 	"-mtune=" BR_TUNE,
 #endif /* BR_TUNE */
+#ifdef BR_CPU
+	"-mcpu=" BR_CPU,
+#endif
 #ifdef BR_ABI
 	"-mabi=" BR_ABI,
 #endif
--

1.7.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH v2 2/2 toolchain: Add the possibility to have a mcpu option with wrapper

In reply to Stany MARCEL
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Stany" == Stany MARCEL <[email protected]> writes:

Stany> Permit to define the mcpu of the external toolchain wrapper, based on Stany> BR2_GCC_TARGET_CPU.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#6 lore raw

PATCH 1/2 toolchain: Correct test for external tools symlink creation

In reply to Stany MARCEL

Stany, All,

Quoted 6 lines · On Tuesday 01 November 2011 01:53:38 Stany MARCEL wrote:

When the external tools chain is installed in a path that match one of the first case test, all symlink are created to the external wrapper. The proposed solution is to test only the base name not the full path.

Peter, this should go in before the -rc, if possible.

Quoted 21 lines
---
 toolchain/toolchain-external/ext-tool.mk |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
toolchain/toolchain-external/ext-tool.mk +2 -2
index 8287916..572917f 100644
@@ -318,9 +318,9 @@ $(STAMP_DIR)/ext-toolchain-installed: $(TOOLCHAIN_EXTERNAL_DEPENDENCIES)
 $(HOST_DIR)/usr/bin/ext-toolchain-wrapper: $(STAMP_DIR)/ext-toolchain-installed
 	mkdir -p $(HOST_DIR)/usr/bin; cd $(HOST_DIR)/usr/bin; \
 	for i in $(TOOLCHAIN_EXTERNAL_CROSS)*; do \
-		case "$$i" in \
+		base=$${i##*/}; \
+		case "$$base" in \
 		*cc|*cc-*|*++|*++-*|*cpp) \
-			base=$${i##*/}; \
 			ln -sf $(@F) $$base; \
 			;; \
 		*) \
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#7 lore raw

PATCH 1/2 toolchain: Correct test for external tools symlink creation

In reply to Stany MARCEL
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Stany" == Stany MARCEL <[email protected]> writes:

Stany> When the external tools chain is installed in a path that match one of Stany> the first case test, all symlink are created to the external Stany> wrapper. The proposed solution is to test only the base name not the Stany> full path.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard