Commit 69907c4a by Ian Lance Taylor

runtime: recreate function called by cgo -gccgo

    
    When using cgo -gccgo calls to C.GoString, C.GoStringN, and C.GoBytes
    are turned into calls to __go_byte_array_to_string and
    __go_string_to_byte_array.  Those functions were removed when the string
    code was copied from Go 1.7, but we still need them for cgo.  While cgo
    should be updated, old versions will exist for some time.
    
    Reviewed-on: https://go-review.googlesource.com/32474

From-SVN: r241743
parent f94a3edc
90f12ac1fa72a95e73cb88b6114fa3131c4ca8ee
069ed35ecbefd2f138ea3132a557ad23a6936a45
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
......@@ -444,3 +444,20 @@ func gostringw(strw *uint16) string {
b[n2] = 0 // for luck
return s[:n2]
}
// These two functions are called by code generated by cgo -gccgo.
//go:linkname __go_byte_array_to_string __go_byte_array_to_string
func __go_byte_array_to_string(p unsafe.Pointer, l int) string {
if l == 0 {
return ""
}
s, c := rawstringtmp(nil, l)
memmove(unsafe.Pointer(&c[0]), p, uintptr(l))
return s
}
//go:linkname __go_string_to_byte_array __go_string_to_byte_array
func __go_string_to_byte_array(s string) []byte {
return stringtoslicebyte(nil, s)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment