News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Assembler languages for Linux

Started by shankle, February 14, 2016, 01:46:33 AM

Previous topic - Next topic

shankle

Only interested in 64-bit assemblers.
I have found 4 assemblers that will work for Linux. Trouble is I don't
want to pick the wrong one. I already went from MASM32 to Goasm64.
Now due to Windows 10, I have to start all over again. Thank you Microsoft!

The Linux assemblers are: NASM, YASM, FASM and TASM.
From what I have read FASM seems to be the way to go.
Opinions Please....

mabdelouahab


GoneFishing

There's also SOLAR ASSEMBLER written by Bogdan Ontanu

When I moved to Linux I used JWASM  for the first time .
Pros of using JWASM :
         it's 100% MASM compatible and you can focus on learning new platform  - not new syntax
         If you want to program in 32 bit  - you may use Open Watcom standard library ( JWLINK can link it  ) . It's well documented! 
Cons:
         it has limited support for Linux  - no FASTCALL  for example  but you may write your own macro or use sombody else's one to call functions from C lib etc . I have written such a macro - FCALLTEST - it can handle up to 12 parameters but doesn't have floating point arguments support.
         JWLINK in 64 bit mode is very unstable and limited in functionality

Magnum

I tried Solar Asm under Linux.

When I run

Quotesol_asm2.exe test.asm test.obj -elf32

I get

Quote# ./test.sh
./test.sh: line 5: sol_asm2.exe: command not found
# sol_asm2.exe
bash: sol_asm2.exe: command not found
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

GoneFishing

#4
Most likely execute permission was not set
Open terminal in directory with sol_asm and execute
ll
It will show permissions
To set exec permission:
sudo chmod +x sol_asm2.exe
To make sure that your binary is valid ELF executable:
file sol_asm2.exe

[EDIT] Oops, my bad , you should use this notation (assumed that terminal is opened in directory where sol_asm lives ):
Quote./sol_asm2.exe ...

Magnum

Looks like it is not a Linux exe.

Quotesol_asm2.exe: PE32 executable (console) Intel 80386, for MS Windows
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

GoneFishing

Yes, sol_asm is distributed in object form
You must link it to your C lib
Read this ( if you have the latest version) : sol_asm_2012_10_30_v36_12/bin/obj_unix_elf/read_me.txt

Vortex

Hi shankle,

Did you find some good Linux x86-64 assembly tutorials? I guess the options are limited.

shankle

HI Vortex,
Yes a gentleman on the Linux mint forum gave me 3 references about NASM.
The 1st one seems to be very detailed and just what I need.
I'll probably take several weeks trying to digest them.

Until I do more reading and research, I do not at this time know if I can write,
compile and run an assembler program using NASM in Linux.

   

sbk

Hey shankle,

Quote from: shankle on February 14, 2016, 08:52:34 AM
Yes a gentleman on the Linux mint forum gave me 3 references about NASM.
The 1st one seems to be very detailed and just what I need.
I'll probably take several weeks trying to digest them.

Would you mind sharing those references. I'm always interested in NASM related material and I think others following your footsteps toward the Linux world might be interested as well.

Quote from: shankle on February 14, 2016, 08:52:34 AM
Until I do more reading and research, I do not at this time know if I can write,
compile and run an assembler program using NASM in Linux.

It's really not that different from coding on Windows. The biggest difference between the two are the amount of options. With Windows you have the Win API which provides you with uniform access to various features of the operating system. On Linux, the libraries can be different from system to system. For example, simple GUI applications might be dependent on Qt, or GTK, or X/Motif, or whatever.. not all systems are going to have your chosen target by default. This means that, aside from simple system call's and use of the standard C library, your code is usually going to require at least some people to install various libraries to get your program to work. This is oddly acceptable in the Linux world and because of the large number of options for configurations and frameworks, one of the first things the Windows programmer has to learn when switching to Linux is... there is no one correct way to do anything on Linux. I myself kinda miss that about Win32 systems, being able to look up the Windows API reference and know the one correct method to implement a given feature. But it's also liberating, in a way, to be able to choose to develop your software around libraries which share your style of coding.

Anyway, I have faith that you'll do just fine as a Linux programmer. Just avoid telling people what editor you use.. for some reason that starts HUGE arguments within the Linux community.  :lol:

Best Regards,
~ Bryant

shankle

HI SBK,
The references that you requested can be found on Linuxmint.com/forum.
Then go to the Newbie folder and look under my post called "assembler
languages that work in linux". The references are given by the gentleman
called Reorx. Hope this helps.
If not tell me and I will try to find another way of getting the info to you.

sbk

Quote from: shankle on February 14, 2016, 01:46:33 AMOnly interested in 64-bit assemblers.

This is the reason I wanted to see the references. The examples you were given were specific to 32-bit mode Linux systems. These will build and work under your 64-bit Linux using compatibility mode, but you're question (at least here) was much more specific.

I would say bookmark the Linux Assembly page, that one has been a great resource for years. The third link he gave you is on that page, so he really gave you 2 links. The first one is okay, but you're interested in 64-bit systems and there isn't really enough to that tutorial to warrant spending a lot of time on it.

Check out the following:

Gunther

Hi shankle,

my favorite assembler under Linux and BSD is YASM. You'll find some of my Linux sources inside the forum.

Quote from: shankle on February 14, 2016, 01:46:33 AM
The Linux assemblers are: NASM, YASM, FASM and TASM.
From what I have read FASM seems to be the way to go.
Opinions Please....

I think TASM won't work under Linux.

Gunther
You have to know the facts before you can distort them.

anta40

If you prefer MASM-style assembler, definitely pick JWASM/HJWASM.
But if you don't mind trying different assemblers, NASM/FASM are fine.
Both are still under active development.

BTW, there's an interesting visual IDE and UI library for FASM, which runs on Windows as well on Linux.

;)

GoneFishing

#14
Quote from: anta40 on February 15, 2016, 12:24:46 PM
...
BTW, there's an interesting visual IDE and UI library for FASM, which runs on Windows as well on Linux.
...
Didn't tried it yet but have heard of it earlier . Their site looks very original . I really like it .

BTW One should  not forget Linux native GAS assembler .

EDIT: I noticed a couple of issues with SOL_ASM's -elf64 output object format:
assemble /obj_libc/test.asm with -elf64 switch and link :
Quote/usr/bin/ld: fatal error: test.obj: unsupported ELF machine number 3
I had to edit ELF header to link it successfully
elfedit  --output-mach x86-64  test.obj
Now test app is built but crashes with  Segmentation fault
The reason - no FASTCALL for Linux .
It's very sad news
The thread on  SOL_ASM development froze a year ago that's why I wan't to post there