Re: [go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-09 Thread Yonatan Gizachew
Also, is there a way to print the values of runtime.g? On Thursday, September 10, 2020 at 12:15:04 PM UTC+9 Ian Lance Taylor wrote: > On Wed, Sep 9, 2020 at 7:39 PM Yonatan Gizachew wrote: > > > > This might be trivial, but could you explain me the relationship between > the following? > > 1. v

Re: [go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-09 Thread Yonatan Gizachew
Thank you for the explanation. For example, please have a look at the this bt. __tls_get_addr is called after runtime.getg. So, what does __tls_get_addr return at this time, a pointer to runtime.g or runtime.g itself? On Thur

Re: [go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-09 Thread Ian Lance Taylor
On Wed, Sep 9, 2020 at 7:39 PM Yonatan Gizachew wrote: > > This might be trivial, but could you explain me the relationship between the > following? > 1. value returned by __tls_get_addr This is the address of the TLS control block. The exact definition depends on the architecture. All TLS var

Re: [go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-09 Thread Yonatan Gizachew
This might be trivial, but could you explain me the relationship between the following? 1. value returned by __tls_get_addr 2. runtime.g 3. runtime.g0 4. runtime.mo 5. runtime.m Thanks:) On Thursday, September 10, 2020 at 11:31:21 AM UTC+9 Ian Lance Taylor wrote: > On Wed, Sep 9, 2020 at 7:26 P

Re: [go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-09 Thread Yonatan Gizachew
I see. Thanks for the explanation. It basically use function interposition to redirect Pthreads function calls made from golang to Pth. In that case a thread runs until it reaches a pth yield instruction, which transfers control to the scheduler and activates another available thread. On Thurs

Re: [go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-09 Thread Ian Lance Taylor
On Wed, Sep 9, 2020 at 7:26 PM Yonatan Gizachew wrote: > > Is there any known problems that could appear when we run golang C-shared > libraries in an OS that uses a non-preemptive scheduling mechanism. I am > experiencing some problems related to TLS (more specifically runtime.m0 and > runtime

[go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-09 Thread Yonatan Gizachew
Is there any known problems that could appear when we run golang C-shared libraries in an OS that uses a non-preemptive scheduling mechanism. I am experiencing some problems related to TLS (more specifically runtime.m0 and runtime.g0). FYI - the C-shared library was built suing the gccgo compil

[go-nuts] Go 1.15.2 and Go 1.14.9 are released

2020-09-09 Thread Dmitri Shuralyov
Hello gophers, We have just released Go versions 1.15.2 and 1.14.9, minor point releases. View the release notes for more information: https://golang.org/doc/devel/release.html#go1.15.minor You can download binary and source distributions from the Go web site: https://golang.org/dl/ To

Re: [go-nuts] linux/arm struct alignment seems wrong

2020-09-09 Thread Jan Mercl
On Wed, Sep 9, 2020 at 8:17 PM Ian Lance Taylor wrote: > Exact alignment/offset compatibility with the C ABI is not a goal. > Sorry. (It's actually harder than one might think to maintain that > kind of compatibility. For example, on x86, the C ABI uses one > alignment for double variables and

Re: [go-nuts] linux/arm struct alignment seems wrong

2020-09-09 Thread Ian Lance Taylor
On Wed, Sep 9, 2020 at 4:59 AM Jan Mercl <0xj...@gmail.com> wrote: > > If the intent is to have Go alignments/offsets of types compatible > with the C ABI then I think it's safe to say this is a bug. > > And the existence of the syscall package, in some cases passing > Go-defined structs to the ker

Re: [go-nuts] [ generics ] Added constraint type inference to the design draft

2020-09-09 Thread Steven Blenkinsop
On Tue, Sep 8, 2020 at 9:25 PM Ian Lance Taylor wrote: > > I think that it's really crucial for type inference rules to be as simple > and clear as possible. There must never be any confusion as to what an > inferred type might be. In complicated cases, it's fine to explicitly list > the type a

Re: [go-nuts] Is there any lib like CMSSignedData in GOLANG?

2020-09-09 Thread Somporn pongpan
Can you share the code or any info for decryption with pkcs7? On Wednesday, June 8, 2016 at 7:51:40 AM UTC+7 18126...@163.com wrote: > It's great. > > In fact , I have found some code using pkcs7 to decode, and it works very > well now. > > Thank you very much. > > 在 2016年6月8日星期三 UTC+8上午1:59:1

[go-nuts] "go run" vs. "go install" and $GOPATH

2020-09-09 Thread Andrew Stewart
Hi, On my system "go run" creates ~/go and places pkg there, even though $GOPATH is set. Whereas "go install" places pkg under $GOPATH. Ideally, I would like ~/go to never be created. $ ls ~/go ls: /Users/foo/go: No such file or directory $ echo $GOPATH /Users/foo/Google Drive/programming/gola

Re: [go-nuts] linux/arm struct alignment seems wrong

2020-09-09 Thread Jan Mercl
On Wed, Sep 9, 2020 at 1:45 PM 'Dan Kortschak' via golang-nuts wrote: > I think it comes down to these lines in src/cmd/internal/sys/arch.go > [1] > > ``` > var ArchARM = &Arch{ > Name: "arm", > Family:ARM, > ByteOrder: binary.LittleEndian, > PtrSize: 4,

Re: [go-nuts] linux/arm struct alignment seems wrong

2020-09-09 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2020-09-09 at 13:21 +0200, Jan Mercl wrote: > > > On Wed, Sep 9, 2020 at 1:09 PM 'Dan Kortschak' via golang-nuts < > golang-nuts@googlegroups.com> wrote: > > > What does cgo -godefs give you? On my amd64 and arm64 I get this: > > > > ``` > > ~/cznic $ cat main.go > > package main > > > >

Re: [go-nuts] linux/arm struct alignment seems wrong

2020-09-09 Thread Jan Mercl
On Wed, Sep 9, 2020 at 1:09 PM 'Dan Kortschak' via golang-nuts < golang-nuts@googlegroups.com> wrote: > What does cgo -godefs give you? On my amd64 and arm64 I get this: > > ``` > ~/cznic $ cat main.go > package main > > /* > struct s { > long long i; > } x; > */ > import "C" > > type S st

Re: [go-nuts] linux/arm struct alignment seems wrong

2020-09-09 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2020-09-09 at 12:50 +0200, Jan Mercl wrote: > On Wed, Sep 9, 2020 at 12:41 PM Dan Kortschak > wrote: > > > I get the following > > > > ``` > > C alignof struct s: 8 > > Go alignof struct s: 8 > > Go alignofS: 8 > > ~/cznic $ go version > > go version go1.15.1 linux/arm64 > > ~/c

Re: [go-nuts] linux/arm struct alignment seems wrong

2020-09-09 Thread Jan Mercl
On Wed, Sep 9, 2020 at 12:41 PM Dan Kortschak wrote: > I get the following > > ``` > C alignof struct s: 8 > Go alignof struct s: 8 > Go alignofS: 8 > ~/cznic $ go version > go version go1.15.1 linux/arm64 > ~/cznic $ uname -a > Linux bildr 4.19.0-10-arm64 #1 SMP Debian 4.19.132-1 (2020-

Re: [go-nuts] linux/arm struct alignment seems wrong

2020-09-09 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2020-09-09 at 12:19 +0200, Jan Mercl wrote: > Observation: > > pi@raspberrypi:~/src/tmp.tmp $ go version > go version go1.15.1 linux/arm > pi@raspberrypi:~/src/tmp.tmp $ cat main.go > package main > > /* > > struct s { > long long i; > } x; > > size_t align() { > return

[go-nuts] linux/arm struct alignment seems wrong

2020-09-09 Thread Jan Mercl
Observation: pi@raspberrypi:~/src/tmp.tmp $ go version go version go1.15.1 linux/arm pi@raspberrypi:~/src/tmp.tmp $ cat main.go package main /* struct s { long long i; } x; size_t align() { return _Alignof(struct s); } */ import "C" import ( "fmt" "unsafe" ) t