536739d2da
Current Toolchain.defs set the compile flags directly, it's OK for target specified gcc toolchain. But some LLVM based toolchains (Rust/Zig etc) use single toolchain to handle all supported paltform. In this patch, arch level Toolchain.defs export standard LLVM style arch flags, and let <Lang>.defs to map them into internal style, This will simplify the intergration of non-c language. Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
70 lines
2.0 KiB
Plaintext
70 lines
2.0 KiB
Plaintext
############################################################################
|
|
# tools/Zig.defs
|
|
#
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
# this work for additional information regarding copyright ownership. The
|
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance with the
|
|
# License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
#
|
|
############################################################################
|
|
|
|
ZIG := zig
|
|
|
|
ifeq ($(CONFIG_ARCH_RISCV),y)
|
|
|
|
ZIGFLAGS := -target $(LLVM_ARCHTYPE)-freestanding-none
|
|
|
|
# Detect cpu ISA support flags for risc-v
|
|
|
|
ifeq ($(CONFIG_ARCH_RV_ISA_M),y)
|
|
ZARCHRVISAM := +m
|
|
endif
|
|
|
|
ifeq ($(CONFIG_ARCH_RV_ISA_A),y)
|
|
ZARCHRVISAA := +a
|
|
endif
|
|
|
|
ifeq ($(CONFIG_ARCH_RV_ISA_C),y)
|
|
ZARCHRVISAC := +c
|
|
endif
|
|
|
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
|
ZARCHRVISAF := +f
|
|
endif
|
|
|
|
ifeq ($(CONFIG_ARCH_DPFPU),y)
|
|
ZARCHRVISAD := +d
|
|
endif
|
|
|
|
ZIGFLAGS += -mcpu generic$(ZARCHRVISAM)$(ZARCHRVISAA)$(ZARCHRVISAF)$(ZARCHRVISAD)$(ZARCHRVISAC)
|
|
ZIGFLAGS += -mcmodel=medium
|
|
|
|
else ifeq ($(CONFIG_ARCH_ARM),y)
|
|
|
|
ifeq ($(CONFIG_ARM_THUMB),y)
|
|
ZIGFLAGS := -target thumb-freestanding-$(LLVM_ABITYPE)
|
|
else
|
|
ZIGFLAGS := -target arm-freestanding-$(LLVM_ABITYPE)
|
|
endif
|
|
|
|
# Convert cortex-xxx to cortex_xxx for zig
|
|
ZIGFLAGS += -mcpu $(subst -,_,$(LLVM_CPUTYPE))
|
|
|
|
else ifeq ($(CONFIG_ARCH_SIM),y)
|
|
ifeq ($(CONFIG_SIM_M32),y)
|
|
ZIGFLAGS := -target x86-freestanding-gnu
|
|
else
|
|
ZIGFLAGS := -target x86_64-freestanding-gnu
|
|
endif
|
|
endif
|