targets: make compiler runtime selection more configurable
Этот коммит содержится в:
родитель
74b5e28a38
коммит
f02766265c
6 изменённых файлов: 7 добавлений и 7 удалений
4
main.go
4
main.go
|
@ -153,7 +153,7 @@ func Compile(pkgName, outpath string, spec *TargetSpec, config *BuildConfig, act
|
||||||
// Load builtins library from the cache, possibly compiling it on the
|
// Load builtins library from the cache, possibly compiling it on the
|
||||||
// fly.
|
// fly.
|
||||||
var cachePath string
|
var cachePath string
|
||||||
if spec.CompilerRT {
|
if spec.RTLib == "compiler-rt" {
|
||||||
librt, err := loadBuiltins(spec.Triple)
|
librt, err := loadBuiltins(spec.Triple)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -165,7 +165,7 @@ func Compile(pkgName, outpath string, spec *TargetSpec, config *BuildConfig, act
|
||||||
executable := filepath.Join(dir, "main")
|
executable := filepath.Join(dir, "main")
|
||||||
tmppath := executable // final file
|
tmppath := executable // final file
|
||||||
args := append(spec.PreLinkArgs, "-o", executable, objfile)
|
args := append(spec.PreLinkArgs, "-o", executable, objfile)
|
||||||
if spec.CompilerRT {
|
if spec.RTLib == "compiler-rt" {
|
||||||
args = append(args, "-L", cachePath, "-lrt-"+spec.Triple)
|
args = append(args, "-L", cachePath, "-lrt-"+spec.Triple)
|
||||||
}
|
}
|
||||||
cmd := exec.Command(spec.Linker, args...)
|
cmd := exec.Command(spec.Linker, args...)
|
||||||
|
|
|
@ -20,7 +20,7 @@ type TargetSpec struct {
|
||||||
Triple string `json:"llvm-target"`
|
Triple string `json:"llvm-target"`
|
||||||
BuildTags []string `json:"build-tags"`
|
BuildTags []string `json:"build-tags"`
|
||||||
Linker string `json:"linker"`
|
Linker string `json:"linker"`
|
||||||
CompilerRT bool `json:"compiler-rt"`
|
RTLib string `json:"rtlib"` // compiler runtime library (libgcc, compiler-rt)
|
||||||
PreLinkArgs []string `json:"pre-link-args"`
|
PreLinkArgs []string `json:"pre-link-args"`
|
||||||
Objcopy string `json:"objcopy"`
|
Objcopy string `json:"objcopy"`
|
||||||
Emulator []string `json:"emulator"`
|
Emulator []string `json:"emulator"`
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"llvm-target": "armv7m-none-eabi",
|
"llvm-target": "armv7m-none-eabi",
|
||||||
"build-tags": ["bluepill", "stm32f103xx", "stm32", "tinygo.arm", "js", "wasm"],
|
"build-tags": ["bluepill", "stm32f103xx", "stm32", "tinygo.arm", "js", "wasm"],
|
||||||
"linker": "arm-none-eabi-gcc",
|
"linker": "arm-none-eabi-gcc",
|
||||||
"compiler-rt": true,
|
"rtlib": "compiler-rt",
|
||||||
"pre-link-args": ["-nostdlib", "-nostartfiles", "-mcpu=cortex-m3", "-mthumb", "-T", "targets/stm32.ld", "-Wl,--gc-sections", "-fno-exceptions", "-fno-unwind-tables", "-ffunction-sections", "-fdata-sections", "-Os", "src/device/stm32/stm32f103xx.s"],
|
"pre-link-args": ["-nostdlib", "-nostartfiles", "-mcpu=cortex-m3", "-mthumb", "-T", "targets/stm32.ld", "-Wl,--gc-sections", "-fno-exceptions", "-fno-unwind-tables", "-ffunction-sections", "-fdata-sections", "-Os", "src/device/stm32/stm32f103xx.s"],
|
||||||
"objcopy": "arm-none-eabi-objcopy",
|
"objcopy": "arm-none-eabi-objcopy",
|
||||||
"flash": "openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c 'program {hex} reset exit'"
|
"flash": "openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c 'program {hex} reset exit'"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"llvm-target": "armv6m-none-eabi",
|
"llvm-target": "armv6m-none-eabi",
|
||||||
"build-tags": ["microbit", "nrf51822", "nrf51", "nrf", "tinygo.arm", "js", "wasm"],
|
"build-tags": ["microbit", "nrf51822", "nrf51", "nrf", "tinygo.arm", "js", "wasm"],
|
||||||
"linker": "arm-none-eabi-gcc",
|
"linker": "arm-none-eabi-gcc",
|
||||||
"compiler-rt": true,
|
"rtlib": "compiler-rt",
|
||||||
"pre-link-args": [
|
"pre-link-args": [
|
||||||
"-nostdlib",
|
"-nostdlib",
|
||||||
"-nostartfiles",
|
"-nostartfiles",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"llvm-target": "armv7em-none-eabi",
|
"llvm-target": "armv7em-none-eabi",
|
||||||
"build-tags": ["pca10040", "nrf52832", "nrf52", "nrf", "tinygo.arm", "js", "wasm"],
|
"build-tags": ["pca10040", "nrf52832", "nrf52", "nrf", "tinygo.arm", "js", "wasm"],
|
||||||
"linker": "arm-none-eabi-gcc",
|
"linker": "arm-none-eabi-gcc",
|
||||||
"compiler-rt": true,
|
"rtlib": "compiler-rt",
|
||||||
"pre-link-args": [
|
"pre-link-args": [
|
||||||
"-nostdlib",
|
"-nostdlib",
|
||||||
"-nostartfiles",
|
"-nostartfiles",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"llvm-target": "armv7m-none-eabi",
|
"llvm-target": "armv7m-none-eabi",
|
||||||
"build-tags": ["qemu", "lm3s6965", "tinygo.arm", "js", "wasm"],
|
"build-tags": ["qemu", "lm3s6965", "tinygo.arm", "js", "wasm"],
|
||||||
"linker": "arm-none-eabi-gcc",
|
"linker": "arm-none-eabi-gcc",
|
||||||
"compiler-rt": true,
|
"rtlib": "compiler-rt",
|
||||||
"pre-link-args": [
|
"pre-link-args": [
|
||||||
"-nostdlib",
|
"-nostdlib",
|
||||||
"-nostartfiles",
|
"-nostartfiles",
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче