Re: 64-bit problem on Mac

2011-06-23 Thread Alexander Burger
Hi Jon,

 I've now got an answer to my question at
 http://stackoverflow.com/questions/6384961/osx-gnu-assembler-problem-with-call-fooplt

Nice.


 Matthew Slattery says:
  ..
 1. PLT is an ELF concept, but OS X uses a completely different
object / executable file format - Mach-O.
 2. 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
  ..
  It looks like there has been some work on i386 and x86-64 Mach-O 
  support quite recently in binutils 

That's good to hear!


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

I'm not sure if this is the case. That '@plt' stuff surely has to do
with the way code relocation is handled in ELF. So it might not be
helpful here. But, again, I'm not sure, it might be worth to try it.


Perhaps we should better investigate the Mach-O format? With that I mean
not actually analyzing the format, but the ways to generate it.

What helps in such cases is usually writing code snippets in C, compile
them to assembly code (the -S option to gcc), and study that.

Then we might be able to write a different code-generator for Mac OS, or
(perhaps. better) a post-processor.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: 64-bit problem on Mac

2011-06-23 Thread Jon Kleiser
Hi Alex,

 Hi Jon,

 What helps in such cases is usually writing code snippets in C, compile
 them to assembly code (the -S option to gcc), and study that.
 ..
 I think this sounds like something to try. Do you have any
 suggestions for code snippets in C that can be useful?

 OK. Perhaps the most reasonable is to start with the corresponding
 C-sources.

 Can you do something like

$ gcc -S -m64 src/main.c

 and send me the resulting main.s?

 Cheers,
 - Alex

See attached file.

/Jon

main.s.tgz
Description: GNU Zip compressed data