So, I figured out this inline asm ends with a "checksum" then ".text". I think I can remove inline asm before this ".text" and keep the rest since it might be useful. Please correct me if I'm wrong.
Thanks for your support! Khanh On Wednesday, September 15, 2021 at 11:59:25 AM UTC+8 Khanh TN wrote: > Hi, > Thanks, Than and Ian for your responses. > I would like to write an LLVM Pass to remove this export data. What is the > best way to do that? > > I am thinking module M.setModuleInlineAsm(""); > But that might remove other useful inline asm. > > Khanh > > On Tuesday, September 14, 2021 at 1:54:03 AM UTC+8 th...@google.com wrote: > >> I feel as though we're getting into the realm of "what is the sound of >> one hand clapping"... ? >> >> Than >> >> >> On Mon, Sep 13, 2021 at 1:51 PM Ian Lance Taylor <ia...@golang.org> >> wrote: >> >>> On Mon, Sep 13, 2021 at 6:03 AM Khanh TN <tnkh...@gmail.com> wrote: >>> > >>> > Also, from what I understand, if noone imports my package, I can also >>> remove the "module asm" lines at the start. Is that right? >>> >>> What is the use of a package that nobody imports? >>> >>> Ian >>> >>> >>> > On Monday, September 13, 2021 at 9:18:20 AM UTC+8 Khanh TN wrote: >>> >> >>> >> Hi, >>> >> Thanks, Than, for the answer. >>> >> So, if the .go file I'm compiling is the one with "package main" >>> "func main()", I can remove the "module asm" lines without any consequences? >>> >> >>> >> Khanh >>> >> >>> >> On Friday, September 10, 2021 at 9:09:12 PM UTC+8 th...@google.com >>> wrote: >>> >>> >>> >>> Hi, >>> >>> >>> >>> The "module asm" at the start of your bitcode dump is actually the >>> export data for the package, so it plays a pretty crucial role. >>> >>> >>> >>> Deleting the export data from the "main" package may work in some >>> cases (since nobody imports main), but it will certainly cause problems if >>> you delete the export data from some other non-main package. >>> >>> >>> >>> Export data tends to be substantial because it is based on the >>> transitive closure of the imported packages (e.g. "fmt" imports "io", then >>> "io" imports "sync", then "sync" imports "runtime", and so on). >>> >>> >>> >>> On the other hand, Go export data is way smaller than the volume of >>> header information that would have to be consumed by a C++ compiler when >>> building your average C++ source file. >>> >>> >>> >>> Than >>> >>> >>> >>> On Thu, Sep 9, 2021 at 6:31 AM Khanh TN <tnkh...@gmail.com> wrote: >>> >>>> >>> >>>> A Helloworld written in C++ is around 75 lines in LLVM IR. >>> >>>> However, a Helloworld written in Golang compiled with gollvm is >>> around 900/1000 lines of .ll file. I produced the LLVM IR with instructions >>> from https://go.googlesource.com/gollvm/ >>> >>>> I'm using LLVM11, so, older compatible commit of gollvm, not sure >>> newer versions are different. >>> >>>> >>> >>>> How can I produce shorter/simplified LLVM IR? >>> >>>> Thanks! >>> >>>> >>> >>>> Cheers, >>> >>>> Khanh >>> >>>> >>> >>>> >>> >>>> P/S: >>> >>>> An LLVM IR file has a lot of module asm at the start, like: >>> >>>> module asm "\09.section \22.go_export\22,\22e\22,@progbits" >>> >>>> module asm "\09.ascii \22v3;\\n\22" >>> >>>> module asm "\09.ascii \22package \22" >>> >>>> module asm "\09.ascii \22main\22" >>> >>>> module asm "\09.ascii \22\\n\22" >>> >>>> module asm "\09.ascii \22pkgpath \22" >>> >>>> module asm "\09.ascii \22main\22" >>> >>>> >>> >>>> I figure I can delete all the module asm line and my program still >>> runs correctly (I only tested 2 times on simple programs). Is this a legit >>> optimization? >>> >>>> >>> >>>> -- >>> >>>> 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/8ee91024-b270-4d1e-99b9-dbcd3e25d4c4n%40googlegroups.com >>> . >>> > >>> > -- >>> > 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/abf02438-5740-46e1-8577-2e001b3960f7n%40googlegroups.com >>> . >>> >>> -- >>> 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/CAOyqgcV%2BMR2FBArbR6ZNgCgs1DbO_Hwccu%2BOD3SuvLLRm6%2Bqcg%40mail.gmail.com >>> . >>> >> -- 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/d8057237-ef57-4fdd-a5cc-a26fd2bf401cn%40googlegroups.com.