In the linker (both oldlink and the new linker), there's this code that detects whether enough reflect is being used to go into conservative exported method retention mode:
https://github.com/golang/go/blob/8cc515ad3fe9f7f45470713ff1cd4faf323aef6a/src/cmd/link/internal/ld/deadcode2.go#L222
callSym := ldr.Lookup("reflect.Value.Call", sym.SymVerABIInternal)
methSym := ldr.Lookup("reflect.Value.Method", sym.SymVerABIInternal)
...
d.reflectSeen = d.reflectSeen || (callSym != 0 && ldr.AttrReachable(callSym)) || (methSym != 0 && ldr.AttrReachable(methSym))
But I'm concerned that it's missing "reflect.Value.CallSlice". (Value.MethodByName calls Value.Method, but Call and CallSlice both call relect.Value.call, not each other)
Despite feeling uneasy about that, I've been unable to write a program that only calls reflect.Value.CallSlice without hitting the "d.reflectSeen" trigger (set by d.ldr.IsReflectMethod).
What am I missing? Or is there a bug here and I'm not clever enough with reflect to trigger it? (I've tried a number of things short of using unsafe, at which point crashes aren't interesting)
- Brad