Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 319437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:39:41+00:00 2026-05-12T08:39:41+00:00

Is there a way to execute a flat binary image in Linux, using a

  • 0

Is there a way to execute a flat binary image in Linux, using a syntax something like:

nasm -f bin -o foo.bin foo.asm
runbinary foo.bin
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T08:39:41+00:00Added an answer on May 12, 2026 at 8:39 am

    Is there some reason you don’t want to use “-f elf” instead of “-f bin”?

    I think Linux won’t run a binary that’s not in ELF format. I can’t find a tool that converts flat binaries to ELF, but you can cheat by putting the ELF information in foo.asm,
    using the technique described here :

    We can look at the ELF
    specification, and
    /usr/include/linux/elf.h, and
    executables created by the standard
    tools, to figure out what our empty
    ELF executable should look like. But,
    if you’re the impatient type, you can
    just use the one I’ve supplied here:

     BITS 32
    
                   org     0x08048000
    
     ehdr:                                                 ; Elf32_Ehdr
                   db      0x7F, "ELF", 1, 1, 1, 0         ;   e_ident
           times 8 db      0
                   dw      2                               ;   e_type
                   dw      3                               ;   e_machine
                   dd      1                               ;   e_version
                   dd      _start                          ;   e_entry
                   dd      phdr - $$                       ;   e_phoff
                   dd      0                               ;   e_shoff
                   dd      0                               ;   e_flags
                   dw      ehdrsize                        ;   e_ehsize
                   dw      phdrsize                        ;   e_phentsize
                   dw      1                               ;   e_phnum
                   dw      0                               ;   e_shentsize
                   dw      0                               ;   e_shnum
                   dw      0                               ;   e_shstrndx
    
     ehdrsize      equ     $ - ehdr
    
     phdr:                                                 ; Elf32_Phdr
                   dd      1                               ;   p_type
                   dd      0                               ;   p_offset
                   dd      $$                              ;   p_vaddr
                   dd      $$                              ;   p_paddr
                   dd      filesize                        ;   p_filesz
                   dd      filesize                        ;   p_memsz
                   dd      5                               ;   p_flags
                   dd      0x1000                          ;   p_align
    
     phdrsize      equ     $ - phdr
    
     _start:
    
     ; your program here
    
      filesize      equ     $ - $$
    

    This image contains an ELF header,
    identifying the file as an Intel 386
    executable, with no section header
    table and a program header table
    containing one entry. Said entry
    instructs the program loader to load
    the entire file into memory (it’s
    normal behavior for a program to
    include its ELF header and program
    header table in its memory image)
    starting at memory address 0x08048000
    (which is the default address for
    executables to load), and to begin
    executing the code at _start, which
    appears immediately after the program
    header table. No .data segment, no
    .bss segment, no commentary — nothing
    but the bare necessities.

    So, let’s add in our little program:

     ; tiny.asm
                   org     0x08048000
    
     ;
     ; (as above)
     ;
    
    _start: mov bl, 42 xor eax, eax inc eax int 0x80 filesize equ $ - $$
    

    and try it out:

     $ nasm -f bin -o a.out tiny.asm
     $ chmod +x a.out
     $ ./a.out ; echo $?
     42
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 202k
  • Answers 202k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Also match the ] before the number you want: s/^.*]\([0-9]*\.[0-9]*\):… May 12, 2026 at 8:22 pm
  • Editorial Team
    Editorial Team added an answer To expand a little bit on what adamaig said: When… May 12, 2026 at 8:22 pm
  • Editorial Team
    Editorial Team added an answer Found it finally. Start the SQL server Enterprise install. Then… May 12, 2026 at 8:22 pm

Related Questions

I have a repository data access pattern like so: IRepository<T> { .. query members
SQL Server 2005 Question: I'm working on a data conversion project where I'm taking
Is there a way to execute a full ASPX source file where the page
Is there a way to execute a query(containing built in DB function) using PreparedStatement?

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.