goretk / libgore Goto Github PK
View Code? Open in Web Editor NEWLibgore
Home Page: https://go-re.tk
License: GNU Affero General Public License v3.0
Libgore
Home Page: https://go-re.tk
License: GNU Affero General Public License v3.0
Looks like a bug in CGO
#include <stdio.h>
#include "libgore.h"
int main()
{
int v;
char* fp = "/path/to/pygore/test/resources/golden";
printf("Open %s\n", fp);
v = open(fp);
printf("Return code %d\n", v);
return 0;
}
Compile on macOS with: gcc -o test test.c libgore.dylib
Function calls go_wait_runtime_init_done
:
libgore.dylib`open:
0x1001ced80 <+0>: pushq %rbp
0x1001ced81 <+1>: movq %rsp, %rbp
0x1001ced84 <+4>: pushq %r14
0x1001ced86 <+6>: pushq %rbx
0x1001ced87 <+7>: subq $0x10, %rsp
0x1001ced8b <+11>: movq %rdi, %r14
0x1001ced8e <+14>: xorl %eax, %eax
-> 0x1001ced90 <+16>: callq 0x1001cf420 ; _cgo_wait_runtime_init_done
0x1001ced95 <+21>: movq %rax, %rbx
0x1001ced98 <+24>: movq %r14, -0x20(%rbp)
0x1001ced9c <+28>: leaq -0x4813(%rip), %rdi ; _cgoexp_c54285109ac3_goopen
0x1001ceda3 <+35>: leaq -0x20(%rbp), %rsi
0x1001ceda7 <+39>: movl $0x10, %edx
0x1001cedac <+44>: movq %rax, %rcx
0x1001cedaf <+47>: callq 0x1001c9c80 ; crosscall2
0x1001cedb4 <+52>: movq %rbx, %rdi
0x1001cedb7 <+55>: callq 0x1001cf0f0 ; _cgo_release_context
0x1001cedbc <+60>: movl -0x18(%rbp), %eax
0x1001cedbf <+63>: addq $0x10, %rsp
0x1001cedc3 <+67>: popq %rbx
0x1001cedc4 <+68>: popq %r14
0x1001cedc6 <+70>: popq %rbp
0x1001cedc7 <+71>: retq
0x1001cedc8 <+72>: nopl (%rax,%rax)
That hangs on pthread_cond_wait
libgore.dylib`_cgo_wait_runtime_init_done:
0x1001cf420 <+0>: pushq %rbp
0x1001cf421 <+1>: movq %rsp, %rbp
0x1001cf424 <+4>: pushq %r14
0x1001cf426 <+6>: pushq %rbx
0x1001cf427 <+7>: subq $0x10, %rsp
0x1001cf42b <+11>: leaq 0x15123e(%rip), %rdi ; runtime_init_mu
0x1001cf432 <+18>: callq 0x1001cf74a ; symbol stub for: pthread_mutex_lock
0x1001cf437 <+23>: cmpb $0x0, 0x16d5b2(%rip) ; runtime.trace + 65743
0x1001cf43e <+30>: jne 0x1001cf464 ; <+68>
0x1001cf440 <+32>: leaq 0x151269(%rip), %r14 ; runtime_init_cond
0x1001cf447 <+39>: leaq 0x151222(%rip), %rbx ; runtime_init_mu
0x1001cf44e <+46>: nop
0x1001cf450 <+48>: movq %r14, %rdi
0x1001cf453 <+51>: movq %rbx, %rsi
-> 0x1001cf456 <+54>: callq 0x1001cf732 ; symbol stub for: pthread_cond_wait
0x1001cf45b <+59>: cmpb $0x1, 0x16d58e(%rip) ; runtime.trace + 65743
0x1001cf462 <+66>: jne 0x1001cf450 ; <+48>
0x1001cf464 <+68>: movq 0x16d58d(%rip), %rbx ; cgo_context_function
0x1001cf46b <+75>: leaq 0x1511fe(%rip), %rdi ; runtime_init_mu
0x1001cf472 <+82>: callq 0x1001cf750 ; symbol stub for: pthread_mutex_unlock
0x1001cf477 <+87>: testq %rbx, %rbx
0x1001cf47a <+90>: je 0x1001cf490 ; <+112>
0x1001cf47c <+92>: movq $0x0, -0x18(%rbp)
0x1001cf484 <+100>: leaq -0x18(%rbp), %rdi
0x1001cf488 <+104>: callq *%rbx
0x1001cf48a <+106>: movq -0x18(%rbp), %rax
0x1001cf48e <+110>: jmp 0x1001cf492 ; <+114>
0x1001cf490 <+112>: xorl %eax, %eax
0x1001cf492 <+114>: addq $0x10, %rsp
0x1001cf496 <+118>: popq %rbx
0x1001cf497 <+119>: popq %r14
0x1001cf499 <+121>: popq %rbp
0x1001cf49a <+122>: retq
0x1001cf49b <+123>: nopl (%rax,%rax)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.