Author Topic: Assemby problem using -f macho  (Read 15647 times)

nobody

  • Guest
Assemby problem using -f macho
« on: March 09, 2009, 09:27:55 AM »
When I try assembling some code for Mac OS X it fails with:

panic: unknown section attribute use32 for section .data

I used 'nasm -f macho' to assemble

I've tried these two versions but get the same error each time:
NASM version 0.99.06-20071101 compiled on Nov 15 2007
NASM version 2.05 compiled on Feb 10 2009

The offending line is:

[SPACES]                section .data   use32 flat class=data

The same code compiles for elf and win32 target object files.

If I remove the 'use32 flat class=data' part the code assembles without error but I'm not able to test if the code will work as I don't have a Mac.  Is this the correct way to go about this?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Assemby problem using -f macho
« Reply #1 on: March 09, 2009, 11:10:10 AM »
I don't know - I haven't got a Mac to test it on. :)

The Friendly Manual doesn't mention any "qualifiers" at all for "-f macho", so there probably aren't any. Apparently "-f macho" knows the names ".text", ".data", ".rodata", ".bss"... and that's all(?). I would have thought it would accept qualifiers similar to "-f elf" (alloc, exec, write, etc.), but apparently not... I think the qualifiers you're trying to use are for "-f obj", and while Nasm may not complain in "-f elf", I don't think they're doing anything for ya. Same for "-f win32", but I'm less sure of that...

I'd tell ya to ask around the Mac site, but I suppose they'll just tell ya not to use assembly language. Sigh. I may have to acquire an accursed Mac, just to test this stuff. :(

Good Luck,
Frank