I’m trying to compile test model for mips and mips64. I use the following parameters for the compilation:
target = 'llvm -mtriple=mips-linux-gnu'
lib.export_library(path_lib, cc="mips-linux-gnu-g++")
LLVM compilation step (relay.build
) works fine. But export_library
fails with error
mips-linux-gnu/bin/ld: /tmp/tmptd3u21a0/lib.o: CALL16 reloc at 0x290 not against global symbol
Looks like it is a mips “feature” related to inline assembly. For some reason inline assembly should start with .globl <func_name>
.
Example:
void f_asm(void);
__asm__(
".globl f_asm\n" // it fixes - CALL16 reloc at 0x28 not against global symbol
"f_asm:\n"
"jr $ra\n"
"nop\n"
);
int main(void) {
f_asm();
return 0;
}
mips-linux-gnu-gcc test.c
Where in TVM we can add .globl <func_name>
to fix export_library issue for MIPS?