>It outputs a hello.ll file. LLVM11 can process it but 10.0.1 and 13git cannot >Would love to hear your feedback. Maybe I need the exact LLVM version that gollvm is targeting?
Yes, that is correct. The LLVM IR dump format (*.ll files) tends to change over time and from release to release, it isn't intended or designed to be stable. One way to insure that you have a conformant version of llc/lli (or equivalent) is just to build then in the same build directory where you built llvm. E.g. after "ninja gollvm" you can then try "ninja llc", then use the freshly built llc binary (found in ./bin) for your work. Thanks, Than On Thu, Apr 8, 2021 at 10:00 AM Khanh TN <[email protected]> wrote: > Hi, > Thanks for your reply. > It's a bit weird. > I tried LLVM10.0.1 and the LLVM13 built from github along with gollvm, > both did not work. > However, I just tried LLVM11 and it worked. I haven't tried LLVM12. It > looks like different LLVM version has different syntax? > > The Go code I tried is simplest: > I have 1 file hello.go: > > package main > import( > "fmt" > ) > > func main() { > fmt.Println("Hello, playground") > } > > As instructed in "How do I see the LLVM IR generated by gollvm?" on > https://go.googlesource.com/gollvm , I ran > > go build -work -x hello.go 1> transcript.txt 2>&1 > > egrep '(WORK=|llvm-goc -c)' transcript.txt > WORK=/tmp/go-build903363323 > [...] > > WORK=/tmp/go-build903363323 > >[..change output to -o hello.ll; add -S -emit-llvm] > > It outputs a hello.ll file. LLVM11 can process it but 10.0.1 and 13git > cannot > Would love to hear your feedback. Maybe I need the exact LLVM version that > gollvm is targeting? > > Khanh > On Thursday, April 8, 2021 at 7:07:13 PM UTC+8 [email protected] wrote: > >> Hi, >> >> Can you be a bit more specific, e.g. what Go code you compiler and what >> error you saw? It would also be helpful to know what version of lli/llc you >> were using. >> >> Thanks, Than >> >> >> On Thu, Apr 8, 2021 at 2:33 AM Khanh TN <[email protected]> wrote: >> >>> Hi, >>> I'm following this page https://go.googlesource.com/gollvm to compile >>> Go code the LLVM way. >>> I'm at the step "How do I see the LLVM IR generated by gollvm?" of the >>> page. I'm doing exactly as the instruction. Gollvm produces a .ll file but >>> the file has bad syntax. Running llvm-as (or llc, lli) on the generated .ll >>> file gives error (I think its syntax error) >>> Can anyone check this out? >>> >>> Thankss, >>> >>> Khanh >>> >>> -- >>> 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 [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/golang-nuts/e21d46ff-d151-46fc-ac1d-5da2a153a9fdn%40googlegroups.com >>> <https://groups.google.com/d/msgid/golang-nuts/e21d46ff-d151-46fc-ac1d-5da2a153a9fdn%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/6539ccc0-3a3f-4e40-a268-e45593fc29d1n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/6539ccc0-3a3f-4e40-a268-e45593fc29d1n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2BUr55Ex5N4o%3Dc7ft-K6RhiOsftdai-RrZ64ZVTwi-iu9HQanA%40mail.gmail.com.
