简体   繁体   English

旧版链接程序(使用libc5)在Linux内核2.6.25上失败

[英]legacy linker (uses libc5) fails on linux kernel 2.6.25

We have a legacy linker that uses libc5, and due to several factors we only have the binary and not the source. 我们有一个使用libc5的旧版链接程序,由于多种因素,我们只有二进制文件,而没有源文件。 Yes, version control would have saved us from our current problem... that is now in use for our full tool chain and product line, but this particular horse is long gone. 是的,版本控制将我们从当前的问题中解救出来了……现在我们的整个工具链和产品线都在使用它,但是这种特殊的方式早已一去不复返了。

This linker works on linux kernel 2.6.24, but on 2.6.25 (and 2.6.26) it fails with the message 此链接器可在Linux内核2.6.24上运行,但在2.6.25(和2.6.26)上它将失败,并显示以下消息:

Virtual memory exceeded in `new'

We had a similar problem with the corresponding legacy compiler, but with some stackoverflow.com answers and much research have discovered that the compiler problem was caused by the "brk randomization" in linux kernel 2.6.25. 相应的旧版编译器也有类似的问题,但是有了一些stackoverflow.com的答案 ,许多研究发现编译器问题是由linux内核2.6.25中的“ brk随机化”引起的。 The workaround for that is to set a sysctl vars and a environment var: 解决方法是设置sysctl变量和环境变量:

/proc/sys/kernel/randomize_va_space = 0 or 1
    setenv MALLOC_TOP_PAD_ 536870912

This, however, does not help the linker. 但是,这对链接器没有帮助。

I have found from using "ldd" that the linker has more shared library dependencies (the compiler only had the libc.so.5): 通过使用“ ldd”,我发现链接器具有更多的共享库依赖项(编译器仅具有libc.so.5):

libg++.so.27 => /usr/lib/libg++.so.27 (0xb7eca000)
    libstdc++.so.27 => /usr/lib/libstdc++.so.27 (0xb7e99000)
    libm.so.5 => /lib/libm.so.5 (0xb7e90000)
    libc.so.5 => /lib/libc.so.5 (0xb7dd3000)

And I have read that I may have to install the libc5 version of libg++.so.27. 而且我已经读到我可能必须安装libg ++。so.27的libc5版本。 I hesitate to do that since I dont know if that will override the latest libg++.so.27 and cause problems for non-libc5 apps. 我不愿意这样做,因为我不知道这是否会覆盖最新的libg ++。so.27并导致非libc5应用程序出现问题。

So, do I find and install the libc5 version of libg++.so.27, or is there some better way to disable brk randomization, or is there another difference between kernel 2.6.24 and 2.6.25 that is causing the linker problem? 因此,我是否找到并安装了libg ++。so.27的libc5版本,或者是否有更好的方法来禁用brk随机化,还是内核2.6.24和2.6.25之间存在另一个导致链接器问题的区别?

Edit 编辑

See this for all of the details of this search, and my final resolution. 有关搜索的所有详细信息以及我的最终解决方案,请参见此内容。

It does not answer your question exactly, but in your situation, I would create a chroot with a known-to-work libc + libstdc++ combination, or even kernel+libc+libstdc++ (in which case you need a virtual machine, obviously). 它不能完全回答您的问题,但是在您的情况下,我将使用已知可用的libc + libstdc ++组合甚至是kernel + libc + libstdc ++(显然,在这种情况下您需要虚拟机)来创建chroot。 This way, you can try things relatively easily, without disrupting anything else. 这样,您可以相对轻松地进行尝试,而不会干扰其他任何事情。

The best way to be compatible with an old library is to use this old library, after all, and since it is "just" a toolchain problem, using some sort of jail/chroot/virtual machine should not be too much of a problem ? 毕竟,与旧库兼容的最佳方法是使用该旧库,并且由于它只是“工具链”问题,因此使用某种jail / chroot /虚拟机应该不会有太大问题吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM