flat assembler
Message board for the users of flat assembler.

Index > Unix > How to build current FASM on MacOS?

Author
Thread Post new topic Reply to topic
TmX



Joined: 02 Mar 2006
Posts: 841
Location: Jakarta, Indonesia
TmX 21 Feb 2021, 13:39
I used fasm-1.73.27.tar.gz as starting point.

First, built objconv found at here
Then grab FASM.

Convert the object file:
Code:
./objconv -fmacho -nu fasm.o fasm.obj    


Quote:
Input file: fasm.o, output file: fasm.obj
Converting from ELF32 to Mach-O Little Endian32
Adding leading underscores to symbol names

0 Debug sections removed
0 Exception sections removed
14 Changes in leading underscores on symbol names


Last part: link with gcc
Code:
gcc fasm.obj -o fasm    


I got this:
Quote:

ld: warning: ignoring file fasm.obj, building for macOS-x86_64 but attempting to link with file built for unknown-i386
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


For those who are not familiar with MacOS:
Quote:
starting with macOS Catalina, 32-bit apps are no longer compatible with macOS

https://support.apple.com/en-us/HT208436


Any help?
Post 21 Feb 2021, 13:39
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 21 Feb 2021, 15:18
You can make a 64-bit compatible binary here:
https://board.flatassembler.net/topic.php?t=19593
Post 21 Feb 2021, 15:18
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 21 Feb 2021, 16:10
If you start with fasmg (which comes with a 64-bit Mach-O executable in the official package), you might be able to use its Mach-O formatter and make fasm.x64 in Mach-O format instead of ELF (similarly to what jacobly did for fasmg).
Post 21 Feb 2021, 16:10
View user's profile Send private message Visit poster's website Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 841
Location: Jakarta, Indonesia
TmX 06 Jan 2022, 05:44
Tomasz Grysztar wrote:
If you start with fasmg (which comes with a 64-bit Mach-O executable in the official package), you might be able to use its Mach-O formatter and make fasm.x64 in Mach-O format instead of ELF (similarly to what jacobly did for fasmg).


Sorry for very late reply. OK, just noticed there's fasmg for 64-bit MacOS
Next step, I assume, is to modify Linux fasm's code and then assemble it with fasmg?
Post 06 Jan 2022, 05:44
View user's profile Send private message Reply with quote
ford



Joined: 21 Jan 2010
Posts: 118
Location: Absurdistan
ford 15 Mar 2022, 17:35
Tomasz Grysztar wrote:
If you start with fasmg (which comes with a 64-bit Mach-O executable in the official package), you might be able to use its Mach-O formatter and make fasm.x64 in Mach-O format instead of ELF (similarly to what jacobly did for fasmg).


Would there be any hope for FASM on M1 without Rosetta2?

_________________
Everything is absurd.
Post 15 Mar 2022, 17:35
View user's profile Send private message Visit poster's website Reply with quote
int3h



Joined: 13 Dec 2010
Posts: 8
int3h 19 May 2024, 11:30
I saw fasm for ARM and I thought since Apple Silicon is ARM it is supported. But I don't see macOS listed there. So I am wondering if it is supported. A bit new to writing assembly. I am more familiar with reading assembly by disassembling mostly. I understand that we need to invoke os though sys calls and such.
Post 19 May 2024, 11:30
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 19 May 2024, 12:00
If MacOS supports loading and running ELF file formats then fasmarm should be fine to make the files.

It is just a matter of figuring out the syscall interface to make it function within the OS.
Post 19 May 2024, 12:00
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.