From 75c16b61266043673223fdfed30c543e353d4b6c Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 24 Jul 2022 14:07:41 +0200 Subject: [PATCH] llvm: support for getting the llvm rtl (rt) architecture name This is the name used as part of the llvm rt libraries, like asan (address sanitizer) --- compiler/arm/tripletcpu.pas | 9 +++++++++ compiler/globtype.pas | 5 ++++- compiler/i386/tripletcpu.pas | 9 ++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/compiler/arm/tripletcpu.pas b/compiler/arm/tripletcpu.pas index 3eb98efae1..da1f1a4e21 100644 --- a/compiler/arm/tripletcpu.pas +++ b/compiler/arm/tripletcpu.pas @@ -37,6 +37,15 @@ uses function tripletcpustr(tripletstyle: ttripletstyle): ansistring; begin + if tripletstyle=triplet_llvmrt then + begin + if (target_info.abi=abi_eabihf) and + not(target_info.system in systems_windows) then + result='armhf' + else + result:='arm'; + exit: + end; result:=lower(cputypestr[current_settings.cputype]); { llvm replaces the cpu name with thumb for when generating thumb code} if (tripletstyle=triplet_llvm) and diff --git a/compiler/globtype.pas b/compiler/globtype.pas index 2a45645c9a..cf2a7a4b53 100644 --- a/compiler/globtype.pas +++ b/compiler/globtype.pas @@ -379,7 +379,10 @@ interface { platform triplet style } ttripletstyle = ( - triplet_llvm + { llvm toolchain parameters } + triplet_llvm, + { llvm run time library file names } + triplet_llvmrt { , triple_gnu } ); diff --git a/compiler/i386/tripletcpu.pas b/compiler/i386/tripletcpu.pas index 4841e914b9..122d9e55ac 100644 --- a/compiler/i386/tripletcpu.pas +++ b/compiler/i386/tripletcpu.pas @@ -37,7 +37,14 @@ uses function tripletcpustr(tripletstyle: ttripletstyle): ansistring; begin - if (target_info.system in systems_darwin) or + if tripletstyle in [triplet_llvm,triplet_llvmrt] then + begin + if target_info.system in systems_android then + result:='i686' + else + result:='i386' + end + else if (target_info.system in systems_darwin) or (current_settings.cputype