runtime: give proper messages when user defined DYLD_INSERT_LIBRARIES on Darwin
also gives clear error when bsdthread_register fails on Darwin
Fixes issue 2992.
If you want to trigger the error message. $ cat lib.c #include <stdio.h> int f() ...
14 years, 2 months ago
(2012-04-04 17:13:51 UTC)
#2
If you want to trigger the error message.
$ cat lib.c
#include <stdio.h>
int f() __attribute__((constructor));
int f() { fprintf(stderr, "hello from lib.so!\n"); }
$ gcc -o lib.so -dynamiclib -fno-common lib.c
$ DYLD_INSERT_LIBRARIES=lib.so DYLD_FORCE_FLAT_NAMESPACE=1 ./6.out
Can we just check for the environment variable instead? I try to avoid error messages ...
14 years, 2 months ago
(2012-04-04 17:24:55 UTC)
#3
Can we just check for the environment variable instead?
I try to avoid error messages that guess at what's wrong.
We can check the environment variable and refuse to even
call bsdthread_register.
On 2012/04/04 17:24:55, rsc wrote: > Can we just check for the environment variable instead? ...
14 years, 2 months ago
(2012-04-04 18:14:31 UTC)
#4
On 2012/04/04 17:24:55, rsc wrote:
> Can we just check for the environment variable instead?
At the time of runtime.osinit(), syscall.envs haven't been initialized.
You can try Patch Set 4, but the getenv test won't ever be true.
14 years, 2 months ago
(2012-04-05 15:20:19 UTC)
#5
http://codereview.appspot.com/5966067/diff/3006/src/pkg/runtime/thread_darwin.c
File src/pkg/runtime/thread_darwin.c (right):
http://codereview.appspot.com/5966067/diff/3006/src/pkg/runtime/thread_darwin...
src/pkg/runtime/thread_darwin.c:53: // Register our thread-creation callback
(see sys_darwin_{amd64,386}.s)
It's pretty ugly, but I still want to be able to give a precise error message.
Maybe move this code (including the register call) to the bottom of goenvs
instead?
Here, we can leave just:
// bsdthread_register delayed until end of goenvs so that we
// can look at the environment first.
You can't call goenvs here because it needs malloc.
On 2012/04/05 20:45:16, minux wrote: > PTAL. > > I've tested this on Mac OS ...
14 years, 2 months ago
(2012-04-09 18:36:43 UTC)
#7
On 2012/04/05 20:45:16, minux wrote:
> PTAL.
>
> I've tested this on Mac OS X 10.6.8 amd64 and 386, could you please help test
> this
> on Mac OS X 10.7?
Works for me on 10.7.
*** Submitted as http://code.google.com/p/go/source/detail?r=09fe7345e11d *** runtime: give proper messages when user defined DYLD_INSERT_LIBRARIES on Darwin ...
14 years, 1 month ago
(2012-04-30 19:55:30 UTC)
#11
Issue 5966067: code review 5966067: runtime: give proper messages when user defined DYLD_IN...
(Closed)
Created 14 years, 2 months ago by minux1
Modified 14 years, 1 month ago
Reviewers:
Base URL:
Comments: 2