构建现代 (4.x) GCC 以在与主机相同的架构上运行 2.4.x 内核?
问题相对简单:如何在与编译器主机相同的架构上构建 4.x 系列的 GCC(以及 binutils 和朋友),以 2.4 ABI 为目标?
主机系统将是 x86 或 x86_64,唯一的要求是只要 ABI 匹配,构建的 ELF 文件就可以在旧内核上运行。 (内核源代码/标头存在)
还需要兼容的 libc 才能链接它。但是,我也可以动态链接它,因为我知道 (g)libc 版本。
任何指示将不胜感激。我对 crosstool-ng 有点熟悉,但它似乎不再支持 2.4 内核(对于明显的原因)。
The question is relatively straight forward: how can I build a GCC of the 4.x series (along with binutils and friends) that targets a 2.4 ABI on the same architecture as the host for the compiler?
The host system would be x86 or x86_64 and the only requirement is that the built ELF files run on an old kernel as long as the ABI matches. (Kernel sources/headers exist)
A compatible libc would be required as well in order to link it in. However, I can dynamically link against it as well, since I know the (g)libc version.
Any pointers would be much appreciated. I'm somewhat familiar with crosstool-ng, but that doesn't even seem to support 2.4 kernels anymore (for obvious reasons).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的方法可能是在旧操作系统上设置现代工具链。
RHEL 2.1 或 3 可能是最好的,因为直到最近才支持它们。
编译 gcc 4 可能很棘手,因为您还需要数学库。您可能需要采取多阶段方法。
编辑:
要编译较新的 gcc:
像这样:
Probably the easiest way is to setup a modern tool chain on an old OS.
RHEL 2.1 or 3 might be best, as they were supported until recently.
Compiling gcc 4 may be tricky since you'll need maths libraries as well. You may have to do a multi-stage approach.
EDIT:
For compiling newer gcc:
Something like this:
我相信在这种情况下你可能应该构建一个 GCC 交叉编译器,并且你应该编译 GLibc 来处理对旧 2.4 内核的依赖。
但是,您是否只是尝试编译代码,然后将其与旧的 2.4 内核兼容的 Glibc 库链接起来?我想这应该可行。
您是否尝试在旧系统上运行二进制文件(使用最新的 GCC 在最新的系统上以简单的方式获得)?什么没有按预期工作?
问候。
I would believe that you probably should build a GCC cross-compiler in that case, and that you should compile GLibc which would handle the dependency to the old 2.4 kernel.
However, did you simply try to compile your code, and simply link it with the old 2.4-kernel compatible Glibc library ? I would suppose that should work.
And did you try to run your binary (obtained the simple way on a recent system using its recent GCC) on the old system? What is not working as expected?
Regards.