diff options
author | Ayke van Laethem <[email protected]> | 2022-10-12 22:05:38 +0000 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-10-19 22:23:19 +0200 |
commit | 0ddcf4af96a9bf89d27678531c8215981f90807d (patch) | |
tree | 0e122ea614364177d18892abbe79b9b991c65820 /builder/library.go | |
parent | d435fc868b9caef76b7a9b30a9c33adc3a79cab4 (diff) | |
download | tinygo-0ddcf4af96a9bf89d27678531c8215981f90807d.tar.gz tinygo-0ddcf4af96a9bf89d27678531c8215981f90807d.zip |
riscv: add "target-abi" metadata flag
This flag is necessary in LLVM 15 because it appears that LLVM 15 has
changed the default target ABI from lp64 to lp64d. This results in a
linker failure. Setting the "target-abi" forces the RISC-V backend to
use the intended target ABI.
Diffstat (limited to 'builder/library.go')
-rw-r--r-- | builder/library.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/builder/library.go b/builder/library.go index 06b57632f..23d938823 100644 --- a/builder/library.go +++ b/builder/library.go @@ -155,6 +155,9 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ args = append(args, "-mcpu="+cpu) } } + if config.ABI() != "" { + args = append(args, "-mabi="+config.ABI()) + } if strings.HasPrefix(target, "arm") || strings.HasPrefix(target, "thumb") { if strings.Split(target, "-")[2] == "linux" { args = append(args, "-fno-unwind-tables", "-fno-asynchronous-unwind-tables") @@ -170,10 +173,10 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ args = append(args, "-mdouble=64") } if strings.HasPrefix(target, "riscv32-") { - args = append(args, "-march=rv32imac", "-mabi=ilp32", "-fforce-enable-int128") + args = append(args, "-march=rv32imac", "-fforce-enable-int128") } if strings.HasPrefix(target, "riscv64-") { - args = append(args, "-march=rv64gc", "-mabi=lp64") + args = append(args, "-march=rv64gc") } if strings.HasPrefix(target, "xtensa") { // Hack to work around an issue in the Xtensa port: |