5

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

4
  • What version of the Developer Tools are you using ? Xcode 3.2.x ? Xcode 4.x ?
    – Paul R
    Jun 17, 2011 at 11:20
  • 1
    At some point I had very similar problems – with my own code. Swapping the order of some input registers, weirdly enough, seemed to fix it. Then again it seemed like it broke by itself in the first place.
    – user308323
    Jun 17, 2011 at 11:21
  • Not sure why this doesn't work on OSX. See stackoverflow.com/questions/5469274/what-does-plt-mean-here/… for a description of how the PLT works - you may need a later assembler to allow the @ in symbol names, though the doco seems to indicate it's not allowed, even now.
    – paxdiablo
    Jun 17, 2011 at 11:37
  • My Xcode is Version 3.2.4 (1708).
    – Jon K
    Jun 17, 2011 at 12:20

2 Answers 2

7

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

3
-1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.