Hi, Thanks for your reply. I'm trying to extract the LLVM bitcode from Go code for analysis. I did build from the tip of both LLVM and gollvm. I believe it is LLVM 13 on github. It produced good working binaries. However, the *.ll files produced by -emit-llvm by gollvm gives syntax error when read by the 13git version, so I tried LLVM11 and *.ll files work well with LLVM11. -emit-llvm can also output *.bc bitcode files. The *.bc files are, however, readable by 13git but not 11 version. But I'm not sure this is exactly the problem, maybe I tweaked some parameters and got all the build messed up and got confused myself.
Khanh On Tuesday, April 13, 2021 at 12:06:15 AM UTC+8 th...@google.com wrote: > Hi, > > At the moment gollvm does not put out releases per se, meaning that really > the only thing that is advertised as working is the current LLVM tip plus > the current gollvm tip at a given moment in time. > > If you wanted to create a version of gollvm for an older LLVM release (ex: > LLVM 10), you would need to look at the date that LLVM was released, then > for each of the sub-repos (gollvm itself, <gollvm>/libgo/libbacktrace, > <gollvm>/libgo/libffi, <gollvm>/gofrontend) you'd need to locate a git > commit close to that date. Or something to this effect. > > Can you tell me a bit more about your use case? Why not just use the most > recent version of gollvm (e.g. tip)? > > Thanks, Than > > > On Mon, Apr 12, 2021 at 11:51 AM Khanh TN <tnkh...@gmail.com> wrote: > >> Hi Than, >> I'm trying to build gollvm with different versions of llvm: LLVM8, 10, 11 >> and 13git. It looks like only 13git works. >> -emit-llvm has some issues. The produced *.ll and *.bc LLVM bitcode can >> only be opened with some of LLVM versions, and which version is quite >> random to me. >> Is there a manual on which version of LLVM should I build gollvm with and >> which version is the bitcode that -emit-llvm produces? >> Thanks, >> Khanh >> >> On Thursday, April 8, 2021 at 10:55:16 PM UTC+8 Khanh TN wrote: >> >>> Thanks. Looks like I need everything, including llc at LLVM11. I will >>> stick with LLVM11. >>> I assume gollvm will match with whatever LLVM version is current, like, >>> update to match LLVM12 when LLVM12 is out? >>> >>> Khanh >>> On Thursday, April 8, 2021 at 10:40:19 PM UTC+8 th...@google.com wrote: >>> >>>> >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 <tnkh...@gmail.com> 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 th...@google.com 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 <tnkh...@gmail.com> 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 golang-nuts...@googlegroups.com. >>>>>>> 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 golang-nuts...@googlegroups.com. >>>>> >>>> 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 golang-nuts...@googlegroups.com. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/b66a0650-7afe-411e-b119-28ba63b9f24cn%40googlegroups.com >> >> <https://groups.google.com/d/msgid/golang-nuts/b66a0650-7afe-411e-b119-28ba63b9f24cn%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 golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/cf8a0e03-fa5b-4414-b569-37e8489be00an%40googlegroups.com.