2004-10-09 07:33:05 +02:00
|
|
|
comment "Binutils Options"
|
|
|
|
|
toolchain: disable SSP support if CFI support in binutils is missing
As reported by [1], SSP support is missing in the Buildroot toolchain
for microblaze even if it's requested by selecting
BR2_TOOLCHAIN_HAS_SSP config option.
In Buildroot, we are using libssp provided by the C library (glibc,
musl, uClibc-ng) when available. We are not using libssp from gcc.
So for a microblaze glibc based toolchain, the SSP support is enabled
unconditionally by a select BR2_TOOLCHAIN_HAS_SSP.
BR2_microblazeel=y
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_KERNEL_HEADERS_4_14=y
BR2_BINUTILS_VERSION_2_30_X=y
BR2_GCC_VERSION_8_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
While building the toolchain, we are building host-binutils which
provide "as" (assembler) and host-gcc-initial wich provide a
minimal cross gcc (C only cross-compiler without any C library).
When SSP support is requested, gcc_cv_libc_provides_ssp=yes is
added to the make command line (see [2] for full details)
With this setting, the SSP support is requested but it's not available
in the end and the toochain build succeed.
When the microblaze toolchain is imported to Biuldroot (2018.05) as
external toolchain with BR2_TOOLCHAIN_EXTERNAL_HAS_SSP set, the build
stop with :
"SSP support not available in this toolchain, please disable BR2_TOOLCHAIN_EXTERNAL_HAS_SSP"
The test is doing the following command line:
echo 'void main(){}' | [...]/host/bin/microblazeel-linux-gcc.br_real -Werror -fstack-protector -x c - -o [...]/build/.br-toolchain-test.tmp
cc1: error: -fstack-protector not supported for this target [-Werror]
When we look at the gcc-final log file (config.log) we can see this
error several time when using the minimal gcc (from host-gcc-initial).
So Why the minimal gcc doesn't support SSP?
When we look at the gcc-initial log file (config.log) we can see an
error with 'as':
configure:23194: checking assembler for cfi directives
configure:23209: [...]microblazeel-buildroot-linux-gnu/bin/as -o conftest.o conftest.s >&5
conftest.s: Assembler messages:
conftest.s:2: Error: CFI is not supported for this target
conftest.s:3: Error: CFI is not supported for this target
conftest.s:4: Error: CFI is not supported for this target
conftest.s:5: Error: CFI is not supported for this target
conftest.s:6: Error: CFI is not supported for this target
conftest.s:7: Error: CFI is not supported for this target
configure:23212: $? = 1
configure: failed program was
.text
.cfi_startproc
.cfi_offset 0, 0
.cfi_same_value 1
.cfi_def_cfa 1, 2
.cfi_escape 1, 2, 3, 4, 5
.cfi_endproc
This is the only relevant difference compared to a nios2 toolchain where
libssp is enabled and available (nios2 is an example).
"CFI" stand for "Control Flow Integrity" and it seems that SSP support
requires CFI target support (see [3] for some explanation).
The SSP support seems to depends on CFI support, but the toolchain
infrastructure is not detailed enough to handle the CFI dependency.
The NiosII toolchains built with binutils < 2.30 are also affected by
this issue.
This patch improve the toolchain infrastructure by adding a new
BR2_PACKAGE_HOST_BINUTILS_SUPPORTS_CFI blind option
Disable SSP support for microblaze entirely.
Disable SSP support for nios2 only with Binutils < 2.30.
Fixes:
https://gitlab.com/free-electrons/toolchains-builder/-/jobs/72006389
[1] https://gitlab.com/free-electrons/toolchains-builder/issues/1
[2] https://git.buildroot.net/buildroot/tree/package/gcc/gcc.mk?h=2018.05#n275
[3] https://grsecurity.net/rap_faq.php
Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[Thomas: adjust how the BR2_PACKAGE_HOST_BINUTILS_SUPPORTS_CFI option
is expressed.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-09-08 16:41:39 +02:00
|
|
|
config BR2_PACKAGE_HOST_BINUTILS_SUPPORTS_CFI
|
|
|
|
bool
|
|
|
|
default y
|
|
|
|
depends on !BR2_microblaze
|
|
|
|
|
2004-10-09 03:06:03 +02:00
|
|
|
choice
|
|
|
|
prompt "Binutils Version"
|
2019-05-31 08:39:03 +02:00
|
|
|
default BR2_BINUTILS_VERSION_2_31_X if !BR2_arc && !BR2_csky
|
2017-11-10 17:37:26 +01:00
|
|
|
default BR2_BINUTILS_VERSION_ARC if BR2_arc
|
2019-05-31 08:39:03 +02:00
|
|
|
default BR2_BINUTILS_VERSION_CSKY if BR2_csky
|
2004-10-09 03:06:03 +02:00
|
|
|
help
|
|
|
|
Select the version of binutils you wish to use.
|
|
|
|
|
2018-01-29 23:39:39 +01:00
|
|
|
config BR2_BINUTILS_VERSION_2_30_X
|
|
|
|
bool "binutils 2.30"
|
2019-05-31 08:39:03 +02:00
|
|
|
depends on !BR2_csky
|
2018-01-29 23:39:39 +01:00
|
|
|
|
2018-07-16 23:30:10 +02:00
|
|
|
config BR2_BINUTILS_VERSION_2_31_X
|
2018-07-18 14:07:54 +02:00
|
|
|
bool "binutils 2.31.1"
|
2019-05-31 08:39:03 +02:00
|
|
|
depends on !BR2_csky
|
2018-07-16 23:30:10 +02:00
|
|
|
|
2019-03-10 11:44:28 +01:00
|
|
|
config BR2_BINUTILS_VERSION_2_32_X
|
|
|
|
bool "binutils 2.32"
|
2019-05-31 08:39:03 +02:00
|
|
|
depends on !BR2_csky
|
2019-03-10 11:44:28 +01:00
|
|
|
|
2017-11-10 17:37:26 +01:00
|
|
|
config BR2_BINUTILS_VERSION_ARC
|
2018-11-08 12:32:07 +01:00
|
|
|
bool "binutils arc (2.31)"
|
2017-11-10 17:37:26 +01:00
|
|
|
depends on BR2_arc
|
2019-05-31 08:39:03 +02:00
|
|
|
|
|
|
|
config BR2_BINUTILS_VERSION_CSKY
|
|
|
|
bool "binutils csky"
|
|
|
|
depends on BR2_csky
|
|
|
|
|
2004-10-09 03:06:03 +02:00
|
|
|
endchoice
|
|
|
|
|
|
|
|
config BR2_BINUTILS_VERSION
|
|
|
|
string
|
2019-06-19 11:25:32 +02:00
|
|
|
default "arc-2019.03-release" if BR2_BINUTILS_VERSION_ARC
|
2019-05-31 08:39:03 +02:00
|
|
|
default "c66d8bbcebfddf713b2b436e1b135e6b125a55a5" if BR2_BINUTILS_VERSION_CSKY
|
2018-01-29 23:39:39 +01:00
|
|
|
default "2.30" if BR2_BINUTILS_VERSION_2_30_X
|
2018-07-18 14:07:54 +02:00
|
|
|
default "2.31.1" if BR2_BINUTILS_VERSION_2_31_X
|
2019-03-10 11:44:28 +01:00
|
|
|
default "2.32" if BR2_BINUTILS_VERSION_2_32_X
|
2006-03-10 09:46:36 +01:00
|
|
|
|
2015-03-06 13:34:06 +01:00
|
|
|
config BR2_BINUTILS_ENABLE_LTO
|
|
|
|
bool
|
|
|
|
|
2010-12-31 12:39:01 +01:00
|
|
|
config BR2_BINUTILS_EXTRA_CONFIG_OPTIONS
|
2006-07-17 05:53:12 +02:00
|
|
|
string "Additional binutils options"
|
|
|
|
default ""
|
|
|
|
help
|
2007-09-17 13:19:04 +02:00
|
|
|
Any additional binutils options you may want to include.
|