diff --git a/builder/builtins.go b/builder/builtins.go index 0ccca434..8bd243e7 100644 --- a/builder/builtins.go +++ b/builder/builtins.go @@ -236,7 +236,11 @@ func CompileBuiltins(target string, callback func(path string) error) error { // Note: -fdebug-prefix-map is necessary to make the output archive // reproducible. Otherwise the temporary directory is stored in the // archive itself, which varies each run. - err := runCCompiler("clang", "-c", "-Oz", "-g", "-Werror", "-Wall", "-std=c11", "-fshort-enums", "-nostdlibinc", "-ffunction-sections", "-fdata-sections", "-Wno-macro-redefined", "--target="+target, "-fdebug-prefix-map="+dir+"="+remapDir, "-o", objpath, srcpath) + args := []string{"-c", "-Oz", "-g", "-Werror", "-Wall", "-std=c11", "-fshort-enums", "-nostdlibinc", "-ffunction-sections", "-fdata-sections", "-Wno-macro-redefined", "--target=" + target, "-fdebug-prefix-map=" + dir + "=" + remapDir} + if strings.HasPrefix(target, "riscv32-") { + args = append(args, "-march=rv32imac", "-mabi=ilp32", "-fforce-enable-int128") + } + err := runCCompiler("clang", append(args, "-o", objpath, srcpath)...) if err != nil { return &commandError{"failed to build", srcpath, err} } diff --git a/targets/riscv.json b/targets/riscv.json index e33084ac..f9635400 100644 --- a/targets/riscv.json +++ b/targets/riscv.json @@ -6,6 +6,7 @@ "gc": "conservative", "compiler": "clang", "linker": "ld.lld", + "rtlib": "compiler-rt", "cflags": [ "--target=riscv32--none", "-march=rv32imac",