On Wed, Oct 27, 2021 at 10:49 AM jlfo...@berkeley.edu < jlforr...@berkeley.edu> wrote:
> I've noticed that Go doesn't seem to support the intialized .data segment > that I used to find on Unix. Is this correct? I've tried using various Go > tools to find out but I'm not sure what I was seeing. > > If it isn't supported now, is this something planned for the future? > It's an implementation detail of the architecture. Why do you ask? But to answer your question, yes, Go does populate the data section of the executable. For example, the output of `otool -d` on a Go binary on macOS begins thusly: elvish: (__DATA,__data) section 00000000047d7ca0 00 00 00 00 00 00 00 00 b0 b1 40 04 00 00 00 00 00000000047d7cb0 d0 ad 40 04 00 00 00 00 e0 b0 40 04 00 00 00 00 00000000047d7cc0 10 b2 40 04 00 00 00 00 20 e2 50 04 00 00 00 00 00000000047d7cd0 80 e2 7d 04 00 00 00 00 c0 a0 7d 04 00 00 00 00 The output of `nm | grep ' [dD] '` of the same program on Linux shows plenty of information in the data section: 0000000000f2d280 D bufio..inittask 0000000000f32720 D bytes.asciiSpace 0000000000f2d2c0 D bytes..inittask 0000000000f1b020 D _cgo_callers -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- 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/CABx2%3DD-fxRnhk_-i7XOCAwwn7u1fyfFNVD4n5vnGq5gTUrbMwQ%40mail.gmail.com.