OSX GNU汇编程序问题,带有"call foo @ plt" [英] OSX GNU assembler problem with 'call foo@plt'

查看:172
本文介绍了OSX GNU汇编程序问题,带有"call foo @ plt"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在Mac OS X(10.6.7)上构建64位PicoLisp时,似乎我遇到了OSX Dev问题.工具GNU汇编器('as'),版本1.38.我的Xcode是版本3.2.4.我的(生成的)x86-64.darwin.base.s中导致问题的行通常看起来像这样:

In an attempt to build 64-bit PicoLisp on Mac OS X (10.6.7) it seems I've encountered a problem with the OSX Dev. Tools GNU assembler ('as'), which is version 1.38. My Xcode is version 3.2.4. The lines in my (generated) x86-64.darwin.base.s that cause the problems typically look like this:

call foo@plt

...,他们给我这样的错误消息:

... and they give me error messages like this:

x86-64.darwin.base.s:41694:junk `@plt' after expression

64位PicoLisp可以在Linux和SunOS上毫无问题地构建.这些平台可能具有功能更强大(更新)的GNU汇编程序版本.我不知道较新的GNU汇编程序是否适用于OSX/Darwin ...还是会有其他解决方案?

64-bit PicoLisp builds without problems on Linux and SunOS. These platforms probably have more capable (newer) versions of GNU assemblers. I don't know if newer GNU assemblers are avilable for OSX/Darwin ... or could there be other solutions?

如果您想在OSX/Darwin上自己尝试一下,我可以为您提供一些需要的文件.

If you'd like to try this yourself on OSX/Darwin, I can give you some files that are needed.

推荐答案

不幸的是,我认为这里至少存在两个重要问题:

Unfortunately, I think there are at least two significant issues here:

  1. " PLT "是ELF概念,但OS X使用了完全不同的概念对象/可执行文件格式-Mach-O. Mach-O使用类似的机制,但是名称不同.
  2. MacOS在asm符号名称前加上下划线.因此,您要call _foo . call foo将汇编但不链接.像在GNU/Linux(ELF)上一样,当您call一个实际位于动态库中的符号时,链接器会通过dyld_stub条目为您间接调用. (即使在构建共享库时,非可插入符号也是默认设置,
  1. "PLT" is an ELF concept, but OS X uses a completely different object / executable file format - Mach-O. Mach-O uses a similar mechanism but with a different name.
  2. MacOS prefixes asm symbol names with a leading underscore. So you want call _foo. call foo would assemble but not link. As on GNU/Linux (ELF), the linker indirects through dyld_stub entries for you when you call a symbol that turns out to be in a dynamic library.
    (Non-interposable symbols are the default even when building shared libraries, unlike on ELF systems)
  3. Apple's as appears to be derived from a fork of a much earlier version of the GNU assembler, and, in some places, the syntax (and command line options) are rather different from recent versions (even where the concepts are the same).

似乎最近在 binutils ;可能值得研究最新版本(2.21).但是,如果生成的汇编代码试图执行特定于ELF的巧妙操作,那么您可能仍然会遇到一些主要问题...

It looks like there has been some work on i386 and x86-64 Mach-O support quite recently in binutils; it might be worth investigating the most recent version (2.21). But if the generated assembly code is trying to do clever things which are ELF-specific, you're probably going to have some major problems anyway...

这篇关于OSX GNU汇编程序问题,带有"call foo @ plt"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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