Browse Source

riscv: add support for compiler-rt

This gets all the tests to compile and many of them to pass. There are
some issues left, but those are probably unrelated to compiler-rt.
pull/781/head
Ayke van Laethem 5 years ago
committed by Ron Evans
parent
commit
ad022ef23d
  1. 6
      builder/builtins.go
  2. 1
      targets/riscv.json

6
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 // Note: -fdebug-prefix-map is necessary to make the output archive
// reproducible. Otherwise the temporary directory is stored in the // reproducible. Otherwise the temporary directory is stored in the
// archive itself, which varies each run. // 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 { if err != nil {
return &commandError{"failed to build", srcpath, err} return &commandError{"failed to build", srcpath, err}
} }

1
targets/riscv.json

@ -6,6 +6,7 @@
"gc": "conservative", "gc": "conservative",
"compiler": "clang", "compiler": "clang",
"linker": "ld.lld", "linker": "ld.lld",
"rtlib": "compiler-rt",
"cflags": [ "cflags": [
"--target=riscv32--none", "--target=riscv32--none",
"-march=rv32imac", "-march=rv32imac",

Loading…
Cancel
Save