在aarch64上运行32位elf [英] run 32bit elf on aarch64

查看:175
本文介绍了在aarch64上运行32位elf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在qemu 64位ARM上安装了Debian(

I have installed Debian on qemu 64-bit ARM (followed this tutorial)

uname -a

Linux测试4.9.0-7-arm64#1 SMP Debian 4.9.110-1(2018-07-05)aarch64 GNU/Linux

Linux test 4.9.0-7-arm64 #1 SMP Debian 4.9.110-1 (2018-07-05) aarch64 GNU/Linux

我正在尝试在其上运行32位elf文件,但有些工作却没有:

and I am trying to run 32 bit elf files on it, but some work some don't:

bash:./file_2:无法执行二进制文件:Exec格式错误

bash: ./file_2: cannot execute binary file: Exec format error

在运行的文件上运行文件命令,我得到:

running file command on the file that runs, I get:

文件_1:ELF 32位LSB可执行文件,ARM,EABI4版本1(SYSV),静态链接,未剥离

file_1: ELF 32-bit LSB executable, ARM, EABI4 version 1 (SYSV), statically linked, not stripped

和不运行的那个:

file_2:ELF 32位LSB可执行文件,ARM,版本1(ARM),静态链接,已剥离

file_2: ELF 32-bit LSB executable, ARM, version 1 (ARM), statically linked, stripped

都可以在32位系统(armv7l)上工作

and both work on 32bit system(armv7l)

唯一的区别是SYSV/ARM版本.

the only difference is that SYSV/ARM version.

是否有任何解决方法而无需重新编译内核?(

is there any work around without recompiling the kernel?(read this post)

推荐答案

如链接文章所建议,这要求在内核中启用CONFIG_COMPAT.另一方面,如果您的内核没有它,我会感到惊讶-我从该教程中学到的Debian 4.9.0-4内核确实设置了CONFIG_COMPAT.您可以通过查看客户机的/boot/中的配置文件来检查内核是否启用了它.如果缺少它,那么您需要一个新内核,而其他任何方法都将无济于事.

As the linked post suggests, this requires CONFIG_COMPAT to be enabled in the kernel. On the other hand I would be surprised if your kernel didn't have it -- the Debian 4.9.0-4 kernel I have from doing that tutorial does set CONFIG_COMPAT. You can check whether your kernel has it enabled by looking at the config file for it which will be in /boot/ in the guest. If it's missing then you need a new kernel, and nothing else will help.

但是,在您的情况下,您确实拥有CONFIG_COMPAT,并且某些可执行文件可以工作.有效和无效的区别在于,有效的是EABI,无效的是OABI.OABI是32位Arm Linux二进制文件的旧的且过时的ABI("O"代表"old",十年来一直是一个不好的选择...),并且它不受64位支持内核的CONFIG_COMPAT.如果要在64位内核下运行它们,则需要从源代码中将这些二进制文件重建为EABI二进制文件.

However in your case you do have CONFIG_COMPAT, and some executables work. The difference between the ones that work and the ones that don't is that the working ones are EABI, and the non-working ones are OABI. OABI is an old and obsolete ABI for 32-bit Arm Linux binaries (the "O" stands for "old", and it's been a bad choice for a decade or so...) and it is not supported by the 64-bit kernel's CONFIG_COMPAT. You'll need to rebuild those binaries from source as EABI binaries if you want to run them under a 64-bit kernel.

这篇关于在aarch64上运行32位elf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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