我可以使用GO Linker添加其他部分吗?

发布于 2025-02-09 11:31:17 字数 777 浏览 2 评论 0原文

我使用GO工具来编译和链接我的GO程序。我需要将其他部分添加到__文本以这种方式产生的Mach-O二进制文件的段。可以这样做吗?为了进行比较,标准BSD ld链接器具有一个名为-SectCreate的标志(在其 man page ),允许用户指定一个文件,其内容应插入__ text,section-name-name-specify。但是,我不确定如何询问go工具来执行此操作,或者是否有可能。

(用例:具有根特权运行的Mac OS上的守护程序具有附加的代码签名和身份要求,特别是将具有诸如__ info_plist之类的名称的新部分添加到__ text segment有了某些不可启用的元数据内容,有一些背景讨论在这里。)

我想要 。要将我的GO程序作为MacOS上的特权守护程序运行,但是当我使用Go Build Build编译时,看不到任何方法可以添加这些其他部分。

I use the go tool to compile and link my go programs. I have a need to add additional sections to the __TEXT segment of Mach-O binaries produced this way. Is it possible to do this? For comparison, the standard BSD ld linker has a flag called -sectcreate (described on its man page) that allows the user to specify a file whose contents should be inserted into the binary in __TEXT,section-name-you-specify. However, I'm not sure how to ask the go tool to do this, or whether it's even possible.

(Use case: daemons on Mac OS that run with root privileges have additional code-signing and identity requirements, specifically that new sections with names like __info_plist be added to the __TEXT segment with certain non-executable metadata content There's some background discussion of this here.)

I want to run my Go program as a privileged daemon on MacOS, but cannot see any way to add these additional sections when I compile with go build.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文