compiler: remove -runtime flag
It is not necessary anymore.
Этот коммит содержится в:
родитель
c763e9f1a6
коммит
09cbd223c3
2 изменённых файлов: 3 добавлений и 20 удалений
|
@ -3042,10 +3042,6 @@ func (c *Compiler) Verify() error {
|
||||||
return llvm.VerifyModule(c.mod, 0)
|
return llvm.VerifyModule(c.mod, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Compiler) LinkModule(mod llvm.Module) error {
|
|
||||||
return llvm.LinkModules(c.mod, mod)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Compiler) ApplyFunctionSections() {
|
func (c *Compiler) ApplyFunctionSections() {
|
||||||
// Put every function in a separate section. This makes it possible for the
|
// Put every function in a separate section. This makes it possible for the
|
||||||
// linker to remove dead code (-ffunction-sections).
|
// linker to remove dead code (-ffunction-sections).
|
||||||
|
|
19
main.go
19
main.go
|
@ -16,7 +16,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Helper function for Compiler object.
|
// Helper function for Compiler object.
|
||||||
func Compile(pkgName, runtimePath, outpath, target string, printIR, dumpSSA bool) error {
|
func Compile(pkgName, outpath, target string, printIR, dumpSSA bool) error {
|
||||||
spec, err := LoadTarget(target)
|
spec, err := LoadTarget(target)
|
||||||
|
|
||||||
c, err := NewCompiler(pkgName, spec.Triple, dumpSSA)
|
c, err := NewCompiler(pkgName, spec.Triple, dumpSSA)
|
||||||
|
@ -24,18 +24,6 @@ func Compile(pkgName, runtimePath, outpath, target string, printIR, dumpSSA bool
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add C/LLVM runtime.
|
|
||||||
if runtimePath != "" {
|
|
||||||
runtime, err := llvm.ParseBitcodeFile(runtimePath)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = c.LinkModule(runtime)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compile Go code to IR.
|
// Compile Go code to IR.
|
||||||
parseErr := func() error {
|
parseErr := func() error {
|
||||||
if printIR {
|
if printIR {
|
||||||
|
@ -169,7 +157,7 @@ func Run(pkgName string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func usage() {
|
func usage() {
|
||||||
fmt.Fprintf(os.Stderr, "usage: %s command [-printir] -runtime=<runtime.bc> [-target=<target>] -o <output> <input>\n", os.Args[0])
|
fmt.Fprintf(os.Stderr, "usage: %s command [-printir] [-target=<target>] -o <output> <input>\n", os.Args[0])
|
||||||
fmt.Fprintln(os.Stderr, "\ncommands:")
|
fmt.Fprintln(os.Stderr, "\ncommands:")
|
||||||
fmt.Fprintln(os.Stderr, " build: compile packages and dependencies")
|
fmt.Fprintln(os.Stderr, " build: compile packages and dependencies")
|
||||||
fmt.Fprintln(os.Stderr, " help: print this help text")
|
fmt.Fprintln(os.Stderr, " help: print this help text")
|
||||||
|
@ -182,7 +170,6 @@ func main() {
|
||||||
outpath := flag.String("o", "", "output filename")
|
outpath := flag.String("o", "", "output filename")
|
||||||
printIR := flag.Bool("printir", false, "print LLVM IR")
|
printIR := flag.Bool("printir", false, "print LLVM IR")
|
||||||
dumpSSA := flag.Bool("dumpssa", false, "dump internal Go SSA")
|
dumpSSA := flag.Bool("dumpssa", false, "dump internal Go SSA")
|
||||||
runtime := flag.String("runtime", "", "runtime LLVM bitcode files (from C sources)")
|
|
||||||
target := flag.String("target", llvm.DefaultTargetTriple(), "LLVM target")
|
target := flag.String("target", llvm.DefaultTargetTriple(), "LLVM target")
|
||||||
|
|
||||||
if len(os.Args) < 2 {
|
if len(os.Args) < 2 {
|
||||||
|
@ -208,7 +195,7 @@ func main() {
|
||||||
usage()
|
usage()
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
err := Compile(flag.Arg(0), *runtime, *outpath, *target, *printIR, *dumpSSA)
|
err := Compile(flag.Arg(0), *outpath, *target, *printIR, *dumpSSA)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "error:", err)
|
fmt.Fprintln(os.Stderr, "error:", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче