Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 484714 | Differences between
and this patch

Collapse All | Expand All

(-)a/configure.ac (+3 lines)
Lines 3238-3243 case $build in Link Here
3238
    esac ;;
3238
    esac ;;
3239
esac
3239
esac
3240
3240
3241
# Needed when we build with -fstack-protector as default.
3242
stage1_cflags="$stage1_cflags -fno-stack-protector"
3243
3241
AC_SUBST(stage1_cflags)
3244
AC_SUBST(stage1_cflags)
3242
3245
3243
# Enable --enable-checking in stage1 of the compiler.
3246
# Enable --enable-checking in stage1 of the compiler.
(-)a/configure (-1 / +2 lines)
Lines 14453-14459 case $build in Link Here
14453
    esac ;;
14453
    esac ;;
14454
esac
14454
esac
14455
14455
14456
14456
# Needed when we build with -fstack-protector as default.
14457
stage1_cflags="$stage1_cflags -fno-stack-protector"
14457
14458
14458
# Enable --enable-checking in stage1 of the compiler.
14459
# Enable --enable-checking in stage1 of the compiler.
14459
# Check whether --enable-stage1-checking was given.
14460
# Check whether --enable-stage1-checking was given.
(-)a/Makefile.in (-27 / +40 lines)
Lines 362-368 BUILD_PREFIX_1 = @BUILD_PREFIX_1@ Link Here
362
362
363
# Flags to pass to stage2 and later makes.  They are defined
363
# Flags to pass to stage2 and later makes.  They are defined
364
# here so that they can be overridden by Makefile fragments.
364
# here so that they can be overridden by Makefile fragments.
365
BOOT_CFLAGS= -g -O2
365
BOOT_CFLAGS= -g -O2 -fno-stack-protector
366
BOOT_LDFLAGS=
366
BOOT_LDFLAGS=
367
BOOT_ADAFLAGS= -gnatpg
367
BOOT_ADAFLAGS= -gnatpg
368
368
Lines 408-416 GNATMAKE = @GNATMAKE@ Link Here
408
408
409
CFLAGS = @CFLAGS@
409
CFLAGS = @CFLAGS@
410
LDFLAGS = @LDFLAGS@
410
LDFLAGS = @LDFLAGS@
411
LIBCFLAGS = $(CFLAGS)
411
LIBCFLAGS = $(CFLAGS) -fno-stack-protector
412
CXXFLAGS = @CXXFLAGS@
412
CXXFLAGS = @CXXFLAGS@
413
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
413
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates -fno-stack-protector
414
GOCFLAGS = $(CFLAGS)
414
GOCFLAGS = $(CFLAGS)
415
415
416
TFLAGS =
416
TFLAGS =
417
-- a/gcc/doc/invoke.texi 2009-12-21
Lines 8111-8116 Link Here
8111
when a function is entered and then checked when the function exits.
8111
when a function is entered and then checked when the function exits.
8112
If a guard check fails, an error message is printed and the program exits.
8112
If a guard check fails, an error message is printed and the program exits.
8113
8113
8114
NOTE: In Gentoo Gcc 4.8.2 and later versions this option is enabled by default
8115
for C, C++, ObjC, ObjC++, if none of @option{-fno-stack-protector},
8116
@option{-nostdlib}, nor @option{-ffreestanding} are found.
8117
8114
@item -fstack-protector-all
8118
@item -fstack-protector-all
8115
@opindex fstack-protector-all
8119
@opindex fstack-protector-all
8116
-- a/gcc/cp/lang-specs.h
8120
++ b/gcc/cp/lang-specs.h
Lines 46-52 along with GCC; see the file COPYING3. If not see Link Here
46
		%(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
46
		%(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
47
      cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
47
      cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
48
	      %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
48
	      %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
49
	%(cc1_options) %2\
49
	%(cc1_options) %(ssp_default) %2\
50
	%{!fsyntax-only:%{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\
50
	%{!fsyntax-only:%{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\
51
        %W{o*:--output-pch=%*}}%V}}}}",
51
        %W{o*:--output-pch=%*}}%V}}}}",
52
     CPLUSPLUS_CPP_SPEC, 0, 0},
52
     CPLUSPLUS_CPP_SPEC, 0, 0},
Lines 57-67 along with GCC; see the file COPYING3. If not see Link Here
57
		%(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
57
		%(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
58
      cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
58
      cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
59
	      %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
59
	      %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
60
	%(cc1_options) %2\
60
	%(cc1_options) %(ssp_default) %2\
61
       %{!fsyntax-only:%(invoke_as)}}}}",
61
       %{!fsyntax-only:%(invoke_as)}}}}",
62
     CPLUSPLUS_CPP_SPEC, 0, 0},
62
     CPLUSPLUS_CPP_SPEC, 0, 0},
63
  {".ii", "@c++-cpp-output", 0, 0, 0},
63
  {".ii", "@c++-cpp-output", 0, 0, 0},
64
  {"@c++-cpp-output",
64
  {"@c++-cpp-output",
65
   "%{!M:%{!MM:%{!E:\
65
   "%{!M:%{!MM:%{!E:\
66
    cc1plus -fpreprocessed %i %(cc1_options) %2\
66
    cc1plus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\
67
    %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
67
    %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
68
-- a/gcc/gcc.c
68
++ b/gcc/gcc.c
Lines 651-656 proper position among the other output files. */ Link Here
651
#define LINK_GCC_C_SEQUENCE_SPEC "%G %L %G"
651
#define LINK_GCC_C_SEQUENCE_SPEC "%G %L %G"
652
#endif
652
#endif
653
653
654
#ifndef SSP_DEFAULT_SPEC
655
#if defined ( TARGET_LIBC_PROVIDES_SSP ) && defined ( EFAULT_SSP )
656
#define SSP_DEFAULT_SPEC "%{fno-stack-protector|fstack-protector-all|ffreestanding|nostdlib:;:-fstack-protector}"
657
#else
658
#define SSP_DEFAULT_SPEC ""
659
#endif
660
#endif
661
654
#ifndef LINK_SSP_SPEC
662
#ifndef LINK_SSP_SPEC
655
#ifdef TARGET_LIBC_PROVIDES_SSP
663
#ifdef TARGET_LIBC_PROVIDES_SSP
656
#define LINK_SSP_SPEC "%{fstack-protector:}"
664
#define LINK_SSP_SPEC "%{fstack-protector:}"
Lines 777-782 static const char *cc1_spec = CC1_SPEC; Link Here
777
static const char *cc1plus_spec = CC1PLUS_SPEC;
785
static const char *cc1plus_spec = CC1PLUS_SPEC;
778
static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
786
static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
779
static const char *link_ssp_spec = LINK_SSP_SPEC;
787
static const char *link_ssp_spec = LINK_SSP_SPEC;
788
static const char *ssp_default_spec = SSP_DEFAULT_SPEC;
780
static const char *asm_spec = ASM_SPEC;
789
static const char *asm_spec = ASM_SPEC;
781
static const char *asm_final_spec = ASM_FINAL_SPEC;
790
static const char *asm_final_spec = ASM_FINAL_SPEC;
782
static const char *link_spec = LINK_SPEC;
791
static const char *link_spec = LINK_SPEC;
Lines 835-841 static const char *cpp_unique_options = Link Here
835
static const char *cpp_options =
844
static const char *cpp_options =
836
"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
845
"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
837
 %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\
846
 %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\
838
 %{undef} %{save-temps*:-fpch-preprocess}";
847
 %{undef} %{save-temps*:-fpch-preprocess} %(ssp_default)";
839
848
840
/* This contains cpp options which are not passed when the preprocessor
849
/* This contains cpp options which are not passed when the preprocessor
841
   output will be used by another program.  */
850
   output will be used by another program.  */
Lines 1015-1023 static const struct compiler default_compilers[] = Link Here
1015
      %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
1024
      %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
1016
	  %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\
1025
	  %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\
1017
	    cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
1026
	    cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
1018
	  %(cc1_options)}\
1027
	  %(cc1_options) %(ssp_default)}\
1019
      %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
1028
      %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
1020
	  cc1 %(cpp_unique_options) %(cc1_options)}}}\
1029
	  cc1 %(cpp_unique_options) %(cc1_options) %(ssp_default)}}}\
1021
      %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 1},
1030
      %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 1},
1022
  {"-",
1031
  {"-",
1023
   "%{!E:%e-E or -x required when input is from standard input}\
1032
   "%{!E:%e-E or -x required when input is from standard input}\
Lines 1040-1046 static const struct compiler default_compilers[] = Link Here
1040
                    %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
1049
                    %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
1041
  {".i", "@cpp-output", 0, 0, 0},
1050
  {".i", "@cpp-output", 0, 0, 0},
1042
  {"@cpp-output",
1051
  {"@cpp-output",
1043
   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
1052
   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(ssp_default) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
1044
  {".s", "@assembler", 0, 0, 0},
1053
  {".s", "@assembler", 0, 0, 0},
1045
  {"@assembler",
1054
  {"@assembler",
1046
   "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
1055
   "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
Lines 1267-1272 static struct spec_list static_specs[] = Link Here
1267
  INIT_STATIC_SPEC ("cc1plus",			&cc1plus_spec),
1276
  INIT_STATIC_SPEC ("cc1plus",			&cc1plus_spec),
1268
  INIT_STATIC_SPEC ("link_gcc_c_sequence",	&link_gcc_c_sequence_spec),
1277
  INIT_STATIC_SPEC ("link_gcc_c_sequence",	&link_gcc_c_sequence_spec),
1269
  INIT_STATIC_SPEC ("link_ssp",			&link_ssp_spec),
1278
  INIT_STATIC_SPEC ("link_ssp",			&link_ssp_spec),
1279
  INIT_STATIC_SPEC ("ssp_default",		&ssp_default_spec),
1270
  INIT_STATIC_SPEC ("endfile",			&endfile_spec),
1280
  INIT_STATIC_SPEC ("endfile",			&endfile_spec),
1271
  INIT_STATIC_SPEC ("link",			&link_spec),
1281
  INIT_STATIC_SPEC ("link",			&link_spec),
1272
  INIT_STATIC_SPEC ("lib",			&lib_spec),
1282
  INIT_STATIC_SPEC ("lib",			&lib_spec),
1273
-- a/gcc/objc/lang-specs.h
1283
++ b/gcc/objc/lang-specs.h
Lines 29-37 along with GCC; see the file COPYING3. If not see Link Here
29
	%{traditional|traditional-cpp:\
29
	%{traditional|traditional-cpp:\
30
%eGNU Objective C no longer supports traditional compilation}\
30
%eGNU Objective C no longer supports traditional compilation}\
31
	%{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
31
	%{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
32
	    cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}\
32
	    cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}}\
33
	%{!save-temps*:%{!no-integrated-cpp:\
33
	%{!save-temps*:%{!no-integrated-cpp:\
34
	    cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}}\
34
	    cc1obj %(cpp_unique_options) %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}}}\
35
        %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
35
        %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
36
  {"@objective-c-header",
36
  {"@objective-c-header",
37
     "%{E|M|MM:cc1obj -E %{traditional|traditional-cpp:-traditional-cpp}\
37
     "%{E|M|MM:cc1obj -E %{traditional|traditional-cpp:-traditional-cpp}\
Lines 40-57 along with GCC; see the file COPYING3. If not see Link Here
40
	%{traditional|traditional-cpp:\
40
	%{traditional|traditional-cpp:\
41
%eGNU Objective C no longer supports traditional compilation}\
41
%eGNU Objective C no longer supports traditional compilation}\
42
	%{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
42
	%{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
43
	    cc1obj -fpreprocessed %b.mi %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
43
	    cc1obj -fpreprocessed %b.mi %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
44
                        -o %g.s %{!o*:--output-pch=%i.gch}\
44
                        -o %g.s %{!o*:--output-pch=%i.gch}\
45
                        %W{o*:--output-pch=%*}%V}\
45
                        %W{o*:--output-pch=%*}%V}\
46
	%{!save-temps*:%{!no-integrated-cpp:\
46
	%{!save-temps*:%{!no-integrated-cpp:\
47
	    cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
47
	    cc1obj %(cpp_unique_options) %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
48
                        -o %g.s %{!o*:--output-pch=%i.gch}\
48
                        -o %g.s %{!o*:--output-pch=%i.gch}\
49
                        %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0},
49
                        %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0},
50
  {".mi", "@objective-c-cpp-output", 0, 0, 0},
50
  {".mi", "@objective-c-cpp-output", 0, 0, 0},
51
  {"@objective-c-cpp-output",
51
  {"@objective-c-cpp-output",
52
     "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
52
     "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
53
			     %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
53
			     %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
54
  {"@objc-cpp-output",
54
  {"@objc-cpp-output",
55
      "%nobjc-cpp-output is deprecated; please use objective-c-cpp-output instead\n\
55
      "%nobjc-cpp-output is deprecated; please use objective-c-cpp-output instead\n\
56
       %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
56
       %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
57
			     %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
57
			     %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
58
-- a/gcc/objcp/lang-specs.h
58
++ b/gcc/objcp/lang-specs.h
Lines 36-42 along with GCC; see the file COPYING3. If not see Link Here
36
		%(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
36
		%(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
37
      cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
37
      cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
38
	      %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
38
	      %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
39
	%(cc1_options) %2\
39
	%(cc1_options) %(ssp_default) %2\
40
        -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
40
        -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
41
     CPLUSPLUS_CPP_SPEC, 0, 0},
41
     CPLUSPLUS_CPP_SPEC, 0, 0},
42
  {"@objective-c++",
42
  {"@objective-c++",
Lines 46-61 along with GCC; see the file COPYING3. If not see Link Here
46
		%(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
46
		%(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
47
      cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
47
      cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
48
	      %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
48
	      %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
49
	%(cc1_options) %2\
49
	%(cc1_options) %(ssp_default) %2\
50
       %{!fsyntax-only:%(invoke_as)}}}}",
50
       %{!fsyntax-only:%(invoke_as)}}}}",
51
     CPLUSPLUS_CPP_SPEC, 0, 0},
51
     CPLUSPLUS_CPP_SPEC, 0, 0},
52
  {".mii", "@objective-c++-cpp-output", 0, 0, 0},
52
  {".mii", "@objective-c++-cpp-output", 0, 0, 0},
53
  {"@objective-c++-cpp-output",
53
  {"@objective-c++-cpp-output",
54
   "%{!M:%{!MM:%{!E:\
54
   "%{!M:%{!MM:%{!E:\
55
    cc1objplus -fpreprocessed %i %(cc1_options) %2\
55
    cc1objplus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\
56
    %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
56
    %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
57
  {"@objc++-cpp-output",
57
  {"@objc++-cpp-output",
58
   "%nobjc++-cpp-output is deprecated; please use objective-c++-cpp-output instead\n\
58
   "%nobjc++-cpp-output is deprecated; please use objective-c++-cpp-output instead\n\
59
    %{!M:%{!MM:%{!E:\
59
    %{!M:%{!MM:%{!E:\
60
    cc1objplus -fpreprocessed %i %(cc1_options) %2\
60
    cc1objplus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\
61
    %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
61
    %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
62
-- a/gcc/params.def
62
++ b/gcc/params.def
Lines 662-668 DEFPARAM (PARAM_INTEGER_SHARE_LIMIT, Link Here
662
DEFPARAM (PARAM_SSP_BUFFER_SIZE,
662
DEFPARAM (PARAM_SSP_BUFFER_SIZE,
663
	  "ssp-buffer-size",
663
	  "ssp-buffer-size",
664
	  "The lower bound for a buffer to be considered for stack smashing protection",
664
	  "The lower bound for a buffer to be considered for stack smashing protection",
665
	  8, 1, 0)
665
	  4, 1, 0)
666
666
667
/* When we thread through a block we have to make copies of the
667
/* When we thread through a block we have to make copies of the
668
   statements within the block.  Clearly for large blocks the code
668
   statements within the block.  Clearly for large blocks the code

Return to bug 484714