Print this page
11866 Use -fstack-protector-strong when available
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: John Levon <john.levon@joyent.com>
Change-Id: Iaffe3e8275a3e6a06cc430743cd6539ead38f736


 117 #
 118 #       kernel-specific optimizations; override default in Makefile.master
 119 #
 120 
 121 CFLAGS_XARCH_32         = $(i386_CFLAGS)
 122 CFLAGS_XARCH_64         = $(amd64_CFLAGS)
 123 CFLAGS_XARCH            = $(CFLAGS_XARCH_$(CLASS))
 124 
 125 COPTFLAG_32             = $(COPTFLAG)
 126 COPTFLAG_64             = $(COPTFLAG64)
 127 COPTIMIZE               = $(COPTFLAG_$(CLASS))
 128 
 129 CFLAGS                  = $(CFLAGS_XARCH)
 130 CFLAGS                  += $(COPTIMIZE)
 131 CFLAGS                  += $(INLINES) -D_ASM_INLINES
 132 CFLAGS                  += $(CCMODE)
 133 CFLAGS                  += $(SPACEFLAG)
 134 CFLAGS                  += $(CCUNBOUND)
 135 CFLAGS                  += $(CFLAGS_uts)
 136 CFLAGS                  += -xstrconst
 137 CFLAGS                  += -_gcc=-fstack-protector
 138 































 139 ASFLAGS_XARCH_32        = $(i386_ASFLAGS)
 140 ASFLAGS_XARCH_64        = $(amd64_ASFLAGS)
 141 ASFLAGS_XARCH           = $(ASFLAGS_XARCH_$(CLASS))
 142 
 143 ASFLAGS                 += $(ASFLAGS_XARCH)
 144 
 145 #
 146 #       Define the base directory for installation.
 147 #
 148 BASE_INS_DIR    = $(ROOT)
 149 
 150 #
 151 #       Debugging level
 152 #
 153 #       Special knowledge of which special debugging options affect which
 154 #       file is used to optimize the build if these flags are changed.
 155 #
 156 DEBUG_DEFS_OBJ32        =
 157 DEBUG_DEFS_DBG32        = -DDEBUG
 158 DEBUG_DEFS_OBJ64        =




 117 #
 118 #       kernel-specific optimizations; override default in Makefile.master
 119 #
 120 
 121 CFLAGS_XARCH_32         = $(i386_CFLAGS)
 122 CFLAGS_XARCH_64         = $(amd64_CFLAGS)
 123 CFLAGS_XARCH            = $(CFLAGS_XARCH_$(CLASS))
 124 
 125 COPTFLAG_32             = $(COPTFLAG)
 126 COPTFLAG_64             = $(COPTFLAG64)
 127 COPTIMIZE               = $(COPTFLAG_$(CLASS))
 128 
 129 CFLAGS                  = $(CFLAGS_XARCH)
 130 CFLAGS                  += $(COPTIMIZE)
 131 CFLAGS                  += $(INLINES) -D_ASM_INLINES
 132 CFLAGS                  += $(CCMODE)
 133 CFLAGS                  += $(SPACEFLAG)
 134 CFLAGS                  += $(CCUNBOUND)
 135 CFLAGS                  += $(CFLAGS_uts)
 136 CFLAGS                  += -xstrconst

 137 
 138 #
 139 # Options to control which version of stack-protector we enable. This
 140 # gives us a bit of flexibility and is unfortunately necessary as some
 141 # modules do not function correctly with our defaults (qede).
 142 #
 143 #  o STACKPROTECT_              Sets the appropriate version for the compiler
 144 #  o STACKPROTECT_strong        Sets us to use strong on all of the
 145 #                               compilers it supports. This is the same
 146 #                               as the default.
 147 #
 148 #  o STACKPROTECT_none          Disables the stack protector.
 149 #
 150 #  o STACKPROTECT_all           Enables it for everything.
 151 #
 152 #  o STACKPROTECT_basic         Enables the basic stack protector.
 153 #
 154 # -fstack-protector-strong is not available in our gcc4 which is why we
 155 # have per-compiler versions below.
 156 #
 157 STACKPROTECT_           = -_gcc4=-fstack-protector
 158 STACKPROTECT_           += -_gcc7=-fstack-protector-strong
 159 STACKPROTECT_           += -_gcc8=-fstack-protector-strong
 160 STACKPROTECT_           += -_gcc9=-fstack-protector-strong
 161 
 162 STACKPROTECT_strong     = $(STACKPROTECT_)
 163 STACKPROTECT_none       = -_gcc=-fstack-protector-none
 164 STACKPROTECT_all        = -_gcc=-fstack-protector-all
 165 STACKPROTECT_basic      = -_gcc=-fstack-protector
 166 
 167 CFLAGS                  += $(STACKPROTECT_$(STACKPROTECT))
 168 
 169 ASFLAGS_XARCH_32        = $(i386_ASFLAGS)
 170 ASFLAGS_XARCH_64        = $(amd64_ASFLAGS)
 171 ASFLAGS_XARCH           = $(ASFLAGS_XARCH_$(CLASS))
 172 
 173 ASFLAGS                 += $(ASFLAGS_XARCH)
 174 
 175 #
 176 #       Define the base directory for installation.
 177 #
 178 BASE_INS_DIR    = $(ROOT)
 179 
 180 #
 181 #       Debugging level
 182 #
 183 #       Special knowledge of which special debugging options affect which
 184 #       file is used to optimize the build if these flags are changed.
 185 #
 186 DEBUG_DEFS_OBJ32        =
 187 DEBUG_DEFS_DBG32        = -DDEBUG
 188 DEBUG_DEFS_OBJ64        =