Use one libc wrapper copy for sgx and other platforms (#107)
And remove bh_printf macro for other platform header files
This commit is contained in:
@ -414,7 +414,7 @@ sprintf_out(int c, struct str_context *ctx)
|
||||
static int
|
||||
printf_out(int c, struct str_context *ctx)
|
||||
{
|
||||
printf("%c", c);
|
||||
bh_printf("%c", c);
|
||||
ctx->count++;
|
||||
return c;
|
||||
}
|
||||
@ -542,13 +542,13 @@ _puts_wrapper(int32 str_offset)
|
||||
return 0;
|
||||
|
||||
str = addr_app_to_native(str_offset);
|
||||
return printf("%s\n", str);
|
||||
return bh_printf("%s\n", str);
|
||||
}
|
||||
|
||||
static int
|
||||
_putchar_wrapper(int c)
|
||||
{
|
||||
printf("%c", c);
|
||||
bh_printf("%c", c);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -699,7 +699,10 @@ _strcpy_wrapper(int32 dst_offset, int32 src_offset)
|
||||
|
||||
dst = addr_app_to_native(dst_offset);
|
||||
src = addr_app_to_native(src_offset);
|
||||
strcpy(dst, src);
|
||||
while (*src != '\0')
|
||||
*dst++ = *src++;
|
||||
*dst = '\0';
|
||||
|
||||
return dst_offset;
|
||||
}
|
||||
|
||||
@ -842,7 +845,7 @@ static void
|
||||
_llvm_stackrestore_wrapper(uint32 llvm_stack)
|
||||
{
|
||||
wasm_module_inst_t module_inst = get_module_inst();
|
||||
printf("_llvm_stackrestore called!\n");
|
||||
bh_printf("_llvm_stackrestore called!\n");
|
||||
wasm_runtime_set_llvm_stack(module_inst, llvm_stack);
|
||||
}
|
||||
|
||||
@ -850,7 +853,7 @@ static uint32
|
||||
_llvm_stacksave_wrapper()
|
||||
{
|
||||
wasm_module_inst_t module_inst = get_module_inst();
|
||||
printf("_llvm_stacksave called!\n");
|
||||
bh_printf("_llvm_stacksave called!\n");
|
||||
return wasm_runtime_get_llvm_stack(module_inst);
|
||||
}
|
||||
|
||||
@ -905,13 +908,13 @@ nullFunc_X_wrapper(int32 code)
|
||||
static void
|
||||
print_i32_wrapper(int i32)
|
||||
{
|
||||
printf("%d\n", i32);
|
||||
bh_printf("%d\n", i32);
|
||||
}
|
||||
|
||||
static void
|
||||
print_wrapper(int i32)
|
||||
{
|
||||
printf("%d\n", i32);
|
||||
bh_printf("%d\n", i32);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,7 @@ set (WASM_LIBC_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
include_directories(${WASM_LIBC_DIR})
|
||||
|
||||
|
||||
file (GLOB_RECURSE source_all ${WASM_LIBC_DIR}/libc_wrapper.c)
|
||||
file (GLOB_RECURSE source_all ${WASM_LIBC_DIR}/*.c)
|
||||
|
||||
set (WASM_LIBC_SOURCE ${source_all})
|
||||
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set (WASM_LIBC_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
include_directories(${WASM_LIBC_DIR})
|
||||
|
||||
|
||||
file (GLOB_RECURSE source_all ${WASM_LIBC_DIR}/libc_wrapper_sgx.c)
|
||||
|
||||
set (WASM_LIBC_SOURCE ${source_all})
|
||||
|
||||
Reference in New Issue
Block a user