开发者

OSX GNU assembler problem with 'call foo@plt'

In an attempt to build 64-bit PicoLisp on Mac OS X (10.6.7) it seems I've encounter开发者_如何学运维ed 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-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?

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" 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).

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...


PicoLisp has been supported on Mac for quite some time now. Just go to the standard download site.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜