r/Assembly_language • • 7d ago

Question I need help to make a minimal assembly setup

I began learning assembly some time ago and it's been a pleasant experience so far. I've been using online resources (tio.run x64 with nasm) to try it out and now would like to install a developer environment on my machine (Windows 11, x86-64). However, most setups either require large libc (GNU via MinGW or LLVM) ecosystems or msvc. I would like to avoid both of them. Ideally, I'd like to use cross platform foss to be able to assemble and link programs (as in output executables for multiple target architectures and the tools are cross platform themselves). I do want to be able to link C libraries, but I don't want to be dependent on them (writing my own _start if needed). I've already installed nasm (x86, x64 only but it's ok for now), but I'm missing a linker now.

Also how do I do dynamic linking?

5 Upvotes

7 comments sorted by

2

u/DoubleOwl7777 7d ago

i tried to set it up but eventually gave up and used wsl, it was just a lot easier to set up everything on linux.

3

u/MetalInMyVeins111 7d ago

Could have helped if you were on linux

2

u/P-39_Airacobra 7d ago

idk if it fits your needs but fasm is about as minimal and straightforward as ive found

1

u/DanKegel 6d ago

Try nasm and lld-link, and possibly the windows sdk for system libraries.

1

u/Key_Detail15 6d ago

You can use a linker from a gcc installation (eg. from winlibs.com). I suppose it's possible to isolate ld.exe and its dependencies from the 10,000 other files, but it's probably not worth the bother (see below).

(If you use WSL as others have said, all that and more is still present anyway.)

An alternative to NASM is 'as' (which also comes with gcc). This can be instructed to use Intel-style syntax.

(I did do the exercise of isolating as.exe and ld.exe from a gcc installation. These were the files needed in that particular gcc:

as.exe
ld.exe
libiconv-2.dll
libintl-8.dll
libwinpthread-1.dll
libzstd.dll
zlib1.dll

I also wrote two .bat files to simplify their use:

c:\gas>type ass.bat
\gas\as %1.asm -o%1.obj

c:\gas>type link.bat
\gas\ld %1.obj -o %1.exe \windows\system32\msvcrt.dll windows\system32\kernel32.dll  windows\system32\user32.dll -e main

I needed this when I need to assemble and link GAS-format ASM files.)

1

u/Dog-Mad 5d ago

i just installed linux since it was easier to write asm on. All i use is ld (linker) and nasm. Cannot be bothered to do any dev environment bs. I can compile to windows and such if i wanted to but i would have to rewrite all the syscalls.