• Russ Cox's avatar
    ld: weak symbols · d94bf762
    Russ Cox authored
    A reference to the address of weak.foo resolves at link time
    to the address of the symbol foo if foo would end up in the
    binary anyway, or to zero if foo would not be in the binary.
    
    For example:
    
            int xxx = 1;
            int yyy = 2;
            int weak·xxx;
            int weak·yyy;
    
            void main·main(void) {
                    runtime·printf("%p %p %p\n", &xxx, &weak·xxx, &weak·yyy);
            }
    
    prints the same non-nil address twice, then 0 (because yyy is not
    referenced so it was dropped from the binary).
    
    This will be used by the reflection tables.
    
    R=iant
    CC=golang-dev
    https://golang.org/cl/4223044
    d94bf762
lib.h 6.44 KB