mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-31 13:17:31 +00:00 
			
		
		
		
	Add eabihf ABI support and set vendor-sys of bare-metal targets (#2745)
Set the vendor-sys of bare-metal targets to "-unknown-none-", and currently only add "thumbxxx" to the bare-metal target list. Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
		
							parent
							
								
									625c95816d
								
							
						
					
					
						commit
						e4353b4e1f
					
				|  | @ -1915,6 +1915,7 @@ static ArchItem valid_archs[] = { | |||
| static const char *valid_abis[] = { | ||||
|     "gnu", | ||||
|     "eabi", | ||||
|     "eabihf", | ||||
|     "gnueabihf", | ||||
|     "msvc", | ||||
|     "ilp32", | ||||
|  | @ -1992,6 +1993,18 @@ get_target_arch_from_triple(const char *triple, char *arch_buf, uint32 buf_size) | |||
|     bh_assert(*triple == '-' || *triple == '\0'); | ||||
| } | ||||
| 
 | ||||
| static bool | ||||
| is_baremetal_target(const char *target, const char *cpu, const char *abi) | ||||
| { | ||||
|     /* TODO: support more baremetal targets */ | ||||
|     if (target) { | ||||
|         /* If target is thumbxxx, then it is baremetal target */ | ||||
|         if (!strncmp(target, "thumb", strlen("thumb"))) | ||||
|             return true; | ||||
|     } | ||||
|     return false; | ||||
| } | ||||
| 
 | ||||
| void | ||||
| aot_handle_llvm_errmsg(const char *string, LLVMErrorRef err) | ||||
| { | ||||
|  | @ -2214,7 +2227,7 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option) | |||
|     char *triple_norm_new = NULL, *cpu_new = NULL; | ||||
|     char *err = NULL, *fp_round = "round.tonearest", | ||||
|          *fp_exce = "fpexcept.strict"; | ||||
|     char triple_buf[32] = { 0 }, features_buf[128] = { 0 }; | ||||
|     char triple_buf[128] = { 0 }, features_buf[128] = { 0 }; | ||||
|     uint32 opt_level, size_level, i; | ||||
|     LLVMCodeModel code_model; | ||||
|     LLVMTargetDataRef target_data_ref; | ||||
|  | @ -2510,6 +2523,7 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option) | |||
|              * for Windows/MacOS under Linux host, or generating AOT file for | ||||
|              * Linux/MacOS under Windows host. | ||||
|              */ | ||||
| 
 | ||||
|             if (!strcmp(abi, "msvc")) { | ||||
|                 if (!strcmp(arch1, "i386")) | ||||
|                     vendor_sys = "-pc-win32-"; | ||||
|  | @ -2517,7 +2531,10 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option) | |||
|                     vendor_sys = "-pc-windows-"; | ||||
|             } | ||||
|             else { | ||||
|                 vendor_sys = "-pc-linux-"; | ||||
|                 if (is_baremetal_target(arch, cpu, abi)) | ||||
|                     vendor_sys = "-unknown-none-"; | ||||
|                 else | ||||
|                     vendor_sys = "-pc-linux-"; | ||||
|             } | ||||
| 
 | ||||
|             bh_assert(strlen(arch1) + strlen(vendor_sys) + strlen(abi) | ||||
|  | @ -2553,6 +2570,9 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option) | |||
|                 if (!abi) | ||||
|                     abi = "msvc"; | ||||
|             } | ||||
|             else if (is_baremetal_target(arch, cpu, abi)) { | ||||
|                 vendor_sys = "-unknown-none-"; | ||||
|             } | ||||
|             else { | ||||
|                 vendor_sys = "-pc-linux-"; | ||||
|                 if (!abi) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Huang Qi
						Huang Qi