Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 00/12] Toolchain updates
@ 2013-08-28  6:35 Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 01/12] package/Makefile.in: fix incorrect comment Thomas Petazzoni
                   ` (11 more replies)
  0 siblings, 12 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-28  6:35 UTC (permalink / raw)
  To: buildroot

Hello,

Here is a set of updates/improvements to the internal toolchain
backend (with some impacts on the external toolchain one). Mainly it:

 * Allows to build the toolchain with only two passes of gcc build as
   opposed to three. Of course, this is only possible in the
   appropriate situations. This patch had already been posted
   previously to the list, and was rebased on top of current master.

 * Fixes Fortran and Objective-C support, moves the C++ option close
   to the one for Fortran and Objective-C.

 * Adds support for glibc, in addition to eglibc. Note that as
   suggested by Arnout, I'm proposing a single package to handle both
   libraries.

 * Refactors the Stack Smashing Protection support.

 * Refactors the Mudflap support. Note however that I didn't manage to
   get a Busybox system with mudflap enabled to boot. I am personaly
   not that much interested in mudflap support, so unless someone
   steps up to look at the issue, I think I'll propose to remove
   Mudflap support entirely.

 * Makes a small number of related cleanups.

Thomas Petazzoni (12):
  package/Makefile.in: fix incorrect comment
  eglibc: libstdc++ is not part of the C library
  toolchain-internal: skip gcc-intermediate when possible
  gcc: fix Fortran support
  gcc: fix Objective-C support
  gcc: move C++ support option next to Fortran/Objective-C
  toolchain: add support for glibc
  gcc/gcc-final: use the common HOST_GCC_CONFIGURE_SYMLINK macro
  gcc: force symlink creation
  toolchain: refactor Stack Smashing Protection support
  toolchain: move elf2flt option inclusion to
    toolchain-buildroot/Config.in
  toolchain: improve mudflap support

 Config.in                                    | 37 +++++++++++++++
 package/Makefile.in                          | 17 +++++--
 package/gcc/Config.in.host                   | 53 ++++++++++++++++++---
 package/gcc/gcc-final/gcc-final.mk           | 31 ++++++++----
 package/gcc/gcc-initial/gcc-initial.mk       |  8 ++++
 package/gcc/gcc.mk                           |  8 +++-
 package/{eglibc/eglibc.mk => glibc/glibc.mk} | 70 ++++++++++++++++------------
 package/psmisc/psmisc.mk                     |  2 +-
 package/uclibc/Config.in                     | 11 +++++
 package/uclibc/uclibc.mk                     |  5 +-
 toolchain/Config.in                          | 11 ++++-
 toolchain/helpers.mk                         | 15 +++++-
 toolchain/toolchain-buildroot/Config.in      | 25 +++++++++-
 toolchain/toolchain-buildroot/Config.in.2    | 31 ------------
 toolchain/toolchain-common.in                |  6 +++
 toolchain/toolchain-external/Config.in       | 18 +++++++
 toolchain/toolchain-external/ext-tool.mk     | 11 +++++
 17 files changed, 270 insertions(+), 89 deletions(-)
 rename package/{eglibc/eglibc.mk => glibc/glibc.mk} (58%)
 delete mode 100644 toolchain/toolchain-buildroot/Config.in.2

-- 
1.8.1.2

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 01/12] package/Makefile.in: fix incorrect comment
  2013-08-28  6:35 [Buildroot] [PATCH 00/12] Toolchain updates Thomas Petazzoni
@ 2013-08-28  6:35 ` Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 02/12] eglibc: libstdc++ is not part of the C library Thomas Petazzoni
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-28  6:35 UTC (permalink / raw)
  To: buildroot

The TARGET_{CC,CXX,LD,...} variables no longer contain any --sysroot
option, since we're now using a toolchain wrapper for external
toolchains.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/Makefile.in | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/package/Makefile.in b/package/Makefile.in
index 91ae1b9..0b1c33a 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -143,8 +143,7 @@ endif
 # Quotes are needed for spaces et al in path components.
 TARGET_PATH="$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(HOST_DIR)/usr/sbin/:$(PATH)"
 
-# Define TARGET_xx variables for all common binutils/gcc tools by
-# including the --sysroot option where necessary.
+# Define TARGET_xx variables for all common binutils/gcc
 TARGET_AR       = $(TARGET_CROSS)ar
 TARGET_AS       = $(TARGET_CROSS)as
 TARGET_CC       = $(TARGET_CROSS)gcc
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 02/12] eglibc: libstdc++ is not part of the C library
  2013-08-28  6:35 [Buildroot] [PATCH 00/12] Toolchain updates Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 01/12] package/Makefile.in: fix incorrect comment Thomas Petazzoni
@ 2013-08-28  6:35 ` Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 03/12] toolchain-internal: skip gcc-intermediate when possible Thomas Petazzoni
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-28  6:35 UTC (permalink / raw)
  To: buildroot

For some reason, the eglibc.mk file was trying to install libstdc++.so
from eglibc to the target. But the C++ standard library is provided by
GCC, not by the C library.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/eglibc/eglibc.mk | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/package/eglibc/eglibc.mk b/package/eglibc/eglibc.mk
index 8873a06..fe12299 100644
--- a/package/eglibc/eglibc.mk
+++ b/package/eglibc/eglibc.mk
@@ -89,17 +89,10 @@ ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
 EGLIBC_LIBS_LIB += libthread_db.so
 endif
 
-ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
-EGLIBC_LIBS_USR_LIB += libstdc++.so
-endif
-
 define EGLIBC_INSTALL_TARGET_CMDS
 	for libs in $(EGLIBC_LIBS_LIB); do \
 		$(call copy_toolchain_lib_root,$(STAGING_DIR)/,,lib,$$libs,/lib) ; \
 	done
-	for libs in $(EGLIBC_LIBS_USR_LIB); do \
-		$(call copy_toolchain_lib_root,$(STAGING_DIR)/,,lib,$$libs,/usr/lib) ; \
-	done
 endef
 
 $(eval $(autotools-package))
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 03/12] toolchain-internal: skip gcc-intermediate when possible
  2013-08-28  6:35 [Buildroot] [PATCH 00/12] Toolchain updates Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 01/12] package/Makefile.in: fix incorrect comment Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 02/12] eglibc: libstdc++ is not part of the C library Thomas Petazzoni
@ 2013-08-28  6:35 ` Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 04/12] gcc: fix Fortran support Thomas Petazzoni
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-28  6:35 UTC (permalink / raw)
  To: buildroot

When NPTL support was introduced, gcc required a three stages build
process. Since gcc 4.7, this is no longer necessary, and it is
possible to get back to a two stages build process. This patch takes
advantage of this, by doing a two stages build process when possible.

We introduce a few hidden kconfig options:

 * BR2_GCC_VERSION_NEEDS_THREE_STAGE_BUILD, which is set by the gcc
   Config.in logic to indicate that the compiler might need a three
   stages build. Currently, all versions prior to 4.7.x are selecting
   this kconfig option.

 * BR2_TOOLCHAIN_LIBC_NEEDS_THREE_STAGE_BUILD, which indicates whether
   the C library might need a three stages build. This is the case for
   eglibc, and uClibc when NPTL is enabled.

 * BR2_TOOLCHAIN_NEEDS_THREE_STAGE_BUILD finally is enabled when both
   of the previous options are enabled. It indicates that a three
   stages build is actually needed.

In addition to those options, the uClibc/gcc build logic is changed to
take use only a two stages build process when possible.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/eglibc/eglibc.mk               |  5 +++--
 package/gcc/Config.in.host             | 11 +++++++++++
 package/gcc/gcc-initial/gcc-initial.mk |  8 ++++++++
 package/uclibc/Config.in               |  1 +
 package/uclibc/uclibc.mk               |  5 +++--
 toolchain/Config.in                    |  9 +++++++++
 6 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/package/eglibc/eglibc.mk b/package/eglibc/eglibc.mk
index fe12299..0ed908d 100644
--- a/package/eglibc/eglibc.mk
+++ b/package/eglibc/eglibc.mk
@@ -14,8 +14,9 @@ EGLIBC_LICENSE_FILES = libc/COPYING libc/COPYING.LIB libc/LICENSES
 # cross-compiler and the kernel headers
 EGLIBC_DEPENDENCIES = host-gcc-initial linux-headers host-gawk
 
-# Before eglibc is built, we must have the second stage cross-compiler
-eglibc-build: host-gcc-intermediate
+# Before eglibc is built, we must have the second stage
+# cross-compiler, for some gcc versions
+eglibc-build: $(if $(BR2_TOOLCHAIN_NEEDS_THREE_STAGE_BUILD),host-gcc-intermediate)
 
 EGLIBC_SUBDIR = build
 
diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index a6acaa2..7e6df2d 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -3,6 +3,12 @@ comment "GCC Options"
 config BR2_GCC_NEEDS_MPC
 	bool
 
+# Until gcc 4.7, a three stage build process was needed when using
+# NPTL. This hidden option tells whether gcc is a version that
+# requires this three stage build process.
+config BR2_GCC_VERSION_NEEDS_THREE_STAGE_BUILD
+	bool
+
 choice
 	prompt "GCC compiler Version"
 	default BR2_GCC_VERSION_4_4_X if BR2_sparc_sparchfleon || BR2_sparc_sparchfleonv8 || BR2_sparc_sparcsfleon || BR2_sparc_sparcsfleonv8
@@ -16,11 +22,13 @@ choice
 	config BR2_GCC_VERSION_4_2_2_AVR32_2_1_5
 		depends on BR2_avr32
 		bool "gcc 4.2.2-avr32-2.1.5"
+		select BR2_GCC_VERSION_NEEDS_THREE_STAGE_BUILD
 
 	config BR2_GCC_VERSION_4_3_X
 		depends on !BR2_arc && !BR2_avr32 && !BR2_sparc_sparchfleon && !BR2_sparc_sparchfleonv8 && !BR2_sparc_sparcsfleon && !BR2_sparc_sparcsfleonv8 && !BR2_cortex_a5 && !BR2_cortex_a7 && !BR2_cortex_a8 && !BR2_cortex_a9 && !BR2_cortex_a15 && !BR2_x86_atom && !BR2_powerpc_e300c2 && !BR2_powerpc_e300c3 && !BR2_powerpc_e500mc && !BR2_powerpc_464 && !BR2_powerpc_464fp && !BR2_powerpc_476 && !BR2_powerpc_476fp && !BR2_fa526 && !BR2_pj4
 		depends on !BR2_ARM_EABIHF
 		bool "gcc 4.3.x"
+		select BR2_GCC_VERSION_NEEDS_THREE_STAGE_BUILD
 
 	config BR2_GCC_VERSION_4_4_X
 		depends on !BR2_arc && !BR2_avr32 && !BR2_cortex_a5 && !BR2_cortex_a7 && !BR2_cortex_a15 && !BR2_x86_atom && !BR2_powerpc_476 && !BR2_powerpc_476fp && !BR2_fa526 && !BR2_pj4
@@ -29,6 +37,7 @@ choice
 		depends on !BR2_ARM_EABIHF
 		# VFPv4 support appeared in gcc 4.5
 		depends on !BR2_ARM_FPU_VFPV4 && !BR2_ARM_FPU_VFPV4D16
+		select BR2_GCC_VERSION_NEEDS_THREE_STAGE_BUILD
 
 	config BR2_GCC_VERSION_4_5_X
 		depends on !BR2_arc && !BR2_avr32 && !BR2_cortex_a7 && !BR2_cortex_a15 && !BR2_sparc_sparchfleon && !BR2_sparc_sparchfleonv8 && !BR2_sparc_sparcsfleon && !BR2_sparc_sparcsfleonv8 && !BR2_fa526 && !BR2_pj4
@@ -36,11 +45,13 @@ choice
 		# ARM EABIhf support appeared in gcc 4.6
 		depends on !BR2_ARM_EABIHF
 		bool "gcc 4.5.x"
+		select BR2_GCC_VERSION_NEEDS_THREE_STAGE_BUILD
 
 	config BR2_GCC_VERSION_4_6_X
 		depends on !BR2_arc && !BR2_avr32 && !BR2_bfin && !BR2_cortex_a7 && !BR2_sparc_sparchfleon && !BR2_sparc_sparchfleonv8 && !BR2_sparc_sparcsfleon && !BR2_sparc_sparcsfleonv8 && !BR2_pj4
 		select BR2_GCC_NEEDS_MPC
 		bool "gcc 4.6.x"
+		select BR2_GCC_VERSION_NEEDS_THREE_STAGE_BUILD
 
 	config BR2_GCC_VERSION_4_7_X
 		depends on !BR2_arc && !BR2_avr32 && !BR2_bfin && !BR2_sparc_sparchfleon && !BR2_sparc_sparchfleonv8 && !BR2_sparc_sparcsfleon && !BR2_sparc_sparcsfleonv8 && !BR2_pj4
diff --git a/package/gcc/gcc-initial/gcc-initial.mk b/package/gcc/gcc-initial/gcc-initial.mk
index e468419..c3ab1ce 100644
--- a/package/gcc/gcc-initial/gcc-initial.mk
+++ b/package/gcc/gcc-initial/gcc-initial.mk
@@ -29,6 +29,7 @@ HOST_GCC_INITIAL_CONF_OPT = \
 	--enable-languages=c \
 	--disable-shared \
 	--without-headers \
+	--disable-threads \
 	--with-newlib \
 	--disable-largefile \
 	--disable-nls \
@@ -37,4 +38,11 @@ HOST_GCC_INITIAL_CONF_OPT = \
 HOST_GCC_INITIAL_MAKE_OPT = all-gcc
 HOST_GCC_INITIAL_INSTALL_OPT = install-gcc
 
+ifeq ($(BR2_TOOLCHAIN_NEEDS_THREE_STAGE_BUILD),)
+ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE),y)
+HOST_GCC_INITIAL_MAKE_OPT += all-target-libgcc
+HOST_GCC_INITIAL_INSTALL_OPT += install-target-libgcc
+endif
+endif
+
 $(eval $(host-autotools-package))
diff --git a/package/uclibc/Config.in b/package/uclibc/Config.in
index 92e04e9..037ca01 100644
--- a/package/uclibc/Config.in
+++ b/package/uclibc/Config.in
@@ -115,6 +115,7 @@ choice
 	config BR2_PTHREADS_NATIVE
 		bool "Native POSIX Threading (NPTL)"
 		select BR2_TOOLCHAIN_HAS_THREADS
+		select BR2_TOOLCHAIN_LIBC_NEEDS_THREE_STAGE_BUILD
 		depends on !BR2_arc
 		depends on !BR2_avr32
 		depends on !BR2_bfin
diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk
index 36a5001..cf9e5da 100644
--- a/package/uclibc/uclibc.mk
+++ b/package/uclibc/uclibc.mk
@@ -22,8 +22,9 @@ UCLIBC_INSTALL_STAGING = YES
 # cross-compiler and the kernel headers
 UCLIBC_DEPENDENCIES = host-gcc-initial linux-headers
 
-# Before uClibc is built, we must have the second stage cross-compiler
-uclibc-build: host-gcc-intermediate
+# Before uClibc is built, we must have the second stage
+# cross-compiler, for some gcc versions, and when NPTL is used.
+uclibc-build: $(if $(BR2_TOOLCHAIN_NEEDS_THREE_STAGE_BUILD),host-gcc-intermediate)
 
 # specifying UCLIBC_CONFIG_FILE on the command-line overrides the .config
 # setting.
diff --git a/toolchain/Config.in b/toolchain/Config.in
index 53d2573..64cdf81 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -1,5 +1,13 @@
 menu "Toolchain"
 
+config BR2_TOOLCHAIN_NEEDS_THREE_STAGE_BUILD
+	bool
+	default y if BR2_TOOLCHAIN_LIBC_NEEDS_THREE_STAGE_BUILD && \
+		BR2_GCC_VERSION_NEEDS_THREE_STAGE_BUILD
+
+config BR2_TOOLCHAIN_LIBC_NEEDS_THREE_STAGE_BUILD
+	bool
+
 # Should be selected for glibc or eglibc
 config BR2_TOOLCHAIN_USES_GLIBC
 	bool
@@ -10,6 +18,7 @@ config BR2_TOOLCHAIN_USES_GLIBC
 	select BR2_TOOLCHAIN_HAS_THREADS
 	select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
 	select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
+	select BR2_TOOLCHAIN_LIBC_NEEDS_THREE_STAGE_BUILD
 
 config BR2_TOOLCHAIN_USES_UCLIBC
 	bool
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 04/12] gcc: fix Fortran support
  2013-08-28  6:35 [Buildroot] [PATCH 00/12] Toolchain updates Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2013-08-28  6:35 ` [Buildroot] [PATCH 03/12] toolchain-internal: skip gcc-intermediate when possible Thomas Petazzoni
@ 2013-08-28  6:35 ` Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 05/12] gcc: fix Objective-C support Thomas Petazzoni
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-28  6:35 UTC (permalink / raw)
  To: buildroot

This commit fixes the Fortran support in the gcc package by making
sure that the runtime Fortran library is properly installed to the
target.

It also takes this opportunity to slightly reword the Config.in option
help text, to no longer mention gcc < 4.2 since they are no longer
supported in Buildroot, and to have a more meaningful explanation.

Finally, it fixes the gcc-final.mk code to use the correct
BR2_INSTALL_FORTRAN option rather than the non-existing
BR2_GCC_CROSS_FORTRAN option, to decide whether Fortran support should
be enabled or not in the cross-compiler.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/gcc/Config.in.host         | 8 ++++----
 package/gcc/gcc-final/gcc-final.mk | 6 +++++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index 7e6df2d..b440ee2 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -119,13 +119,13 @@ config BR2_INSTALL_OBJC
 	  Build/install Objective-C compiler and runtime?
 
 config BR2_INSTALL_FORTRAN
-	bool "Build/install Fortran compiler and runtime?"
+	bool "Enable Fortran support"
 	depends on !BR2_avr32
 	select BR2_PACKAGE_LIBMPFR
 	help
-	  Build/install Fortran compiler and runtime?
-	  Note that it is highly recommended NOT to use gfortran
-	  from gcc older than 4.2.0
+	  Enable the support for the Fortran language in the
+	  cross-compiler, and install the Fortran runtime to the
+	  target.
 
 config BR2_GCC_ENABLE_TLS
 	bool "Enable compiler tls support" if BR2_TOOLCHAIN_BUILDROOT_UCLIBC
diff --git a/package/gcc/gcc-final/gcc-final.mk b/package/gcc/gcc-final/gcc-final.mk
index 9f54c68..b5e35b0 100644
--- a/package/gcc/gcc-final/gcc-final.mk
+++ b/package/gcc/gcc-final/gcc-final.mk
@@ -34,7 +34,7 @@ HOST_GCC_FINAL_PRE_CONFIGURE_HOOKS += HOST_GCC_FINAL_CONFIGURE_SYMLINK
 # Languages supported by the cross-compiler
 GCC_FINAL_CROSS_LANGUAGES-y = c
 GCC_FINAL_CROSS_LANGUAGES-$(BR2_INSTALL_LIBSTDCPP) += c++
-GCC_FINAL_CROSS_LANGUAGES-$(BR2_GCC_CROSS_FORTRAN) += fortran
+GCC_FINAL_CROSS_LANGUAGES-$(BR2_INSTALL_FORTRAN) += fortran
 GCC_FINAL_CROSS_LANGUAGES-$(BR2_GCC_CROSS_OBJC)    += objc
 GCC_FINAL_CROSS_LANGUAGES = $(subst $(space),$(comma),$(GCC_FINAL_CROSS_LANGUAGES-y))
 
@@ -127,6 +127,10 @@ ifeq ($(BR2_GCC_ENABLE_OPENMP),y)
 HOST_GCC_FINAL_USR_LIBS += libgomp
 endif
 
+ifeq ($(BR2_INSTALL_FORTRAN),y)
+HOST_GCC_FINAL_USR_LIBS += libgfortran
+endif
+
 ifneq ($(HOST_GCC_FINAL_USR_LIBS),)
 define HOST_GCC_FINAL_INSTALL_USR_LIBS
 	mkdir -p $(TARGET_DIR)/usr/lib
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 05/12] gcc: fix Objective-C support
  2013-08-28  6:35 [Buildroot] [PATCH 00/12] Toolchain updates Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2013-08-28  6:35 ` [Buildroot] [PATCH 04/12] gcc: fix Fortran support Thomas Petazzoni
@ 2013-08-28  6:35 ` Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 06/12] gcc: move C++ support option next to Fortran/Objective-C Thomas Petazzoni
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-28  6:35 UTC (permalink / raw)
  To: buildroot

This commit fixes the Objective-C support in the gcc package by making
sure that the runtime Objective-C library is properly installed to the
target.

It also takes this opportunity to slightly reword the Config.in option
help text to have a more meaningful explanation.

Finally, it fixes the gcc-final.mk code to use the correct
BR2_INSTALL_OBJC option rather than the non-existing
BR2_GCC_CROSS_OBJC option, to decide whether Objective-C support
should be enabled or not in the cross-compiler.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/gcc/Config.in.host         | 6 ++++--
 package/gcc/gcc-final/gcc-final.mk | 6 +++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index b440ee2..a7dbbb6 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -113,10 +113,12 @@ config BR2_EXTRA_GCC_CONFIG_OPTIONS
 	  initial, gcc intermediate and gcc final passes.
 
 config BR2_INSTALL_OBJC
-	bool "Build/install Objective-C compiler and runtime?"
+	bool "Enable Objective-C support"
 	depends on !BR2_avr32
 	help
-	  Build/install Objective-C compiler and runtime?
+	  Enable the support for the Objective-C language in the
+	  cross-compiler, and install the Objective-C runtime to the
+	  target.
 
 config BR2_INSTALL_FORTRAN
 	bool "Enable Fortran support"
diff --git a/package/gcc/gcc-final/gcc-final.mk b/package/gcc/gcc-final/gcc-final.mk
index b5e35b0..02c4007 100644
--- a/package/gcc/gcc-final/gcc-final.mk
+++ b/package/gcc/gcc-final/gcc-final.mk
@@ -35,7 +35,7 @@ HOST_GCC_FINAL_PRE_CONFIGURE_HOOKS += HOST_GCC_FINAL_CONFIGURE_SYMLINK
 GCC_FINAL_CROSS_LANGUAGES-y = c
 GCC_FINAL_CROSS_LANGUAGES-$(BR2_INSTALL_LIBSTDCPP) += c++
 GCC_FINAL_CROSS_LANGUAGES-$(BR2_INSTALL_FORTRAN) += fortran
-GCC_FINAL_CROSS_LANGUAGES-$(BR2_GCC_CROSS_OBJC)    += objc
+GCC_FINAL_CROSS_LANGUAGES-$(BR2_INSTALL_OBJC)    += objc
 GCC_FINAL_CROSS_LANGUAGES = $(subst $(space),$(comma),$(GCC_FINAL_CROSS_LANGUAGES-y))
 
 HOST_GCC_FINAL_CONF_OPT = \
@@ -131,6 +131,10 @@ ifeq ($(BR2_INSTALL_FORTRAN),y)
 HOST_GCC_FINAL_USR_LIBS += libgfortran
 endif
 
+ifeq ($(BR2_INSTALL_OBJC),y)
+HOST_GCC_FINAL_USR_LIBS += libobjc
+endif
+
 ifneq ($(HOST_GCC_FINAL_USR_LIBS),)
 define HOST_GCC_FINAL_INSTALL_USR_LIBS
 	mkdir -p $(TARGET_DIR)/usr/lib
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 06/12] gcc: move C++ support option next to Fortran/Objective-C
  2013-08-28  6:35 [Buildroot] [PATCH 00/12] Toolchain updates Thomas Petazzoni
                   ` (4 preceding siblings ...)
  2013-08-28  6:35 ` [Buildroot] [PATCH 05/12] gcc: fix Objective-C support Thomas Petazzoni
@ 2013-08-28  6:35 ` Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 07/12] toolchain: add support for glibc Thomas Petazzoni
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-28  6:35 UTC (permalink / raw)
  To: buildroot

The option to enable C++ support was still located in
toolchain/toolchain-buildroot/Config.in.2, with misc other toolchain
options. It seems more logical to have this option with the other
options to select the languages supported by the cross-compiler, so we
move it next to the Fortran/Objective-C options in
package/gcc/Config.in.host.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/gcc/Config.in.host                | 13 +++++++++++++
 toolchain/toolchain-buildroot/Config.in.2 | 13 -------------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index a7dbbb6..dbf0f20 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -112,6 +112,19 @@ config BR2_EXTRA_GCC_CONFIG_OPTIONS
 	  include. Those options are applied for all of the gcc
 	  initial, gcc intermediate and gcc final passes.
 
+config BR2_TOOLCHAIN_BUILDROOT_CXX
+	bool "Enable C++ support"
+	select BR2_INSTALL_LIBSTDCPP
+	depends on !(BR2_GCC_VERSION_4_2_2_AVR32_2_1_5 && \
+		     BR2_TOOLCHAIN_BUILDROOT_LOCALE)
+	help
+	  Enable this option if you want your toolchain to support the
+	  C++ language and you want C++ libraries to be installed on
+	  your target system.
+
+comment "C++ support broken in uClibc with locale enabled with gcc 4.2"
+	depends on BR2_GCC_VERSION_4_2_2_AVR32_2_1_5 && BR2_TOOLCHAIN_BUILDROOT_LOCALE
+
 config BR2_INSTALL_OBJC
 	bool "Enable Objective-C support"
 	depends on !BR2_avr32
diff --git a/toolchain/toolchain-buildroot/Config.in.2 b/toolchain/toolchain-buildroot/Config.in.2
index bf27e6b..1371c31 100644
--- a/toolchain/toolchain-buildroot/Config.in.2
+++ b/toolchain/toolchain-buildroot/Config.in.2
@@ -4,19 +4,6 @@ if BR2_TOOLCHAIN_BUILDROOT
 
 comment "Toolchain Options"
 
-config BR2_TOOLCHAIN_BUILDROOT_CXX
-	bool "Enable C++ support"
-	select BR2_INSTALL_LIBSTDCPP
-	depends on !(BR2_GCC_VERSION_4_2_2_AVR32_2_1_5 && \
-		     BR2_TOOLCHAIN_BUILDROOT_LOCALE)
-	help
-	  Enable this option if you want your toolchain to support the
-	  C++ language and you want C++ libraries to be installed on
-	  your target system.
-
-comment "C++ support broken in uClibc with locale enabled with gcc 4.2"
-	depends on BR2_GCC_VERSION_4_2_2_AVR32_2_1_5 && BR2_TOOLCHAIN_BUILDROOT_LOCALE
-
 config BR2_TOOLCHAIN_BUILDROOT_USE_SSP
 	bool "Enable stack protection support"
 	help
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 07/12] toolchain: add support for glibc
  2013-08-28  6:35 [Buildroot] [PATCH 00/12] Toolchain updates Thomas Petazzoni
                   ` (5 preceding siblings ...)
  2013-08-28  6:35 ` [Buildroot] [PATCH 06/12] gcc: move C++ support option next to Fortran/Objective-C Thomas Petazzoni
@ 2013-08-28  6:35 ` Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 08/12] gcc/gcc-final: use the common HOST_GCC_CONFIGURE_SYMLINK macro Thomas Petazzoni
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-28  6:35 UTC (permalink / raw)
  To: buildroot

The support for eglibc 2.17 was added to the internal toolchain
backend for 2013.08. This commit now adds glibc 2.18 support to the
internal toolchain backend.

Since the building procedure is very similar to the one of eglibc, we
have renamed the 'eglibc' package to 'glibc', and made it capable of
handling either glibc or eglibc.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/gcc/Config.in.host                   |  2 +-
 package/gcc/gcc-final/gcc-final.mk           |  4 +-
 package/{eglibc/eglibc.mk => glibc/glibc.mk} | 62 +++++++++++++++++-----------
 toolchain/toolchain-buildroot/Config.in      | 24 ++++++++++-
 4 files changed, 64 insertions(+), 28 deletions(-)
 rename package/{eglibc/eglibc.mk => glibc/glibc.mk} (59%)

diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index dbf0f20..111da3b 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -145,7 +145,7 @@ config BR2_INSTALL_FORTRAN
 config BR2_GCC_ENABLE_TLS
 	bool "Enable compiler tls support" if BR2_TOOLCHAIN_BUILDROOT_UCLIBC
 	default y
-	depends on BR2_PTHREADS_NATIVE || BR2_TOOLCHAIN_BUILDROOT_EGLIBC
+	depends on BR2_PTHREADS_NATIVE || BR2_TOOLCHAIN_BUILDROOT_EGLIBC || BR2_TOOLCHAIN_BUILDROOT_GLIBC
 	help
 	  Enable the compiler to generate code for accessing
 	  thread local storage variables
diff --git a/package/gcc/gcc-final/gcc-final.mk b/package/gcc/gcc-final/gcc-final.mk
index 02c4007..e76038c 100644
--- a/package/gcc/gcc-final/gcc-final.mk
+++ b/package/gcc/gcc-final/gcc-final.mk
@@ -91,11 +91,11 @@ endef
 
 HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_FINAL_CREATE_SIMPLE_SYMLINKS
 
-# In gcc 4.7.x, the ARM EABIhf library loader path for eglibc was not
+# In gcc 4.7.x, the ARM EABIhf library loader path for (e)glibc was not
 # correct, so we create a symbolic link to make things work
 # properly. eglibc installs the library loader as ld-linux-armhf.so.3,
 # but gcc creates binaries that reference ld-linux.so.3.
-ifeq ($(BR2_arm)$(BR2_ARM_EABIHF)$(BR2_GCC_VERSION_4_7_X)$(BR2_TOOLCHAIN_BUILDROOT_EGLIBC),yyyy)
+ifeq ($(BR2_arm)$(BR2_ARM_EABIHF)$(BR2_GCC_VERSION_4_7_X)$(BR2_TOOLCHAIN_USES_GLIBC),yyyy)
 define HOST_GCC_FINAL_LD_LINUX_LINK
 	ln -sf ld-linux-armhf.so.3 $(TARGET_DIR)/lib/ld-linux.so.3
 	ln -sf ld-linux-armhf.so.3 $(STAGING_DIR)/lib/ld-linux.so.3
diff --git a/package/eglibc/eglibc.mk b/package/glibc/glibc.mk
similarity index 59%
rename from package/eglibc/eglibc.mk
rename to package/glibc/glibc.mk
index 0ed908d..4dd2e63 100644
--- a/package/eglibc/eglibc.mk
+++ b/package/glibc/glibc.mk
@@ -1,32 +1,46 @@
 ################################################################################
 #
-# eglibc
+# glibc/eglibc
 #
 ################################################################################
 
-EGLIBC_VERSION = 2.17-svnr22064
-EGLIBC_SITE = http://downloads.yoctoproject.org/releases/eglibc/
-EGLIBC_SOURCE = eglibc-$(EGLIBC_VERSION).tar.bz2
-EGLIBC_LICENSE = GPLv2+ (programs), LGPLv2.1+, BSD-3c, MIT (library)
-EGLIBC_LICENSE_FILES = libc/COPYING libc/COPYING.LIB libc/LICENSES
+ifeq ($(BR2_TOOLCHAIN_BUILDROOT_EGLIBC),y)
+GLIBC_VERSION = 2.17-svnr22064
+GLIBC_SITE = http://downloads.yoctoproject.org/releases/eglibc/
+GLIBC_SOURCE = eglibc-$(GLIBC_VERSION).tar.bz2
+GLIBC_SRC_SUBDIR = libc
+else
+GLIBC_VERSION = 2.18
+GLIBC_SITE = $(BR2_GNU_MIRROR)/libc
+GLIBC_SOURCE = glibc-$(GLIBC_VERSION).tar.xz
+GLIBC_SRC_SUBDIR = .
+endif
+
+GLIBC_LICENSE = GPLv2+ (programs), LGPLv2.1+, BSD-3c, MIT (library)
+GLIBC_LICENSE_FILES = $(addprefix $(GLIBC_SRC_SUBDIR)/,COPYING COPYING.LIB LICENSES)
 
-# Before eglibc is configured, we must have the first stage
+# Before (e)glibc is configured, we must have the first stage
 # cross-compiler and the kernel headers
-EGLIBC_DEPENDENCIES = host-gcc-initial linux-headers host-gawk
+GLIBC_DEPENDENCIES = host-gcc-initial linux-headers
+
+# eglibc also needs host-gawk
+ifeq ($(BR2_TOOLCHAIN_BUILDROOT_EGLIBC),y)
+GLIBC_DEPENDENCIES += host-gawk
+endif
 
-# Before eglibc is built, we must have the second stage
+# Before (e)glibc is built, we must have the second stage
 # cross-compiler, for some gcc versions
-eglibc-build: $(if $(BR2_TOOLCHAIN_NEEDS_THREE_STAGE_BUILD),host-gcc-intermediate)
+glibc-build: $(if $(BR2_TOOLCHAIN_NEEDS_THREE_STAGE_BUILD),host-gcc-intermediate)
 
-EGLIBC_SUBDIR = build
+GLIBC_SUBDIR = build
 
-EGLIBC_INSTALL_STAGING = YES
+GLIBC_INSTALL_STAGING = YES
 
-EGLIBC_INSTALL_STAGING_OPT = install_root=$(STAGING_DIR) install
+GLIBC_INSTALL_STAGING_OPT = install_root=$(STAGING_DIR) install
 
 # Thumb build is broken, build in ARM mode
 ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
-EGLIBC_EXTRA_CFLAGS += -marm
+GLIBC_EXTRA_CFLAGS += -marm
 endif
 
 # Even though we use the autotools-package infrastructure, we have to
@@ -38,16 +52,16 @@ endif
 #  2. We have to execute the configure script with bash and not sh.
 #
 # Note that as mentionned in
-# http://patches.openembedded.org/patch/38849/, eglibc must be built
-# with -O2, so we pass our own CFLAGS and CXXFLAGS below.
-define EGLIBC_CONFIGURE_CMDS
+# http://patches.openembedded.org/patch/38849/, eglibc/glibc must be
+# built with -O2, so we pass our own CFLAGS and CXXFLAGS below.
+define GLIBC_CONFIGURE_CMDS
 	mkdir -p $(@D)/build
 	# Do the configuration
 	(cd $(@D)/build; \
 		$(TARGET_CONFIGURE_OPTS) \
-		CFLAGS="-O2 $(EGLIBC_EXTRA_CFLAGS)" CPPFLAGS="" \
-		CXXFLAGS="-O2 $(EGLIBC_EXTRA_CFLAGS)" \
-		$(SHELL) $(@D)/libc/configure \
+		CFLAGS="-O2 $(GLIBC_EXTRA_CFLAGS)" CPPFLAGS="" \
+		CXXFLAGS="-O2 $(GLIBC_EXTRA_CFLAGS)" \
+		$(SHELL) $(@D)/$(GLIBC_SRC_SUBDIR)/configure \
 		ac_cv_path_BASH_SHELL=/bin/bash \
 		libc_cv_forced_unwind=yes \
 		--target=$(GNU_TARGET_NAME) \
@@ -81,17 +95,17 @@ endef
 # to install the libraries, and nothing more.
 #
 
-EGLIBC_LIBS_LIB = \
+GLIBC_LIBS_LIB = \
 	ld*.so libc.so libcrypt.so libdl.so libgcc_s.so libm.so	   \
 	libnsl.so libpthread.so libresolv.so librt.so libutil.so   \
 	libnss_files.so libnss_dns.so
 
 ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
-EGLIBC_LIBS_LIB += libthread_db.so
+GLIBC_LIBS_LIB += libthread_db.so
 endif
 
-define EGLIBC_INSTALL_TARGET_CMDS
-	for libs in $(EGLIBC_LIBS_LIB); do \
+define GLIBC_INSTALL_TARGET_CMDS
+	for libs in $(GLIBC_LIBS_LIB); do \
 		$(call copy_toolchain_lib_root,$(STAGING_DIR)/,,lib,$$libs,/lib) ; \
 	done
 endef
diff --git a/toolchain/toolchain-buildroot/Config.in b/toolchain/toolchain-buildroot/Config.in
index 396a434..4c1bfb0 100644
--- a/toolchain/toolchain-buildroot/Config.in
+++ b/toolchain/toolchain-buildroot/Config.in
@@ -34,12 +34,34 @@ config BR2_TOOLCHAIN_BUILDROOT_EGLIBC
 
 	  http://eglibc.org
 
+config BR2_TOOLCHAIN_BUILDROOT_GLIBC
+	bool "glibc (experimental)"
+	depends on BR2_arm    || BR2_armeb    || BR2_aarch64 || \
+		   BR2_i386   || BR2_mips     || BR2_mipsel  || \
+		   BR2_mips64 || BR2_mips64el || BR2_powerpc || \
+		   BR2_sh     || BR2_sh64     || BR2_sparc   || \
+		   BR2_x86_64
+	select BR2_TOOLCHAIN_USES_GLIBC
+	# our glibc.mk enables RPC support
+	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
+	help
+	  This option selects glibc as the C library for the
+	  cross-compilation toolchain.
+
+	  The glibc support in the Buildroot toolchain backend is
+	  very recent, and therefore marked experimental.
+
+	  http://www.gnu.org/software/libc/
+
 endchoice
 
 config BR2_TOOLCHAIN_BUILDROOT_LIBC
 	string
 	default "uclibc" if BR2_TOOLCHAIN_BUILDROOT_UCLIBC
-	default "eglibc" if BR2_TOOLCHAIN_BUILDROOT_EGLIBC
+	# Both glibc and eglibc are handled by the package called
+	# 'glibc'
+	default "glibc"  if BR2_TOOLCHAIN_BUILDROOT_EGLIBC
+	default "glibc"  if BR2_TOOLCHAIN_BUILDROOT_GLIBC
 
 source "package/uclibc/Config.in"
 
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 08/12] gcc/gcc-final: use the common HOST_GCC_CONFIGURE_SYMLINK macro
  2013-08-28  6:35 [Buildroot] [PATCH 00/12] Toolchain updates Thomas Petazzoni
                   ` (6 preceding siblings ...)
  2013-08-28  6:35 ` [Buildroot] [PATCH 07/12] toolchain: add support for glibc Thomas Petazzoni
@ 2013-08-28  6:35 ` Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 09/12] gcc: force symlink creation Thomas Petazzoni
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-28  6:35 UTC (permalink / raw)
  To: buildroot

Each stage of the gcc build needs to make a small dance before the
configuration step to create a build sub-directory and a symbolic link
to the configure script. The common gcc.mk had a
HOST_GCC_CONFIGURE_SYMLINK already used by the gcc-initial and
gcc-intermediate steps, but the gcc-final step wasn't using it.

This commit fixes this inconsistency, and therefore removes the
HOST_GCC_FINAL_CONFIGURE_SYMLINK macro.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/gcc/gcc-final/gcc-final.mk | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/package/gcc/gcc-final/gcc-final.mk b/package/gcc/gcc-final/gcc-final.mk
index e76038c..3ead53b 100644
--- a/package/gcc/gcc-final/gcc-final.mk
+++ b/package/gcc/gcc-final/gcc-final.mk
@@ -24,12 +24,7 @@ HOST_GCC_FINAL_POST_PATCH_HOOKS += HOST_GCC_APPLY_PATCHES
 # subdirectory in the gcc sources, and build from there.
 HOST_GCC_FINAL_SUBDIR = build
 
-define HOST_GCC_FINAL_CONFIGURE_SYMLINK
-	mkdir -p $(@D)/build
-	ln -s ../configure $(@D)/build/configure
-endef
-
-HOST_GCC_FINAL_PRE_CONFIGURE_HOOKS += HOST_GCC_FINAL_CONFIGURE_SYMLINK
+HOST_GCC_FINAL_PRE_CONFIGURE_HOOKS += HOST_GCC_CONFIGURE_SYMLINK
 
 # Languages supported by the cross-compiler
 GCC_FINAL_CROSS_LANGUAGES-y = c
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 09/12] gcc: force symlink creation
  2013-08-28  6:35 [Buildroot] [PATCH 00/12] Toolchain updates Thomas Petazzoni
                   ` (7 preceding siblings ...)
  2013-08-28  6:35 ` [Buildroot] [PATCH 08/12] gcc/gcc-final: use the common HOST_GCC_CONFIGURE_SYMLINK macro Thomas Petazzoni
@ 2013-08-28  6:35 ` Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 10/12] toolchain: refactor Stack Smashing Protection support Thomas Petazzoni
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-28  6:35 UTC (permalink / raw)
  To: buildroot

The HOST_GCC_CONFIGURE_SYMLINK creates a symbolic link
$(@D)/build/configure -> $(@D)/configure for each build step of
gcc. However, it was only using 'ln -s' and not 'ln -sf', which was
causing problems when doing 'make host-gcc-final-reconfigure' for
example, because the configure commands (including this macro) are
being re-executed, but the symbolic link already exists.

Changing this symbolic link creation to 'ln -sf' fixes this problem.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/gcc/gcc.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index cd6efed..20d6d14 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -76,7 +76,7 @@ endef
 
 define HOST_GCC_CONFIGURE_SYMLINK
 	mkdir -p $(@D)/build
-	ln -s ../configure $(@D)/build/configure
+	ln -sf ../configure $(@D)/build/configure
 endef
 
 #
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 10/12] toolchain: refactor Stack Smashing Protection support
  2013-08-28  6:35 [Buildroot] [PATCH 00/12] Toolchain updates Thomas Petazzoni
                   ` (8 preceding siblings ...)
  2013-08-28  6:35 ` [Buildroot] [PATCH 09/12] gcc: force symlink creation Thomas Petazzoni
@ 2013-08-28  6:35 ` Thomas Petazzoni
  2013-08-29  6:11   ` Arnout Vandecappelle
  2013-08-28  6:35 ` [Buildroot] [PATCH 11/12] toolchain: move elf2flt option inclusion to toolchain-buildroot/Config.in Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 12/12] toolchain: improve mudflap support Thomas Petazzoni
  11 siblings, 1 reply; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-28  6:35 UTC (permalink / raw)
  To: buildroot

This commit refactors how Stack Smashing Protection support is handled
in Buildroot:

 *) It turns the BR2_TOOLCHAIN_BUILDROOT_USE_SSP option into an option
    that only enables the SSP support in uClibc, when using the internal
    toolchain backend.

 *) It adds an hidden BR2_TOOLCHAIN_HAS_SSP option that gets enabled
    when the toolchain has SSP support. Here we have the usual dance:
    glibc/eglibc in internal/external backend always select this
    option, in the case of uClibc/internal, it gets selected when
    BR2_TOOLCHAIN_BUILDROOT_USE_SSP is enabled, in the case of
    uClibc/external, there is a new configuration option that the user
    must select (or not) depending on whether the toolchain has SSP
    support.

 *) It adds a new options BR2_ENABLE_SSP in the "Build options" menu,
    to enable the usage of SSP support, by adding
    -fstack-protector-all to the CFLAGS.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 Config.in                                 | 17 +++++++++++++++++
 package/Makefile.in                       |  2 +-
 package/psmisc/psmisc.mk                  |  2 +-
 package/uclibc/Config.in                  | 10 ++++++++++
 toolchain/Config.in                       |  1 +
 toolchain/helpers.mk                      |  3 ++-
 toolchain/toolchain-buildroot/Config.in.2 |  9 ---------
 toolchain/toolchain-common.in             |  3 +++
 toolchain/toolchain-external/Config.in    |  9 +++++++++
 9 files changed, 44 insertions(+), 12 deletions(-)

diff --git a/Config.in b/Config.in
index 78dea3b..590c013 100644
--- a/Config.in
+++ b/Config.in
@@ -398,6 +398,23 @@ config BR2_OPTIMIZE_S
 
 endchoice
 
+config BR2_ENABLE_SSP
+	bool "build code with Stack Smashing Protection"
+	depends on BR2_TOOLCHAIN_HAS_SSP
+	help
+	  Enable stack smashing protection support using GCCs
+	  -fstack-protector-all option.
+
+	  See http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt
+          for details.
+
+	  Note that this requires the toolchain to have SSP
+	  support. This is always the case for glibc and eglibc
+	  toolchain, but is optional in uClibc toolchains.
+
+comment "enabling Stack Smashing Protection requires support in the toolchain"
+	depends on !BR2_TOOLCHAIN_HAS_SSP
+
 config BR2_PREFER_STATIC_LIB
 	bool "prefer static libraries"
 	help
diff --git a/package/Makefile.in b/package/Makefile.in
index 0b1c33a..3eaa2b2 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -129,7 +129,7 @@ TARGET_CFLAGS += -msep-data
 TARGET_CXXFLAGS += -msep-data
 endif
 
-ifeq ($(BR2_TOOLCHAIN_BUILDROOT_USE_SSP),y)
+ifeq ($(BR2_ENABLE_SSP),y)
 TARGET_CFLAGS += -fstack-protector-all
 TARGET_CXXFLAGS += -fstack-protector-all
 endif
diff --git a/package/psmisc/psmisc.mk b/package/psmisc/psmisc.mk
index 1340ee6..61faeab 100644
--- a/package/psmisc/psmisc.mk
+++ b/package/psmisc/psmisc.mk
@@ -10,7 +10,7 @@ PSMISC_LICENSE = GPLv2
 PSMISC_LICENSE_FILES = COPYING
 PSMISC_DEPENDENCIES = ncurses $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),gettext)
 
-ifneq ($(BR2_TOOLCHAIN_BUILDROOT_USE_SSP),y)
+ifneq ($(BR2_ENABLE_SSP),y)
 # Don't force -fstack-protector
 PSMISC_CONF_OPT = --disable-harden-flags
 endif
diff --git a/package/uclibc/Config.in b/package/uclibc/Config.in
index 037ca01..eeb3b83 100644
--- a/package/uclibc/Config.in
+++ b/package/uclibc/Config.in
@@ -130,6 +130,16 @@ config BR2_PTHREAD_DEBUG
 	help
 	  Build the thread library with debugging enabled.
 
+config BR2_TOOLCHAIN_BUILDROOT_USE_SSP
+	bool "Enable stack protection support"
+	select BR2_TOOLCHAIN_HAS_SSP
+	help
+	  Enable stack smashing protection support using GCCs
+	  -fstack-protector-all option in uClibc.
+
+	  See http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt
+	  for details.
+
 config BR2_UCLIBC_INSTALL_UTILS
 	bool "Compile and install uClibc utilities"
 	depends on !BR2_bfin
diff --git a/toolchain/Config.in b/toolchain/Config.in
index 64cdf81..da9cd68 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -18,6 +18,7 @@ config BR2_TOOLCHAIN_USES_GLIBC
 	select BR2_TOOLCHAIN_HAS_THREADS
 	select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
 	select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
+	select BR2_TOOLCHAIN_HAS_SSP
 	select BR2_TOOLCHAIN_LIBC_NEEDS_THREE_STAGE_BUILD
 
 config BR2_TOOLCHAIN_USES_UCLIBC
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 4c988a5..262c052 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -269,7 +269,8 @@ check_uclibc = \
 	$(call check_uclibc_feature,__UCLIBC_HAS_LOCALE__,BR2_ENABLE_LOCALE,$${UCLIBC_CONFIG_FILE},Locale support) ;\
 	$(call check_uclibc_feature,__UCLIBC_HAS_WCHAR__,BR2_USE_WCHAR,$${UCLIBC_CONFIG_FILE},Wide char support) ;\
 	$(call check_uclibc_feature,__UCLIBC_HAS_THREADS__,BR2_TOOLCHAIN_HAS_THREADS,$${UCLIBC_CONFIG_FILE},Thread support) ;\
-	$(call check_uclibc_feature,__PTHREADS_DEBUG_SUPPORT__,BR2_TOOLCHAIN_HAS_THREADS_DEBUG,$${UCLIBC_CONFIG_FILE},Thread debugging support)
+	$(call check_uclibc_feature,__PTHREADS_DEBUG_SUPPORT__,BR2_TOOLCHAIN_HAS_THREADS_DEBUG,$${UCLIBC_CONFIG_FILE},Thread debugging support) ;\
+	$(call check_uclibc_feature,__UCLIBC_HAS_SSP__,BR2_TOOLCHAIN_HAS_SSP,$${UCLIBC_CONFIG_FILE},Stack Smashing Protection support)
 
 #
 # Check that the Buildroot configuration of the ABI matches the
diff --git a/toolchain/toolchain-buildroot/Config.in.2 b/toolchain/toolchain-buildroot/Config.in.2
index 1371c31..df26079 100644
--- a/toolchain/toolchain-buildroot/Config.in.2
+++ b/toolchain/toolchain-buildroot/Config.in.2
@@ -4,15 +4,6 @@ if BR2_TOOLCHAIN_BUILDROOT
 
 comment "Toolchain Options"
 
-config BR2_TOOLCHAIN_BUILDROOT_USE_SSP
-	bool "Enable stack protection support"
-	help
-	  Enable stack smashing protection support using GCCs
-	  -fstack-protector-all option.
-
-	  See http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt
-	  for details.
-
 source "package/elf2flt/Config.in.host"
 
 endif
diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
index dc3bd2a..1085fb3 100644
--- a/toolchain/toolchain-common.in
+++ b/toolchain/toolchain-common.in
@@ -32,6 +32,9 @@ config BR2_TOOLCHAIN_HAS_THREADS_DEBUG
 config BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
 	bool
 
+config BR2_TOOLCHAIN_HAS_SSP
+	bool
+
 config BR2_ENABLE_LOCALE_PURGE
 	bool "Purge unwanted locales"
 	help
diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
index ad1f203..11edc98 100644
--- a/toolchain/toolchain-external/Config.in
+++ b/toolchain/toolchain-external/Config.in
@@ -921,6 +921,15 @@ config BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG
 	  debugging support. If you don't know, leave the default
 	  value, Buildroot will tell you if it's correct or not.
 
+config BR2_TOOLCHAIN_EXTERNAL_HAS_SSP
+	bool "Toolchain has SSP support?"
+	select BR2_TOOLCHAIN_HAS_SSP
+	help
+	  Selection this option if your external toolchain has Stack
+	  Smashing Protection support enabled. If you don't know,
+	  leave the default value, Buildroot will tell you if it's
+	  correct or not.
+
 endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC
 
 config BR2_TOOLCHAIN_EXTERNAL_INET_RPC
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 11/12] toolchain: move elf2flt option inclusion to toolchain-buildroot/Config.in
  2013-08-28  6:35 [Buildroot] [PATCH 00/12] Toolchain updates Thomas Petazzoni
                   ` (9 preceding siblings ...)
  2013-08-28  6:35 ` [Buildroot] [PATCH 10/12] toolchain: refactor Stack Smashing Protection support Thomas Petazzoni
@ 2013-08-28  6:35 ` Thomas Petazzoni
  2013-08-28  6:35 ` [Buildroot] [PATCH 12/12] toolchain: improve mudflap support Thomas Petazzoni
  11 siblings, 0 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-28  6:35 UTC (permalink / raw)
  To: buildroot

The only remaining thing in toolchain-buildroot/Config.in.2 is the
inclusion of the elf2flt option. It doesn't really make sense to have
a separate Config.in file for that, so let's move this to
toolchain-buildroot/Config.in.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 toolchain/Config.in                       | 1 -
 toolchain/toolchain-buildroot/Config.in   | 1 +
 toolchain/toolchain-buildroot/Config.in.2 | 9 ---------
 3 files changed, 1 insertion(+), 10 deletions(-)
 delete mode 100644 toolchain/toolchain-buildroot/Config.in.2

diff --git a/toolchain/Config.in b/toolchain/Config.in
index da9cd68..51c83d9 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -62,6 +62,5 @@ source "toolchain/toolchain-buildroot/Config.in"
 source "toolchain/toolchain-external/Config.in"
 source "toolchain/toolchain-crosstool-ng/Config.in"
 source "toolchain/toolchain-common.in"
-source "toolchain/toolchain-buildroot/Config.in.2"
 
 endmenu
diff --git a/toolchain/toolchain-buildroot/Config.in b/toolchain/toolchain-buildroot/Config.in
index 4c1bfb0..df3d5c4 100644
--- a/toolchain/toolchain-buildroot/Config.in
+++ b/toolchain/toolchain-buildroot/Config.in
@@ -67,4 +67,5 @@ source "package/uclibc/Config.in"
 
 source "package/binutils/Config.in.host"
 source "package/gcc/Config.in.host"
+source "package/elf2flt/Config.in.host"
 endif
diff --git a/toolchain/toolchain-buildroot/Config.in.2 b/toolchain/toolchain-buildroot/Config.in.2
deleted file mode 100644
index df26079..0000000
--- a/toolchain/toolchain-buildroot/Config.in.2
+++ /dev/null
@@ -1,9 +0,0 @@
-# Buildroot backend specific options
-
-if BR2_TOOLCHAIN_BUILDROOT
-
-comment "Toolchain Options"
-
-source "package/elf2flt/Config.in.host"
-
-endif
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 12/12] toolchain: improve mudflap support
  2013-08-28  6:35 [Buildroot] [PATCH 00/12] Toolchain updates Thomas Petazzoni
                   ` (10 preceding siblings ...)
  2013-08-28  6:35 ` [Buildroot] [PATCH 11/12] toolchain: move elf2flt option inclusion to toolchain-buildroot/Config.in Thomas Petazzoni
@ 2013-08-28  6:35 ` Thomas Petazzoni
  2013-08-29  6:18   ` Arnout Vandecappelle
  11 siblings, 1 reply; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-28  6:35 UTC (permalink / raw)
  To: buildroot

The mudflap library is only useful if one uses the -fmudflap gcc
option, to do more checks on pointers/arrays, which is typically not
the case.

This commit:

 * Adds an option to enable/disable mudflap support at the gcc
   level. By default, it is disabled, which saves a little bit of
   build time.

 * Adds a way for the external toolchain backend to tell whether
   mudflap is supported or not by the external toolchain.

 * Adds a global BR2_TOOLCHAIN_HAS_MUDFLAP hidden option, that
   indicates whether the toolchain (internal or external) supports
   mudflap.

 * Adds a global BR2_ENABLE_MUDFLAP in "Build options" that allows the
   user to build all packages with mudflap support. It depends on
   BR2_TOOLCHAIN_HAS_MUDFLAP.

WARNING WARNING: this currently doesn't result into a working system,
even with just Busybox. Busybox init crashes with "/sbin/init: symbol
lookup error: /lib/libmudflapth.so.0: undefined symbol:
main". According to
http://gcc.gnu.org/ml/gcc-help/2008-03/msg00165.html it is caused by
-Wl,--gc-sections (which is used by Busybox), but even after removing
it, it still doesn't work. I don't personaly have much interest in
mudflap support, so as I couldn't get it to work easily, my suggestion
would be to drop support for it entirely, unless someone steps up to
fix this issue.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 Config.in                                | 20 ++++++++++++++++++++
 package/Makefile.in                      | 12 ++++++++++++
 package/gcc/Config.in.host               | 13 +++++++++++++
 package/gcc/gcc-final/gcc-final.mk       |  8 ++++++++
 package/gcc/gcc.mk                       |  6 ++++++
 toolchain/helpers.mk                     | 12 ++++++++++++
 toolchain/toolchain-common.in            |  3 +++
 toolchain/toolchain-external/Config.in   |  9 +++++++++
 toolchain/toolchain-external/ext-tool.mk | 11 +++++++++++
 9 files changed, 94 insertions(+)

diff --git a/Config.in b/Config.in
index 590c013..2ffdfc5 100644
--- a/Config.in
+++ b/Config.in
@@ -415,6 +415,26 @@ config BR2_ENABLE_SSP
 comment "enabling Stack Smashing Protection requires support in the toolchain"
 	depends on !BR2_TOOLCHAIN_HAS_SSP
 
+config BR2_ENABLE_MUDFLAP
+	bool "build code with Mudflap pointer debugging"
+	depends on BR2_TOOLCHAIN_HAS_MUDFLAP
+	help
+	   Instrument all risky pointer/array dereferencing
+	   operations, some standard library string/heap functions,
+	   and some other associated constructs with range/validity
+	   tests.  Modules so instrumented should be immune to buffer
+	   overflows, invalid heap use, and some other classes of
+	   C/C++ programming errors.
+
+	   See http://gcc.gnu.org/wiki/Mudflap_Pointer_Debugging for
+	   more details.
+
+	   Note that this requires the toolchain to have Mudflap
+	   support.
+
+comment "enabling Mudflap pointer debugging requires support in the toolchain"
+	depends on !BR2_TOOLCHAIN_HAS_MUDFLAP
+
 config BR2_PREFER_STATIC_LIB
 	bool "prefer static libraries"
 	help
diff --git a/package/Makefile.in b/package/Makefile.in
index 3eaa2b2..194da11 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -134,6 +134,18 @@ TARGET_CFLAGS += -fstack-protector-all
 TARGET_CXXFLAGS += -fstack-protector-all
 endif
 
+ifeq ($(BR2_ENABLE_MUDFLAP),y)
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
+TARGET_CFLAGS += -fmudflapth
+TARGET_CXXFLAGS += fmudflapth
+TARGET_LDFLAGS += -fmudflapth -ldl -lpthread -lmudflapth
+else
+TARGET_CFLAGS += -fmudflap
+TARGET_CXXFLAGS += -fmudflap
+TARGET_LDFLAGS += -fmudflap -ldl -lmudflap
+endif
+endif
+
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y)
 TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-
 else
diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index 111da3b..ac9c5dd 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -155,3 +155,16 @@ config BR2_GCC_ENABLE_OPENMP
 	depends on !BR2_PTHREADS_NONE && !BR2_avr32 && !BR2_arc
 	help
 	  Enable OpenMP support for the compiler
+
+config BR2_GCC_ENABLE_LIBMUDFLAP
+	bool "Enable libmudflap support"
+	select BR2_TOOLCHAIN_HAS_MUDFLAP
+	help
+	  libmudflap is a gcc library used for the mudflap pointer
+	  debugging functionality. It is only needed if you intend to
+	  use the -fmudflap gcc flag.
+
+	  See http://gcc.gnu.org/wiki/Mudflap_Pointer_Debugging and
+	  the help of the gcc -fmudflap option for more details.
+
+	  If you're unsure, leave this option disabled.
diff --git a/package/gcc/gcc-final/gcc-final.mk b/package/gcc/gcc-final/gcc-final.mk
index 3ead53b..c153299 100644
--- a/package/gcc/gcc-final/gcc-final.mk
+++ b/package/gcc/gcc-final/gcc-final.mk
@@ -130,6 +130,14 @@ ifeq ($(BR2_INSTALL_OBJC),y)
 HOST_GCC_FINAL_USR_LIBS += libobjc
 endif
 
+ifeq ($(BR2_GCC_ENABLE_LIBMUDFLAP),y)
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
+HOST_GCC_FINAL_USR_LIBS += libmudflapth
+else
+HOST_GCC_FINAL_USR_LIBS += libmudflap
+endif
+endif
+
 ifneq ($(HOST_GCC_FINAL_USR_LIBS),)
 define HOST_GCC_FINAL_INSTALL_USR_LIBS
 	mkdir -p $(TARGET_DIR)/usr/lib
diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index 20d6d14..7630299 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -119,6 +119,12 @@ else
 HOST_GCC_COMMON_CONF_OPT += --disable-tls
 endif
 
+ifeq ($(BR2_GCC_ENABLE_LIBMUDFLAP),y)
+HOST_GCC_COMMON_CONF_OPT += --enable-libmudflap
+else
+HOST_GCC_COMMON_CONF_OPT += --disable-libmudflap
+endif
+
 ifeq ($(BR2_PTHREADS_NONE),y)
 HOST_GCC_COMMON_CONF_OPT += \
 	--disable-threads \
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 262c052..e8da6dc 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -315,6 +315,18 @@ check_cplusplus = \
 	fi
 
 #
+# Check that the external toolchain has mudflap support
+#
+# $1: cross-gcc path
+#
+check_mudflap = \
+	__CROSS_CC=$(strip $1) ; \
+	if ! test -f `$${__CROSS_CC} -print-file-name=libmudflap.a` ; then \
+		echo "Mudflap support is selected but is not available in external toolchain" ; \
+		exit 1 ; \
+	fi
+
+#
 # Check that the cross-compiler given in the configuration exists
 #
 # $1: cross-gcc path
diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
index 1085fb3..03eab7f 100644
--- a/toolchain/toolchain-common.in
+++ b/toolchain/toolchain-common.in
@@ -35,6 +35,9 @@ config BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
 config BR2_TOOLCHAIN_HAS_SSP
 	bool
 
+config BR2_TOOLCHAIN_HAS_MUDFLAP
+	bool
+
 config BR2_ENABLE_LOCALE_PURGE
 	bool "Purge unwanted locales"
 	help
diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
index 11edc98..ddba707 100644
--- a/toolchain/toolchain-external/Config.in
+++ b/toolchain/toolchain-external/Config.in
@@ -13,6 +13,7 @@ config BR2_TOOLCHAIN_EXTERNAL_LINARO_2013_06
 	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
+	select BR2_TOOLCHAIN_HAS_MUDFLAP
 	help
 	  Linaro toolchain for the ARM architecture. It uses Linaro
 	  GCC 2013.06 (based on gcc 4.8), Linaro GDB 2013.06 (based on
@@ -949,6 +950,14 @@ config BR2_TOOLCHAIN_EXTERNAL_CXX
 	  support. If you don't know, leave the default value,
 	  Buildroot will tell you if it's correct or not.
 
+config BR2_TOOLCHAIN_EXTERNAL_MUDFLAP
+	bool "Toolchain has mudflap support?"
+	select BR2_TOOLCHAIN_HAS_MUDFLAP
+	help
+	  Select this option if your external toolchain has mudflap
+	  support. If you don't know, leave the default value,
+	  Buildroot will tell you if it's correct or not.
+
 config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS
 	string "Extra toolchain libraries to be copied to target"
 	help
diff --git a/toolchain/toolchain-external/ext-tool.mk b/toolchain/toolchain-external/ext-tool.mk
index 01be85c..fa2419f 100644
--- a/toolchain/toolchain-external/ext-tool.mk
+++ b/toolchain/toolchain-external/ext-tool.mk
@@ -55,6 +55,14 @@ ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC),y)
 LIB_EXTERNAL_LIBS+=libnss_files.so libnss_dns.so
 endif
 
+ifeq ($(BR2_ENABLE_MUDFLAP),y)
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
+LIB_EXTERNAL_LIBS+=libmudflapth.so
+else
+LIB_EXTERNAL_LIBS+=libmudflap.so
+endif
+endif
+
 ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
 USR_LIB_EXTERNAL_LIBS+=libstdc++.so
 endif
@@ -376,6 +384,9 @@ $(STAMP_DIR)/ext-toolchain-checked: $(TOOLCHAIN_EXTERNAL_DEPENDENCIES)
 	if test "$(BR2_INSTALL_LIBSTDCPP)" = "y" ; then \
 		$(call check_cplusplus,$(TOOLCHAIN_EXTERNAL_CXX)) ; \
 	fi ; \
+	if test "$(BR2_TOOLCHAIN_EXTERNAL_MUDFLAP)" = "y" ; then \
+		$(call check_mudflap,$(TOOLCHAIN_EXTERNAL_CC)) ; \
+	fi ; \
 	if test "$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC)" = "y" ; then \
 		$(call check_uclibc,$${SYSROOT_DIR}) ; \
 	else \
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 10/12] toolchain: refactor Stack Smashing Protection support
  2013-08-28  6:35 ` [Buildroot] [PATCH 10/12] toolchain: refactor Stack Smashing Protection support Thomas Petazzoni
@ 2013-08-29  6:11   ` Arnout Vandecappelle
  2013-08-29  8:34     ` Thomas Petazzoni
  0 siblings, 1 reply; 18+ messages in thread
From: Arnout Vandecappelle @ 2013-08-29  6:11 UTC (permalink / raw)
  To: buildroot

On 08/28/13 08:35, Thomas Petazzoni wrote:
[snip]
> diff --git a/package/psmisc/psmisc.mk b/package/psmisc/psmisc.mk
> index 1340ee6..61faeab 100644
> --- a/package/psmisc/psmisc.mk
> +++ b/package/psmisc/psmisc.mk
> @@ -10,7 +10,7 @@ PSMISC_LICENSE = GPLv2
>   PSMISC_LICENSE_FILES = COPYING
>   PSMISC_DEPENDENCIES = ncurses $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),gettext)
>
> -ifneq ($(BR2_TOOLCHAIN_BUILDROOT_USE_SSP),y)
> +ifneq ($(BR2_ENABLE_SSP),y)
>   # Don't force -fstack-protector
>   PSMISC_CONF_OPT = --disable-harden-flags
>   endif

  If psmisc normally uses -fstack-protector, then I wouldn't disable that 
just because the user hasn't chosen to enable the option globally.

  In other words, I'd put

ifneq ($(BR2_TOOLCHAIN_HAS_SSP),y)



  Regards,
  Arnout

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 12/12] toolchain: improve mudflap support
  2013-08-28  6:35 ` [Buildroot] [PATCH 12/12] toolchain: improve mudflap support Thomas Petazzoni
@ 2013-08-29  6:18   ` Arnout Vandecappelle
  2013-08-29  7:56     ` Thomas Petazzoni
  0 siblings, 1 reply; 18+ messages in thread
From: Arnout Vandecappelle @ 2013-08-29  6:18 UTC (permalink / raw)
  To: buildroot

On 08/28/13 08:35, Thomas Petazzoni wrote:
> The mudflap library is only useful if one uses the -fmudflap gcc
> option, to do more checks on pointers/arrays, which is typically not
> the case.
>
> This commit:
>
>   * Adds an option to enable/disable mudflap support at the gcc
>     level. By default, it is disabled, which saves a little bit of
>     build time.
>
>   * Adds a way for the external toolchain backend to tell whether
>     mudflap is supported or not by the external toolchain.
>
>   * Adds a global BR2_TOOLCHAIN_HAS_MUDFLAP hidden option, that
>     indicates whether the toolchain (internal or external) supports
>     mudflap.
>
>   * Adds a global BR2_ENABLE_MUDFLAP in "Build options" that allows the
>     user to build all packages with mudflap support. It depends on
>     BR2_TOOLCHAIN_HAS_MUDFLAP.
>
> WARNING WARNING: this currently doesn't result into a working system,
> even with just Busybox. Busybox init crashes with "/sbin/init: symbol
> lookup error: /lib/libmudflapth.so.0: undefined symbol:
> main". According to
> http://gcc.gnu.org/ml/gcc-help/2008-03/msg00165.html  it is caused by
> -Wl,--gc-sections (which is used by Busybox), but even after removing
> it, it still doesn't work. I don't personaly have much interest in
> mudflap support, so as I couldn't get it to work easily, my suggestion
> would be to drop support for it entirely, unless someone steps up to
> fix this issue.

  I would drop the option to enable -fmudflap globally, but keep the 
option to build mudflap support in the internal toolchain. As you wrote 
in another mail, mudflap is a debugging tool and not really a hardening 
tool like SSP.

  Regards,
  Arnout

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 12/12] toolchain: improve mudflap support
  2013-08-29  6:18   ` Arnout Vandecappelle
@ 2013-08-29  7:56     ` Thomas Petazzoni
  2013-08-29 11:24       ` Gustavo Zacarias
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-29  7:56 UTC (permalink / raw)
  To: buildroot

Dear Arnout Vandecappelle,

On Thu, 29 Aug 2013 08:18:43 +0200, Arnout Vandecappelle wrote:

> > WARNING WARNING: this currently doesn't result into a working system,
> > even with just Busybox. Busybox init crashes with "/sbin/init: symbol
> > lookup error: /lib/libmudflapth.so.0: undefined symbol:
> > main". According to
> > http://gcc.gnu.org/ml/gcc-help/2008-03/msg00165.html  it is caused by
> > -Wl,--gc-sections (which is used by Busybox), but even after removing
> > it, it still doesn't work. I don't personaly have much interest in
> > mudflap support, so as I couldn't get it to work easily, my suggestion
> > would be to drop support for it entirely, unless someone steps up to
> > fix this issue.
> 
>   I would drop the option to enable -fmudflap globally, but keep the 
> option to build mudflap support in the internal toolchain. As you wrote 
> in another mail, mudflap is a debugging tool and not really a hardening 
> tool like SSP.

I also agree with this. Gustavo, are you fine with this?

Thanks,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 10/12] toolchain: refactor Stack Smashing Protection support
  2013-08-29  6:11   ` Arnout Vandecappelle
@ 2013-08-29  8:34     ` Thomas Petazzoni
  0 siblings, 0 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2013-08-29  8:34 UTC (permalink / raw)
  To: buildroot

Dear Arnout Vandecappelle,

On Thu, 29 Aug 2013 08:11:54 +0200, Arnout Vandecappelle wrote:
> On 08/28/13 08:35, Thomas Petazzoni wrote:
> [snip]
> > diff --git a/package/psmisc/psmisc.mk b/package/psmisc/psmisc.mk
> > index 1340ee6..61faeab 100644
> > --- a/package/psmisc/psmisc.mk
> > +++ b/package/psmisc/psmisc.mk
> > @@ -10,7 +10,7 @@ PSMISC_LICENSE = GPLv2
> >   PSMISC_LICENSE_FILES = COPYING
> >   PSMISC_DEPENDENCIES = ncurses $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),gettext)
> >
> > -ifneq ($(BR2_TOOLCHAIN_BUILDROOT_USE_SSP),y)
> > +ifneq ($(BR2_ENABLE_SSP),y)
> >   # Don't force -fstack-protector
> >   PSMISC_CONF_OPT = --disable-harden-flags
> >   endif
> 
>   If psmisc normally uses -fstack-protector, then I wouldn't disable that 
> just because the user hasn't chosen to enable the option globally.
> 
>   In other words, I'd put
> 
> ifneq ($(BR2_TOOLCHAIN_HAS_SSP),y)

Sure, why not.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 12/12] toolchain: improve mudflap support
  2013-08-29  7:56     ` Thomas Petazzoni
@ 2013-08-29 11:24       ` Gustavo Zacarias
  0 siblings, 0 replies; 18+ messages in thread
From: Gustavo Zacarias @ 2013-08-29 11:24 UTC (permalink / raw)
  To: buildroot

On 08/29/2013 04:56 AM, Thomas Petazzoni wrote:

>>   I would drop the option to enable -fmudflap globally, but keep the 
>> option to build mudflap support in the internal toolchain. As you wrote 
>> in another mail, mudflap is a debugging tool and not really a hardening 
>> tool like SSP.
> 
> I also agree with this. Gustavo, are you fine with this?

+1 we really don't want to make a Kconfig option out of each possible
compiler flag and, well, busybox doesn't behave with it which many
targets will use.
Regards.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2013-08-29 11:24 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-28  6:35 [Buildroot] [PATCH 00/12] Toolchain updates Thomas Petazzoni
2013-08-28  6:35 ` [Buildroot] [PATCH 01/12] package/Makefile.in: fix incorrect comment Thomas Petazzoni
2013-08-28  6:35 ` [Buildroot] [PATCH 02/12] eglibc: libstdc++ is not part of the C library Thomas Petazzoni
2013-08-28  6:35 ` [Buildroot] [PATCH 03/12] toolchain-internal: skip gcc-intermediate when possible Thomas Petazzoni
2013-08-28  6:35 ` [Buildroot] [PATCH 04/12] gcc: fix Fortran support Thomas Petazzoni
2013-08-28  6:35 ` [Buildroot] [PATCH 05/12] gcc: fix Objective-C support Thomas Petazzoni
2013-08-28  6:35 ` [Buildroot] [PATCH 06/12] gcc: move C++ support option next to Fortran/Objective-C Thomas Petazzoni
2013-08-28  6:35 ` [Buildroot] [PATCH 07/12] toolchain: add support for glibc Thomas Petazzoni
2013-08-28  6:35 ` [Buildroot] [PATCH 08/12] gcc/gcc-final: use the common HOST_GCC_CONFIGURE_SYMLINK macro Thomas Petazzoni
2013-08-28  6:35 ` [Buildroot] [PATCH 09/12] gcc: force symlink creation Thomas Petazzoni
2013-08-28  6:35 ` [Buildroot] [PATCH 10/12] toolchain: refactor Stack Smashing Protection support Thomas Petazzoni
2013-08-29  6:11   ` Arnout Vandecappelle
2013-08-29  8:34     ` Thomas Petazzoni
2013-08-28  6:35 ` [Buildroot] [PATCH 11/12] toolchain: move elf2flt option inclusion to toolchain-buildroot/Config.in Thomas Petazzoni
2013-08-28  6:35 ` [Buildroot] [PATCH 12/12] toolchain: improve mudflap support Thomas Petazzoni
2013-08-29  6:18   ` Arnout Vandecappelle
2013-08-29  7:56     ` Thomas Petazzoni
2013-08-29 11:24       ` Gustavo Zacarias

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox