You haven't said whether you followed the "safe" instructions for 
github.com/ugorji/go/codec to avoid building code/helper_unsafe.go, which 
uses go:linkname.

Package Documentation for github.com/ugorji/go/codec
https://github.com/ugorji/go/blob/master/codec/README.md

This package will carefully use 'package unsafe' for performance reasons in 
specific places. You can build without unsafe use by passing the safe or 
appengine tag i.e. 'go install -tags=codec.safe 

You can run the tag 'codec.safe' to run tests or build in safe mode. e.g.

    go test -tags codec.safe -run Json
    go test -tags "alltests codec.safe" -run Suite

Peter

On Monday, March 29, 2021 at 3:34:44 AM UTC-4 f011...@gmail.com wrote:

> >  go:linkname to refer directly to functions that are defined but not 
> exported by the standard library. 
> > This is not supported and is likely to break with any new release. It 
> evidently breaks with GoLLVM.
>
> Thanks for your attention, but I tried to write a demo with go:linkname.
> In fact, it works well with gollvm...So maybe it is not the exact cause 
> for the problem
>
> Herei is my code:
>
> hello/hello.go
> ```
> package hello
>
> import (
> "fmt"
> _ "unsafe"
> )
> //go:linkname hellox hello.hellox
> func hellox(x string) {
> fmt.Println(x)
> }
> ```
>
> main.go
> ```
> package main
>
> import (
> _ "mypackage/hello"
> _ "unsafe"
> )
>
> //go:linkname hel hello.hellox
> func hel(x string)
>
> func main() {
> hel("aaa")
> //println("aaaa")
> }
> ```
>
> 在2021年3月29日星期一 UTC+8 上午12:37:49<Ian Lance Taylor> 写道:
>
>> On Sun, Mar 28, 2021 at 9:28 AM 张嘉熙 <f011...@gmail.com> wrote: 
>> > 
>> > For s2-geojson, I meet: 
>> > ``` 
>> > # github.com/pantrif/s2-geojson/cmd/s2-geojson 
>> > 
>> /home/jx/.cache/go-build/6b/6bd003c99eb0a9e7c6ea6d372307b292ec615c75c28f9b1f696896ae2fb4272b-d(_go_.o):gomodule:function
>>  
>> github_0com_1ugorji_1go_1codec.intf2impls.intf2impl: error: undefined 
>> reference to 'reflect.unsafe_New' 
>> > 
>> /home/jx/.cache/go-build/6b/6bd003c99eb0a9e7c6ea6d372307b292ec615c75c28f9b1f696896ae2fb4272b-d(_go_.o):gomodule:function
>>  
>> github_0com_1ugorji_1go_1codec.Decoder.interfaceExtConvertAndDecode: error: 
>> undefined reference to 'reflect.unsafe_New' 
>> > decode.go:509: error: undefined reference to 'reflect.unsafe_New' 
>> > decode.go:14935: error: undefined reference to 'reflect.unsafe_New' 
>>
>> This is a problem with github.com/ugorji/go. The file 
>> code/helper_unsafe.go uses go:linkname to refer directly to functions 
>> that are defined but not exported by the standard library. This is 
>> not supported and is likely to break with any new release. It 
>> evidently breaks with GoLLVM. 
>>
>> Ian 
>>
>

-- 
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/f12e94e5-9968-48fb-9ce6-d9899a3796e2n%40googlegroups.com.

Reply via email to