[vdso] fix the arch/abi flag issue.

This commit is contained in:
bernard 2025-06-25 23:33:22 +08:00 committed by Rbb666
parent a5359b7223
commit cb1a58cf37
1 changed files with 6 additions and 5 deletions

View File

@ -18,10 +18,11 @@ def get_riscv64_default_arch_abi(gcc_bin):
arch = None arch = None
abi = None abi = None
for line in result.splitlines(): for line in result.splitlines():
if '-march=' in line and '[default]' in line: if '-march=' in line:
arch = line.strip().split()[0] arch = line.strip().split()[1]
if '-mabi=' in line and '[default]' in line: arch = arch.split('_')[0] # Get the base architecture, e.g., rv64imafdc
abi = line.strip().split()[0] if '-mabi=' in line and 'option' not in line:
abi = line.strip().split()[1]
return arch, abi return arch, abi
except Exception as e: except Exception as e:
print("Error getting arch/abi:", e) print("Error getting arch/abi:", e)
@ -31,7 +32,7 @@ def get_riscv64_default_arch_abi(gcc_bin):
CC_BIN = PREFIX + 'gcc' CC_BIN = PREFIX + 'gcc'
arch, abi = get_riscv64_default_arch_abi(CC_BIN) arch, abi = get_riscv64_default_arch_abi(CC_BIN)
if arch and abi: if arch and abi:
DEVICE = f' {arch} {abi} ' DEVICE = f' -march={arch} -mabi={abi} '
else: else:
DEVICE = ' -march=rv64imafdc -mabi=lp64' # fallback DEVICE = ' -march=rv64imafdc -mabi=lp64' # fallback