编译独立的静态可执行文件

编程入门 行业动态 更新时间:2024-10-26 06:37:03
本文介绍了编译独立的静态可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试编译一个不使用动态加载器的可执行文件(ELF文件)。我构建了一个交叉编译器,编译来自linux的臀部,用于我做的模拟器。我断言标志-static-libgcc编译我的hello.cpp文件(hello世界程序)。显然这还不够。因为在我的可执行文件中还有一个段,它包含动态加载器的名称/路径。我使用什么标志来生成一个包含一切需要运行的可执行文件?

I'm trying to compile an executable (ELF file) that does not use a dynamic loader. I built a cross compiler that compiles mips from linux to be used on a simulator I made. I asserted the flag -static-libgcc on compilation of my hello.cpp file (hello world program). Apparently this is not enough though. Because there is still a segment in my executable which contains the name/path of the dynamic loader. What flags do I use to generate an executable which contains EVERYTHING needed to be run? Do I need to rebuild my cross compiler?

推荐答案

尝试使用 -static flag?

更多推荐

编译独立的静态可执行文件

本文发布于:2023-11-12 21:45:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582608.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:静态   可执行文件   独立

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!