[uTVM] fix crt building and running error #6231
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
include\tvm\runtime\crt\module.h function TVMSystemLibEntryPoint: need extern "C", or else linker complain this symbol can't be found.
src\target\source\codegen_c_host.cc function GenerateFuncRegistry: f need cast, or else C++ compiler say type not match
L291 array _tvm_func_array miss "};", so build fail
system_lib_registry and system_lib name need use new name in PR [µTVM] Add --runtime=c, remove micro_dev target, enable LLVM backend #6145
src\support\str_escape.h function StrEscape: convert to octal need 3bit, but unsigned char c should use LSB 3bit, but only use LSB 2bit, because mask macro is 0x03, it should be 0x07.
'0' + ((c >> 6) & 0x03) need cast to unsigned char, because ostringstream treat it as int, not unsigned char, so value is error. ex. c = 0x17, means we have 23 functions to register, so ((c >> 6) & 0x03) == 0, and '0' + ((c >> 6) & 0x03) is the int value of '0', which is 48, but ostringstream treat it as int, so we get a string "485055", in fact it should be "027"