4

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

call foo@plt

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

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

64 位 PicoLisp 在 Linux 和 SunOS 上构建没有问题。这些平台可能具有功能更强大(更新)的 GNU 汇编器版本。我不知道更新的 GNU 汇编器是否适用于 OSX/Darwin ......或者是否有其他解决方案?

如果你想在 OSX/Darwin 上自己尝试一下,我可以给你一些需要的文件。

4

2 回答 2

5

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

于 2011-06-22T23:20:49.237 回答
0

Mac 上支持 PicoLisp 已经有一段时间了。只需访问标准下载站点

于 2018-05-29T08:23:31.357 回答