On Mon, Apr 4, 2022 at 5:16 PM arthurwil...@gmail.com <arthurwilliammor...@gmail.com> wrote: > > > > On Monday, April 4, 2022 at 7:00:49 PM UTC-5 arthurwil...@gmail.com wrote: >> >> On Monday, April 4, 2022 at 6:14:30 PM UTC-5 Ian Lance Taylor wrote: >>> >>> On Mon, Apr 4, 2022 at 3:49 PM arthurwil...@gmail.com >>> <arthurwil...@gmail.com> wrote: >>> > >>> > >>> > >>> > On Sunday, April 3, 2022 at 10:35:04 PM UTC-5 Ian Lance Taylor wrote: >>> >> >>> >> On Sun, Apr 3, 2022 at 6:21 PM arthurwil...@gmail.com >>> >> <arthurwil...@gmail.com> wrote: >>> >> > >>> >> > I'm trying to build an unoptimized version of the standard library for >>> >> > debugging. >>> >> >>> >> You can just use >>> >> >>> >> go build -gcflags=all="-N -l" >>> >> >>> > >>> > That gives this error: >>> > /Volumes/git/goroot/src (master)$ go build -gcflags=all="-N -l" >>> > no Go files in /Volumes/git/goroot/src >>> >>> You have to run this wherever you are building your actual Go program. >>> >>> What I mean is, if you want to "go build x.go" and you want to build >>> that with a standard library built for maximal debugging, then rn "go >>> build -gcflags=all="-N -l" x.go". Any flags specified by >>> -gcflags=all="FLAGS" will be used to build the standard library as >>> well. You don't need to build the standard library separately. >>> >>> Ian >> >> >> Thanks Ian. I cleaned the cache and mod cache and passed -x to see all the >> commands run and noticed go build is not propagating the -N -l flags to the >> compiler for a lot of the files. >> >> Also noticed some extra compiler flags (-std, -+) that are not listed in the >> compile command documentation >> >> What do these -std and -+ compiler flags do? >> >> Why are some compilation commands missing -N -l? >> >> > > I found some clues: > > CompilingRuntime bool "flag:\"+\" help:\"compiling runtime\"" > > and: > > if Flag.CompilingRuntime && Flag.N != 0 { > log.Fatal("cannot disable optimizations while compiling runtime") > }
Yeah. The -std flag is passed when compiling packages in the standard library. Certain undocumented compiler pragmas are only permitted for standard library code. Ian -- 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/CAOyqgcWMo%3D9VLjpbA15sSE19BsdZBSv%2BmytaNyTQUPCndyJAaQ%40mail.gmail.com.