You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by di...@apache.org on 2020/03/23 05:08:52 UTC

[incubator-teaclave-sgx-sdk] branch v1.1.1-testing updated: Add autogen patch for fixing thunk missing error during reconf

This is an automated email from the ASF dual-hosted git repository.

dingyu pushed a commit to branch v1.1.1-testing
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git


The following commit(s) were added to refs/heads/v1.1.1-testing by this push:
     new 084d44d  Add autogen patch for fixing thunk missing error during reconf
084d44d is described below

commit 084d44de623d8c6bd914b7e3419a9050d634cb0a
Author: Yu Ding <di...@gmail.com>
AuthorDate: Sun Mar 22 22:08:40 2020 -0700

    Add autogen patch for fixing thunk missing error during reconf
---
 sgx_unwind/libunwind/autogen-linux.sh | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/sgx_unwind/libunwind/autogen-linux.sh b/sgx_unwind/libunwind/autogen-linux.sh
old mode 100644
new mode 100755
index 77c46c1..2ea88d3
--- a/sgx_unwind/libunwind/autogen-linux.sh
+++ b/sgx_unwind/libunwind/autogen-linux.sh
@@ -68,7 +68,34 @@ fi
 
 sed -i "s/rtmk-nova\*/rtmk-nova\* | linux-sgx/" $srcdir/config/config.sub
 
+#Insert following codes into configure after add "-mfunction-return=thunk-extern -mindirect-branch-register" option, Or the "checking whether the C compiler works..." check will fail
+#Insert following codes into configure after add "-mfunction-return=thunk-extern -mindirect-branch-register" option, Or the "checking whether we are cross compiling... " check will fail
+#  #pragma GCC push_options
+#  #pragma GCC optimize ("-fomit-frame-pointer")
+#  void __x86_return_thunk()
+#  {
+#      __asm__("ret\n\t");
+#  }
+#  void __x86_indirect_thunk_rax()
+#  {
+#      __asm__("jmp *%rax\n\t");
+#  }
+#  #pragma GCC pop_options
+line=`grep -n "__x86_return_thunk()" $srcdir/configure | cut -d: -f 1`
+if [ -n "$line" ]; then
+  echo "__x86_return_thunk() already exist..."
+else
+  line_end=`grep -n "\"checking whether the C compiler works... \"" $srcdir/configure | cut -d: -f 1`
+  line_start=`expr $line_end - 30`  #Search an scope
+  sed -i "${line_start},${line_end} s/^_ACEOF/#pragma GCC push_options\r\n#pragma GCC optimize (\"-fomit-frame-pointer\")\r\nvoid __x86_return_thunk(){__asm__(\"ret\\\n\\\t\");}\r\nvoid __x86_indirect_thunk_rax(){__asm__(\"jmp \*%rax\\\n\\\t\");}\r\n#pragma GCC pop_options\r\n_ACEOF/" $srcdir/configure
+
+  line_end=`grep -n "\"checking whether we are cross compiling... \"" $srcdir/configure | cut -d: -f 1`
+  line_start=`expr $line_end - 30`  #Search an scope
+  sed -i "${line_start},${line_end} s/^_ACEOF/#pragma GCC push_options\r\n#pragma GCC optimize (\"-fomit-frame-pointer\")\r\nvoid __x86_return_thunk(){__asm__(\"ret\\\n\\\t\");}\r\nvoid __x86_indirect_thunk_rax(){__asm__(\"jmp \*%rax\\\n\\\t\");}\r\n#pragma GCC pop_options\r\n_ACEOF/" $srcdir/configure
+fi
+
 export CFLAGS
+
 $srcdir/configure $HOST_OPT --enable-shared=no \
    --disable-block-signals \
    --enable-debug=no       \


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org