Linked Questions

10 votes
3 answers
17k views

I want to compile this source code in Windows (It just an example): start: NOP NOP When I compile it with NASM or FASM, output file length is 2 bytes. But when I compile it with GNU assembler (as) ...
Amir's user avatar
  • 13.9k
0 votes
0 answers
25 views

At the middle of this very good article: A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux, the author shows how to directly construct yourself the ELF headers: BITS 32 ...
Katoptriss's user avatar
43 votes
4 answers
53k views

Is there a set of command-line options that will convince gcc to produce a flat binary file from a self-contained source file? For example, suppose the contents of foo.c are static int f(int x) { ...
I. J. Kennedy's user avatar
44 votes
4 answers
10k views

I've been told and have read from Intel's manuals that it is possible to write instructions to memory, but the instruction prefetch queue has already fetched the stale instructions and will execute ...
Chris's user avatar
  • 2,956
14 votes
5 answers
13k views

For example, with a boot sector that BIOS prints a to the screen main.asm: org 0x7c00 bits 16 cli mov ax, 0x0E61 int 0x10 hlt times 510 - ($-$$) db 0 dw 0xaa55 Then: nasm -o main.img main.asm qemu-...
Ciro Santilli OurBigBook.com's user avatar
8 votes
3 answers
34k views

My understanding is that a binary file is the hex-codes of the instructions of the processor (can be loaded into memory & start executing from entry point) and a ELF file is the same with NO-Fixed ...
RRON's user avatar
  • 1,135
6 votes
2 answers
10k views

I cannot believe how hard this seems to be. I am working from SPARC Solaris 8. and we have some kind of GNU-gcc (3.4.2) and 'as' assembler (Sun WorkShop 6 2003/12/18 Compiler Common 6.0). Anyways, I'...
bazz's user avatar
  • 423
6 votes
5 answers
4k views

How can you generate a flat binary that will run directly on the CPU? That is, without an Operating System; also called free standing environment code (see What is the name for a program running ...
Hawken's user avatar
  • 2,119
5 votes
2 answers
1k views

When an assembly program is compiled and run on a machine without an operating system, how is a starting address in RAM chosen so that variables declared with data directives are allocated properly?
TheResolute's user avatar
5 votes
2 answers
5k views

How should I produce raw binary file from two object (.o) files? I want the plain binary format produced by nasm -f bin when compiling a .asm file, but for .o files. By a plain binary, I mean a file ...
Pratik Singhal's user avatar
4 votes
1 answer
2k views

I wrote some assembly code for x86, and wanted to assemble it into plain binary file (not Mach-O) by just using Mac's default assembler (the 'as'). After several googlings and tries, I failed. ...
Kilobyte's user avatar
1 vote
1 answer
4k views

Having this in gas: .text .globl main main: xor %eax, %eax lea str(%rip), %rdi call printf call exit str: .byte 0x7F, "ELF", 1,1,1,0 I thought the .byte directive could be ...
autistic456's user avatar
4 votes
1 answer
708 views

Introduction I am trying to learn about ELF Files, and also experiment with them a little bit. Currently, I am following the tutorial here, which is about creating a tiny 32-bit ELF file that just ...
pikafan_8080's user avatar
2 votes
1 answer
991 views

The address of str is stored the stack(can use pop to fetch it, and it's position independent): .text str: .string "test\n" But now the address of str is not in the stack(can't use pop ...
Je Rog's user avatar
  • 6,131
1 vote
2 answers
307 views

I'm working on a program written in assembly: xor eax, eax ; make eax equal to 0 push eax ; pushes null push 0x68732f2f ; pushes /sh (//) push 0x6e69622f ; pushes /bin mov ...
jakenberg's user avatar
  • 2,113