Make Executable Binary File From Elf Using GNU objcopy
问题 I'd like to copy an executable ELF file via: $ objcopy -O binary myfile.elf myfile.bin Unfortunately: $ chmod +x myfile.bin $ ./myfile.bin results in: cannot execute binary file Is there any way to retain the files executability? 回答1: To be executable by the execve(2) syscall, a file usually has to be some elf(5) file (or some script, or some old a.out format). But see also binfmt_misc Your objcopy(1) command is loosing the essential meta-data in the ELF file. Maybe you want strip(1) Recall