Skip to main content
added 112 characters in body
Source Link
Asmadeus
  • 226
  • 2
  • 5

Options that contain HAVE_ are generally things that depend on your build environment, not options per se.

You can see this one being defined in arch/arm64/Kconfig:

config CC_HAVE_STACKPROTECTOR_SYSREG
        def_bool $(cc-option,-mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0)

So you can test if your compiler supports it, for example my x86_64 gcc obviously doesn't support it but the aarch64 one (which would be used for an arm64 kernel build!) does for me:

$ echo "int main() { return 0; }" | gcc -x c - -c -o /dev/null -mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0
gcc: error: unrecognized argument in option ‘-mstack-protector-guard=sysreg’
gcc: note: valid arguments to ‘-mstack-protector-guard=’ are: global tls
$ echo "int main() { return 0; }" | aarch64-linux-gnu-gcc -x c - -c -o /dev/null -mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0
$

try that command and see why it fails, you might just need a newer gcc? People online complain the sp_el0 is not present in GCC 8, so I believe it was introduced around gcc 9 or 10.

Options that contain HAVE_ are generally things that depend on your build environment, not options per se.

You can see this one being defined in arch/arm64/Kconfig:

config CC_HAVE_STACKPROTECTOR_SYSREG
        def_bool $(cc-option,-mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0)

So you can test if your compiler supports it, for example my x86_64 gcc obviously doesn't support it but the aarch64 one (which would be used for an arm64 kernel build!) does for me:

$ echo "int main() { return 0; }" | gcc -x c - -c -o /dev/null -mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0
gcc: error: unrecognized argument in option ‘-mstack-protector-guard=sysreg’
gcc: note: valid arguments to ‘-mstack-protector-guard=’ are: global tls
$ echo "int main() { return 0; }" | aarch64-linux-gnu-gcc -x c - -c -o /dev/null -mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0
$

try that command and see why it fails, you might just need a newer gcc?

Options that contain HAVE_ are generally things that depend on your build environment, not options per se.

You can see this one being defined in arch/arm64/Kconfig:

config CC_HAVE_STACKPROTECTOR_SYSREG
        def_bool $(cc-option,-mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0)

So you can test if your compiler supports it, for example my x86_64 gcc obviously doesn't support it but the aarch64 one (which would be used for an arm64 kernel build!) does for me:

$ echo "int main() { return 0; }" | gcc -x c - -c -o /dev/null -mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0
gcc: error: unrecognized argument in option ‘-mstack-protector-guard=sysreg’
gcc: note: valid arguments to ‘-mstack-protector-guard=’ are: global tls
$ echo "int main() { return 0; }" | aarch64-linux-gnu-gcc -x c - -c -o /dev/null -mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0
$

try that command and see why it fails, you might just need a newer gcc? People online complain the sp_el0 is not present in GCC 8, so I believe it was introduced around gcc 9 or 10.

Source Link
Asmadeus
  • 226
  • 2
  • 5

Options that contain HAVE_ are generally things that depend on your build environment, not options per se.

You can see this one being defined in arch/arm64/Kconfig:

config CC_HAVE_STACKPROTECTOR_SYSREG
        def_bool $(cc-option,-mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0)

So you can test if your compiler supports it, for example my x86_64 gcc obviously doesn't support it but the aarch64 one (which would be used for an arm64 kernel build!) does for me:

$ echo "int main() { return 0; }" | gcc -x c - -c -o /dev/null -mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0
gcc: error: unrecognized argument in option ‘-mstack-protector-guard=sysreg’
gcc: note: valid arguments to ‘-mstack-protector-guard=’ are: global tls
$ echo "int main() { return 0; }" | aarch64-linux-gnu-gcc -x c - -c -o /dev/null -mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0
$

try that command and see why it fails, you might just need a newer gcc?