Does it support using external package in gollvm?

71 views
Skip to first unread message

jw jiang

unread,
Nov 19, 2020, 8:57:27 AM11/19/20
to golang-nuts
i've read some papers said that he changed the go source file to llvm ir using llgo.
but i found that llgo is not maintained .


i follow its instruction steps and build the gollvm and llvm-goc successfully.

But something confuse me that is i can not import external package while using llvm-goc to dump llvm ir.

For example, i've tried dump the code below to llvm-ir,

===
package main

import (
    "fmt"
    "test/testg"
)

func add(x, y int) int {
    return x + y
}


func main() {
    var c = testg.Color{}
    a := 5000
    //b := 4
    fmt.Println(add(a, c.C))
}
===
But llvm-goc returns errors:

===
./main.go:5:15: error: import file 'test/testg' not found
./main.go:14:24: error: expected ';' or '}' or newline
./main.go:15:5: error: expected declaration
./main.go:17:5: error: expected declaration
./main.go:18:1: error: expected declaration
./main.go:14:13: error: reference to undefined name 'testg'
===

I wonder whether the llvm-goc can use external packages? Or is there anyway to dump llvm-ir from go source file ?

Than McIntosh

unread,
Nov 19, 2020, 9:11:39 AM11/19/20
to jw jiang, golang-nuts

Can you please post the exact commands you're using?

The recipe in https://go.googlesource.com/gollvm#seetheir is meant to give you an idea as to how to do this, but without seeing exactly what you typed it's hard to tell what the problem s.

Thanks.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/5ae30fb1-1461-4b40-bfb9-6845a40dd31an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages