File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -106,8 +106,20 @@ fn main() {
106
106
. extra_warnings ( false )
107
107
. include ( WASM3_SOURCE ) ;
108
108
109
+ let target_arch = env:: var ( "CARGO_CFG_TARGET_ARCH" ) . unwrap ( ) ;
110
+ let target_env = env:: var ( "CARGO_CFG_TARGET_ENV" ) . unwrap ( ) ;
111
+ let target_vendor = env:: var ( "CARGO_CFG_TARGET_VENDOR" ) . unwrap ( ) ;
112
+
113
+ // Set options specific for x86_64-fortanix-unknown-sgx target.
114
+ if target_arch == "x86_64" && target_env == "sgx" && target_vendor == "fortanix" {
115
+ // Disable the stack protector as the Fortanix ABI currently sets FS and GS bases to the
116
+ // same value and the stack protector assumes the canary value is at FS:0x28 but with the
117
+ // Fortanix ABI that contains a copy of RSP.
118
+ cfg. flag ( "-fno-stack-protector" ) ;
119
+ }
120
+
109
121
// Add any extra arguments from the environment to the CC command line.
110
- if let Ok ( extra_clang_args) = std :: env:: var ( "BINDGEN_EXTRA_CLANG_ARGS" ) {
122
+ if let Ok ( extra_clang_args) = env:: var ( "BINDGEN_EXTRA_CLANG_ARGS" ) {
111
123
// Try to parse it with shell quoting. If we fail, make it one single big argument.
112
124
if let Some ( strings) = shlex:: split ( & extra_clang_args) {
113
125
strings. iter ( ) . for_each ( |string| {
You can’t perform that action at this time.
0 commit comments