在同一过程中同时加载musl libc.so和gcc libc.so? [英] Load both musl libc.so and gcc libc.so in the same process?

查看:319
本文介绍了在同一过程中同时加载musl libc.so和gcc libc.so?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用musl libc编译的共享库

I have a shared library compiled with musl libc

$ readelf -d ./libinterop_d.so 

Dynamic section at offset 0x8ecb0 contains 22 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libc.so]
 0x000000000000000f (RPATH)              Library rpath: [/usr/local/musl/lib]
 0x000000000000000c (INIT)               0x46350
 0x000000000000000d (FINI)               0x7664a
 0x0000000000000019 (INIT_ARRAY)         0x28e700
 0x000000000000001b (INIT_ARRAYSZ)       64 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x28e740
 0x000000000000001c (FINI_ARRAYSZ)       16 (bytes)
 0x0000000000000004 (HASH)               0x158
 0x0000000000000005 (STRTAB)             0xc940
 0x0000000000000006 (SYMTAB)             0x2bc0
 0x000000000000000a (STRSZ)              203286 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x28f000
 0x0000000000000002 (PLTRELSZ)           28056 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x3f5b8
 0x0000000000000007 (RELA)               0x3e358
 0x0000000000000008 (RELASZ)             4704 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffff9 (RELACOUNT)          46
 0x0000000000000000 (NULL)               0x0

它链接到musl的libc.so

It links to musl's libc.so

$ ldd ./libinterop_d.so 
    linux-vdso.so.1 =>  (0x00007fff566c9000)
    libc.so => /usr/local/musl/lib/libc.so (0x00007f111398c000)

现在我有加载问题将此共享对象转换为Java应用程序。
但是如果我恢复到GNU libc.so 的链接,它就可以工作。

Now I have problem to load this shared object into java application. But if I restore the linking back to GNU's libc.so, it works.

是吗可能在同一过程中同时包含GNU和musl libc.so?
Java应用程序依赖于GNU的 libc.so ,但我希望共享对象使用musl的 libc.so

Is it possible to have both GNU and musl libc.so in the same process? The java application relies on GNU's libc.so, but I want my shared object use musl's libc.so.

也许有一种方法可以将musl的 libc.so 重命名为 musl- libc.so

Maybe there is a way to rename musl's libc.so to musl-libc.so?

推荐答案


是否可以同时拥有两个GNU和musl libc.so是否在同一过程中?

Is it possible to have both GNU and musl libc.so in the same process?

可以加载它们,是的。

It's possible to load them both, yes. But the result will promptly crash, so it's a useless thing to do.


但是我希望共享对象使用musl的libc.so

but I want my shared object use musl's libc.so

但是为什么?

无论如何,您永远都不会糊涂使用glibc进行合作,您的选择是将glibc用于所有内容,或对所有内容使用musl。

In any case, you'll never get musl and glibc to cooperate, your choices are to either use glibc for everything, or use musl for everything.


也许可以重命名musl libc.so到musl-libc.so

Maybe there is a way to rename musl's libc.so to musl-libc.so

它们已经 命名不同: libc.so libc.so.6 。库的命名无关紧要。它们都提供相同(冲突)符号的事实很重要。

They are already named differently: libc.so vs. libc.so.6. Naming of the library doesn't matter. The fact that they both provide the same (conflicting) symbols is what matters.

这篇关于在同一过程中同时加载musl libc.so和gcc libc.so?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆