HEADSUP: toolchain modifications required for built-in SSP

Sebastian Huber sebastian.huber@embedded-brains.de
Mon Dec 4 12:05:00 GMT 2017


On 04/12/17 10:05, Corinna Vinschen wrote:
> On Dec  4 08:32, Sebastian Huber wrote:
>> It would be nice to have a snapshot before the next release to test this. Is
>> the next release 3.0.0 (due to the 64-bit time_t) or 2.6.0?
>>
>> On 30/11/17 11:41, Yaakov Selkowitz wrote:
>>> gcc8-ssp-newlib.patch
>>>
>>>
>>> 2017-11-29  Yaakov Selkowitz<yselkowi@redhat.com>
>>>
>>> 	gcc/
>>> 	* configure.ac (gcc_cv_libc_provides_ssp): Define as yes
>>> 	on Newlib-based targets if new builtin SSP support is present.
>>> 	* configure: Regenerate.
>>>
>>> Index: gcc/configure
>>> ===================================================================
>>> --- gcc/configure	(revision 255250)
>>> +++ gcc/configure	(working copy)
>>> @@ -29100,6 +29100,12 @@
>>>    fi
>>>            ;;
>>> +       *-*-cygwin* | *-*-rtems* | *-*-eabi* | *-*-elf* | mmix-knuth-mmixware)
>> Instead of this target enumeration, could we not use an $EGREP approach
>> similar to some other libc variants?
> Can you make up an example?

The other libc use something like this:

        *-*-linux* | *-*-kfreebsd*-gnu)
       # glibc 2.4 and later provides __stack_chk_fail and
       # either __stack_chk_guard, or TLS access to stack guard canary.
       GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], 
[gcc_cv_libc_provides_ssp=yes], [
       [if test -f $target_header_dir/features.h \
      && $EGREP '^[     ]*#[     ]*define[ ]+__GNU_LIBRARY__[     
]+([1-9][0-9]|[6-9])' \
         $target_header_dir/features.h > /dev/null; then
     if $EGREP '^[     ]*#[     ]*define[     ]+__UCLIBC__[     ]+1' \
          $target_header_dir/features.h > /dev/null && \
          test -f $target_header_dir/bits/uClibc_config.h && \
          $EGREP '^[     ]*#[     ]*define[     ]+__UCLIBC_HAS_SSP__[ 
     ]+1' \
          $target_header_dir/bits/uClibc_config.h > /dev/null; then
       gcc_cv_libc_provides_ssp=yes
     fi
       # all versions of Bionic support stack protector
       elif test -f $target_header_dir/sys/cdefs.h \
         && $EGREP '^[  ]*#[    ]*define[ ]+__BIONIC__[   ]+1' \
            $target_header_dir/sys/cdefs.h > /dev/null; then
          gcc_cv_libc_provides_ssp=yes
       fi]])

The patch uses "*-*-cygwin* | *-*-rtems* | *-*-eabi* | *-*-elf* | 
mmix-knuth-mmixware)" to determine if the libc is Newlib. It will 
probably not work with a "*-*-phoenix*" target with uses Newlib.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the Newlib mailing list