• David Crawshaw's avatar
    cmd/link, runtime: put hasmain bit in moduledata · c58b98b2
    David Crawshaw authored
    Currently we look to see if the main.main symbol address is in the
    module data text range. This requires access to the main.main
    symbol, which usually the runtime has, but does not when building
    a plugin.
    
    To avoid a dynamic relocation to main.main (which I haven't worked
    out how to have the linker generate on darwin), stop using the
    symbol. Instead record a boolean in the moduledata if the module
    has the main function.
    
    Fixes #22175
    
    Change-Id: If313a118f17ab499d0a760bbc2519771ed654530
    Reviewed-on: https://go-review.googlesource.com/69370
    Run-TryBot: David Crawshaw <crawshaw@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    c58b98b2
main.go 510 Bytes