1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

don't write _start as is; use dlsym

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2014-03-26 00:02:24 +00:00
parent 3bd0fd118d
commit 537623e43d

View file

@ -640,9 +640,10 @@ rb_dump_backtrace_with_lines(int num_traces, void **traces, char **syms)
intptr_t main_fbase;
char *main_path;
{
extern void _start(void); /* a function in the main executalbe */
Dl_info info;
dladdr(_start, &info);
void *handle = dlopen(NULL, RTLD_LAZY);
void *sym = dlsym(handle, "_start");
dladdr(sym, &info);
main_fbase = (intptr_t)info.dli_fbase;
}
{