我有一个Mac OS X命令行工具,可以从二进制文件本身嵌入一些数据中受益。
我知道mach-o文件支持多个段,其中一些可用于存储任意数据。但我找不到一个命令行工具来做到这一点。
虽然我知道还有其他的,可能更简单的方法(例如将数据文件转换为C源代码并通过gcc链接)以将数据导入我的二进制文件,这个问题引起了我的兴趣。有谁知道魔术?
我有一个Mac OS X命令行工具,可以从二进制文件本身嵌入一些数据中受益。
我知道mach-o文件支持多个段,其中一些可用于存储任意数据。但我找不到一个命令行工具来做到这一点。
虽然我知道还有其他的,可能更简单的方法(例如将数据文件转换为C源代码并通过gcc链接)以将数据导入我的二进制文件,这个问题引起了我的兴趣。有谁知道魔术?
链接器ld采用参数-sectcreate。
从手册页中,
-sectcreate segname sectname file The section sectname in the segment segname is created from the contents of file file. The combination of segname and sectname must be unique there cannot already be a section (segname,sectname) from any other input.
海湾合作委员会也有一个 部分 可以应用于变量的属性,表示它属于非标准部分。
链接器ld采用参数-sectcreate。
从手册页中,
-sectcreate segname sectname file The section sectname in the segment segname is created from the contents of file file. The combination of segname and sectname must be unique there cannot already be a section (segname,sectname) from any other input.
海湾合作委员会也有一个 部分 可以应用于变量的属性,表示它属于非标准部分。