Skip to contentSkip to conversation

toolchain/crosstool-NG: update to 1.11.3, use sane defaults

PATCH New Yann E. MORIN 2 participants 8 messages May 21, 2011 – May 22, 2011

lore
Share & tools
lore
#0 lore raw

v2 cover toolchain/crosstool-NG: update to 1.11.3, use sane defaults

Hello All!

This patchset updates the crosstool-NG backend.

Changes since previous post:
- fixed a typo, missing termintaing quote, patch 1
- updating to 1.11.3 also updates the bundled config files, patch 2
- trailing space removed, patch 3

The typo was due to an un-refreshed patch. Sorry about it.

[PATCH 1/3] toolchain/crosstool-NG: bundle one CT-NG config file for each libc familly [PATCH 2/3] toolchain/crosstool-NG: update to 1.11.3
[PATCH 3/3] toolchain/crosstool-NG: fix up ct-ng config file to saner defaults

 .../002-no-sysroot-prompt-in-backend.patch         |   12 -
 toolchain/toolchain-crosstool-ng/Config.in         |   11 +-
 ...sstool-ng.config => crosstool-ng.config-eglibc} |  233 +++++++++++++++-----
 ...osstool-ng.config => crosstool-ng.config-glibc} |  230 +++++++++++++++-----
 ...sstool-ng.config => crosstool-ng.config-uClibc} |  209 +++++++++++++-----
 toolchain/toolchain-crosstool-ng/crosstool-ng.mk   |   32 +++-
 6 files changed, 534 insertions(+), 193 deletions(-)

Regards,
Yann E. MORIN.

#1 lore raw

PATCH v2 1/3 toolchain/crosstool-NG: bundle one CT-NG config file for each libc familly

Currently, the bundled CT-NG config file has no C library configured. It is quite complex to add and/or munge options in this case.

Now, with one config file per libc familly, it becomes easier.

---
 toolchain/toolchain-crosstool-ng/Config.in         |   11 +-
 ...sstool-ng.config => crosstool-ng.config-eglibc} |  128 ++++++++++++++++----
 ...osstool-ng.config => crosstool-ng.config-glibc} |  126 ++++++++++++++++----
 ...sstool-ng.config => crosstool-ng.config-uClibc} |  107 +++++++++++++----
 toolchain/toolchain-crosstool-ng/crosstool-ng.mk   |   18 +++-
 5 files changed, 312 insertions(+), 78 deletions(-)
 copy toolchain/toolchain-crosstool-ng/{crosstool-ng.config => crosstool-ng.config-eglibc} (74%)
 copy toolchain/toolchain-crosstool-ng/{crosstool-ng.config => crosstool-ng.config-glibc} (74%)
 rename toolchain/toolchain-crosstool-ng/{crosstool-ng.config => crosstool-ng.config-uClibc} (76%)
toolchain/toolchain-crosstool-ng/Config.in +7 -4
index 1a10416..3cac808 100644
@@ -38,12 +38,15 @@ config BR2_TOOLCHAIN_CTNG_LIBC
 
 config BR2_TOOLCHAIN_CTNG_CONFIG
 	string "crosstool-NG configuration file to use"
-	default "toolchain/toolchain-crosstool-ng/crosstool-ng.config"
+	default "toolchain/toolchain-crosstool-ng/crosstool-ng.config-uClibc" if BR2_TOOLCHAIN_CTNG_uClibc
+	default "toolchain/toolchain-crosstool-ng/crosstool-ng.config-eglibc" if BR2_TOOLCHAIN_CTNG_eglibc
+	default "toolchain/toolchain-crosstool-ng/crosstool-ng.config-glibc"  if BR2_TOOLCHAIN_CTNG_glibc
 	help
 	  Enter here the crosstool-NG's .config file to use.
-	  If unsure, use the default.
-	  To finetune your toolchain, you can also call:
-	  make ctng-menuconfig
+	  To fine-tune your toolchain, you can also call:
+	    make ctng-menuconfig
+
+	  If unsure, keep the default value.
 
 if BR2_TOOLCHAIN_CTNG_uClibc
 
toolchain/toolchain-crosstool-ng/crosstool-ng.config-eglibc renamed from toolchain/toolchain-crosstool-ng/crosstool-ng.config +104 -24

230 lines not on this page · raw message

toolchain/toolchain-crosstool-ng/crosstool-ng.config-glibc renamed from toolchain/toolchain-crosstool-ng/crosstool-ng.config +103 -23

229 lines not on this page · raw message

toolchain/toolchain-crosstool-ng/crosstool-ng.config-uClibc renamed from toolchain/toolchain-crosstool-ng/crosstool-ng.config +83 -24

209 lines not on this page · raw message

toolchain/toolchain-crosstool-ng/crosstool-ng.mk +15 -3
index 015cd13..ed7f7c6 100644
@@ -20,9 +20,10 @@ CTNG_SOURCE:=crosstool-ng-$(CTNG_VERSION).tar.bz2
 CTNG_DIR:=$(BUILD_DIR)/crosstool-ng-$(CTNG_VERSION)
 CTNG_CAT:=bzcat
 CTNG_PATCH_DIR:=toolchain/toolchain-crosstool-ng
-CTNG_CONFIG_FILE:=$(call qstrip,$(BR2_TOOLCHAIN_CTNG_CONFIG))
 CTNG_UCLIBC_CONFIG_FILE := $(TOPDIR)/toolchain/toolchain-crosstool-ng/uClibc.config
 
+CTNG_CONFIG_FILE:=$(call qstrip,$(BR2_TOOLCHAIN_CTNG_CONFIG))
+
 # Hack! ct-ng is in fact a Makefile script. As such, it accepts all
 # make options, such as -C, which makes it uneeded to chdir prior
 # to calling ct-ng.
@@ -349,13 +350,24 @@ endef
 # Default configuration
 # Depends on top-level .config because it has options we have to shoe-horn
 # into crosstool-NG's .config
-# Only copy the original .config file if we don't have one already
+# Only copy the original .config file if we don't have one already.
+# Check that given config file matches selected C library.
 # We need to call oldconfig twice in a row to ensure the options
 # are correctly set ( eg. if an option is new, then the initial sed
 # can't do anything about it ) Ideally, this should go in oldconfig
 # itself, but it's much easier to handle here.
 $(CTNG_DIR)/.config: $(CTNG_CONFIG_FILE) $(CTNG_DIR)/ct-ng $(CONFIG_DIR)/.config
-	$(Q)[ -f $@ ] && cp -a $@ [email protected] || cp -f $< $@
+	$(Q)if [ ! -f $@ ]; then                                                        \
+	        libc="$$(awk -F '"' '$$1=="CT_LIBC=" { print $$2; }' "$<")";            \
+	        if [ "$${libc}" != "$(BR2_TOOLCHAIN_CTNG_LIBC)" ]; then                 \
+	            echo "* Inconsistency in crosstool-NG config file '$<'";            \
+	            echo "* - buildroot configured for '$(BR2_TOOLCHAIN_CTNG_LIBC)'";   \
+	            echo "* - given config file for '$${libc}'";                        \
+	            exit 1;                                                             \
+	        fi;                                                                     \
+	        cp -f $< $@;                                                            \
+	    fi
+	$(Q)cp -a $@ [email protected]
 	$(call ctng-oldconfig,$@)
 	$(call ctng-oldconfig,$@)
 	$(call ctng-check-config-changed,$@,[email protected])
Signature · 1 line
1.7.2.3
#2 lore raw

PATCH v2 2/3 toolchain/crosstool-NG: update to 1.11.3

In reply to Yann E. MORIN

1.11.3 is the latest stable version, and it has a few improvements we'll find usefull. For example, it hasa a boolean option for disabling the {,e}glibc fortified build (instead of requiring us to shoehorn it in extra cflags.

Update the config files.

---
 .../002-no-sysroot-prompt-in-backend.patch         |   12 --
 .../crosstool-ng.config-eglibc                     |  127 +++++++++++++-------
 .../crosstool-ng.config-glibc                      |  126 +++++++++++++-------
 .../crosstool-ng.config-uClibc                     |  122 ++++++++++++-------
 toolchain/toolchain-crosstool-ng/crosstool-ng.mk   |    2 +-
 5 files changed, 242 insertions(+), 147 deletions(-)
 delete mode 100644 toolchain/toolchain-crosstool-ng/002-no-sysroot-prompt-in-backend.patch
toolchain/toolchain-crosstool-ng/002-no-sysroot-prompt-in-backend.patch deleted +0 -12
deleted file mode 100644
index 4c3426a..0000000
@@ -1,12 +0,0 @@
-diff --git a/config/toolchain.in b/config/toolchain.in
---- a/config/toolchain.in
-+++ b/config/toolchain.in
-@@ -20,7 +20,7 @@
- 
- config SYSROOT_NAME
-     string
--    prompt "sysroot directory name"
-+    prompt "sysroot directory name" if ! BACKEND
-     depends on USE_SYSROOT
-     default "sysroot"
-     help
toolchain/toolchain-crosstool-ng/crosstool-ng.config-eglibc +82 -45

253 lines not on this page · raw message

toolchain/toolchain-crosstool-ng/crosstool-ng.config-glibc +81 -45

252 lines not on this page · raw message

toolchain/toolchain-crosstool-ng/crosstool-ng.config-uClibc +78 -44

236 lines not on this page · raw message

toolchain/toolchain-crosstool-ng/crosstool-ng.mk +1 -1
index ed7f7c6..b506651 100644
@@ -14,7 +14,7 @@ uclibc: dependencies $(STAMP_DIR)/ct-ng-toolchain-installed
 # Internal variables
 
 # Crostool-NG hard-coded configuration options
-CTNG_VERSION:=1.10.1
+CTNG_VERSION:=1.11.3
 CTNG_SITE:=http://crosstool-ng.org/download/crosstool-ng/
 CTNG_SOURCE:=crosstool-ng-$(CTNG_VERSION).tar.bz2
 CTNG_DIR:=$(BUILD_DIR)/crosstool-ng-$(CTNG_VERSION)
Signature · 1 line
1.7.2.3
#3 lore raw

PATCH v2 3/3 toolchain/crosstool-NG: fix up ct-ng config file to saner defaults

In reply to Yann E. MORIN

Jacmet on IRC reported some build failures for different targets. They were of two kinds:
- missing/unknown stack unwinding support
- missing *_chk functions

The first is about configure not being able to automagically determine if stack unwinding support is available for the target. The second is about fortified build forgetting to build the fortified functions. This applies to both glibc and eglibc.

After some discussions on IRC with Jacmet, it appears that we can safely assume both of the following:
- virtually all targets of buildroot will have stack unwinding support
- we do not care about fortified builds (so far)

So, update the bundled crosstool-NG .config file to saner defaults:
- force unwind support
- disable fortified builds

---
 toolchain/toolchain-crosstool-ng/crosstool-ng.mk |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
toolchain/toolchain-crosstool-ng/crosstool-ng.mk +12 -0
index b506651..8319fc3 100644
@@ -328,6 +328,18 @@ $(CTNG_DIR)/libc.config: $(CTNG_UCLIBC_CONFIG_FILE) $(CONFIG_DIR)/.config
 endif # LIBC is uClibc
 
 #--------------
+# glibc/eglibc specific options
+ifeq ($(BR2_TOOLCHAIN_CTNG_glibc)$(BR2_TOOLCHAIN_CTNG_eglibc),y)
+
+# Force unwind support
+CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_LIBC_GLIBC_FORCE_UNWIND) is not set:\1=y:;
+
+# Force non-fortified build
+CTNG_FIX_DOT_CONFIG_SED += s:^(CT_LIBC_ENABLE_FORTIFIED_BUILD)=y:# \1 is not set:;
+
+endif # LIBC is glibc or eglibc
+
+#--------------
 # Small functions to shoe-horn the above into crosstool-NG's .config
 
 # Function to update the .config
Signature · 1 line
1.7.2.3
#4 lore raw

PATCH v2 3/3 toolchain/crosstool-NG: fix up ct-ng config file to saner defaults

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Yann> Jacmet on IRC reported some build failures for different targets. Yann> They were of two kinds:
Yann> - missing/unknown stack unwinding support
Yann> - missing *_chk functions

Yann> The first is about configure not being able to automagically determine Yann> if stack unwinding support is available for the target. The second is Yann> about fortified build forgetting to build the fortified functions. Yann> This applies to both glibc and eglibc.

Yann> After some discussions on IRC with Jacmet, it appears that we can Yann> safely assume both of the following:
Yann> - virtually all targets of buildroot will have stack unwinding support Yann> - we do not care about fortified builds (so far)

Yann> So, update the bundled crosstool-NG .config file to saner defaults:
Yann> - force unwind support
Yann> - disable fortified builds

Yann> Reported-by: Peter Korsgaard <[email protected]> Yann> Signed-off-by: "Yann E. MORIN" <[email protected]> Yann> ---

 Yann>  toolchain/toolchain-crosstool-ng/crosstool-ng.mk |   12 ++++++++++++

Yann> 1 files changed, 12 insertions(+), 0 deletions(-)

Yann> diff --git a/toolchain/toolchain-crosstool-ng/crosstool-ng.mk b/toolchain/toolchain-crosstool-ng/crosstool-ng.mk Yann> index b506651..8319fc3 100644
Yann> --- a/toolchain/toolchain-crosstool-ng/crosstool-ng.mk
Yann> +++ b/toolchain/toolchain-crosstool-ng/crosstool-ng.mk
Yann> @@ -328,6 +328,18 @@ $(CTNG_DIR)/libc.config: $(CTNG_UCLIBC_CONFIG_FILE) $(CONFIG_DIR)/.config Yann> endif # LIBC is uClibc

Yann> #--------------
Yann> +# glibc/eglibc specific options
Yann> +ifeq ($(BR2_TOOLCHAIN_CTNG_glibc)$(BR2_TOOLCHAIN_CTNG_eglibc),y) Yann> +
Yann> +# Force unwind support
Yann> +CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_LIBC_GLIBC_FORCE_UNWIND) is not set:\1=y:; Yann> +
Yann> +# Force non-fortified build
Yann> +CTNG_FIX_DOT_CONFIG_SED += s:^(CT_LIBC_ENABLE_FORTIFIED_BUILD)=y:# \1 is not set:;

Does that build for you? For me it fails with:

sed -r -e ' s:^(CT_INSTALL_DIR_RO)=y:# \1 is not set:; s:^(|# )(CT_ARCH_[BL]E).*:# \2 is not set:; s:^# (CT_ARCH_LE) is not set:\1=y:; s:^(|# )(CT_ARCH_(32|64)).*:# \2 is not set:; s:^# (CT_ARCH_) is not set:\1=y:; s:^(CT_TARGET_VENDOR)=.*:\1="unknown":; s:^(CT_TARGET_ALIAS)=.*:\1="arm-linux":; s:^(CT_CC_PKGVERSION)="(.*)":\1="crosstool-NG 1.11.3 - buildroot 2011.05-rc1-00005-ge83c4f6":; s:^# (CT_ARCH_USE_MMU) is not set:\1=y:; s:^(CT_CC_LANG_CXX)=.*:# \1 is not set:; s:^(CT_ARCH_ARCH)=.*:\1="armv5te":; s:^(CT_ARCH_TUNE)=.*:\1="arm926ej-s":; s:^(CT_ARCH_FLOAT_HW)=y:# \1 is not set:; s:^# (CT_ARCH_FLOAT_SW) is not set:\1=y:; s:^(|# )(CT_THREADS_NONE).*:# \2 is not set:; s:^(|# )(CT_THREADS_LINUXTHREADS).*:# \2 is not set:; s:^(|# )(CT_THREADS_NPTL).*:# \2 is not set:; s:^(|# )(CT_THREADS_NPTL).*:\2=y:; s:^# (CT_LIBC_GLIBC_FORCE_UNWIND) is not set:\1=y:; s:^(CT_LIBC_ENABLE_FORTIFIED_BUILD)=y:' /home/peko/source/buildroot/output/build/crosstool-ng-1.11.3/.config

sed: -e expression #1, char 892: unterminated `s' command

E.G. the replace part of the 'Force non-fortified build' line gets removed as # is the comment character in makefiles. The fix is simply to use \#.

I'll fix that up when I commit.

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

PATCH v2 3/3 toolchain/crosstool-NG: fix up ct-ng config file to saner defaults

Peter, All,

Quoted 1 line · On Sunday 22 May 2011 10:18:46 Peter Korsgaard wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

[--SNIP--]

Quoted 11 lines

Yann> #--------------
Yann> +# glibc/eglibc specific options
Yann> +ifeq ($(BR2_TOOLCHAIN_CTNG_glibc)$(BR2_TOOLCHAIN_CTNG_eglibc),y) Yann> +
Yann> +# Force unwind support
Yann> +CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_LIBC_GLIBC_FORCE_UNWIND) is not set:\1=y:; Yann> +
Yann> +# Force non-fortified build
Yann> +CTNG_FIX_DOT_CONFIG_SED += s:^(CT_LIBC_ENABLE_FORTIFIED_BUILD)=y:# \1 is not set:;

Does that build for you? For me it fails with:

[--SNIP--]

Quoted 5 lines

sed: -e expression #1, char 892: unterminated `s' command

E.G. the replace part of the 'Force non-fortified build' line gets removed as # is the comment character in makefiles. The fix is simply to use \#.

Arg... I did yet forgot to refresh the patch yet again. Some combo of stgit and send-email issues due to PEBKAC... :-]

Quoted 1 line

I'll fix that up when I commit.

Thank you.

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.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

v2 cover toolchain/crosstool-NG: update to 1.11.3, use sane defaults

In reply to Yann E. MORIN
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Yann> Hello All!
Yann> This patchset updates the crosstool-NG backend.

Yann> Changes since previous post:
Yann> - fixed a typo, missing termintaing quote, patch 1

Thanks. I debugged that one as well yesterday.

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

v2 cover toolchain/crosstool-NG: update to 1.11.3, use sane defaults

In reply to Yann E. MORIN
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Yann> Hello All!
Yann> This patchset updates the crosstool-NG backend.

Yann> Changes since previous post:
Yann> - fixed a typo, missing termintaing quote, patch 1 Yann> - updating to 1.11.3 also updates the bundled config files, patch 2 Yann> - trailing space removed, patch 3

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard