Questions tagged [executable-format]

39 questions
25
votes
3 answers

Exec format error 32-bit executable Windows Subsystem for Linux?

When I try to execute a 32-bit file compiled with gcc -m32 main.c -o main on Windows Subsystem for Linux, I get the following error: bash: ./main: cannot execute binary file: Exec format error. If I compile it without -m32 it runs. Any solution for…
19
votes
4 answers

What is symbol table and how is it integrated into the executable?

When I tried to debug an executable: (gdb) break +1 No symbol table is loaded. Use the "file" command. What does that mean exactly? Is the symbol table appended to the executable?
user198729
  • 61,774
  • 108
  • 250
  • 348
12
votes
9 answers

Why are compiled Java class files smaller than C compiled files?

I would like to know why the .o file that we get from compiling a .c file that prints "Hello, World!" is larger than a Java .class file that also prints "Hello, World!"?
AHS
  • 774
  • 1
  • 10
  • 17
11
votes
1 answer

What are the differences between PE and ELF binary formats?

What is the difference between Windows PE binary and Linux ELF binary formats? How does a compiler convert a file into the specified format of the operating system when it should only create the assembly language equivalent of the source code? Could…
8
votes
2 answers

What is the PEI format?

I understand that PE is a modified version of COFF, and that PE+ is a modified version of PE with 64 bit support, but what is PEI? Am I correct in saying there is no difference between PE and PEI, and they can be used interchangeably?
Jeroen
  • 15,257
  • 12
  • 59
  • 102
6
votes
2 answers

Why are executables called "image files"?

I'm reading the PE format document. In the document, the word "image" appears many times and seems always comes along with the word "executable". However, it doesn't explain why "executable" is called an "image file". There is a list of page entries…
El Mismo Sol
  • 869
  • 1
  • 6
  • 14
6
votes
1 answer

ELF executable file: many zero bytes

Introduction I'm compiling a simple assembly code (Intel syntax, x86, Linux) printing "Hello World!". Here it is: SECTION .rodata msg: db 'Hello world!', 0xA msg_len: equ $ - msg SECTION .text global _start _start: mov…
Kolay.Ne
  • 1,345
  • 1
  • 8
  • 23
6
votes
3 answers

Is a core dump executable by itself?

The Wikipedia page on Core dump says In Unix-like systems, core dumps generally use the standard executable image-format: a.out in older versions of Unix, ELF in modern Linux, System V, Solaris, and BSD systems, Mach-O in OS X, etc. Does this…
Sundar R
  • 13,776
  • 6
  • 49
  • 76
6
votes
1 answer

Is there a linker script directive that allows me to move my stack start address?

I'm trying to change the start location of my stack using a linker script on x86_64. I was able to move my executable start address using this: PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x200000)); . =…
5
votes
2 answers

Why are there text function names inside EXE file?

I compiled a C++ program to have an EXE file in release mode. When I open the EXE file in an editor, I see pieces of text blocks, which are mostly the names of used low level functions in the program. It is always said that the computer only…
hkBattousai
  • 10,583
  • 18
  • 76
  • 124
4
votes
2 answers

Are variable identifiers totally needless, at the end of the day?

I've taken a good time studying TOC and Compiler design, not done yet but I feel comfortable with the conceptions. On the other hand I have a very shallow knowledge of assembly and machine code, and I have always the desire/need to connect the two…
Physician
  • 483
  • 2
  • 7
4
votes
3 answers

Strange Value in EXE header

I've seen a strange value placed in EXE header 00000000 :4D 5A 90 00 03 00 00 00 - 04 00 00 00 FF FF 00 00 00000010 :B8 00 00 00 00 00 00 00 - 40 00 00 00 00 00 00 00 00000020 :00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00000030 :00 00 00 00…
oneat
  • 10,778
  • 16
  • 52
  • 70
3
votes
3 answers

GNU Binutils' Binary File Descriptor library - format example

As in title. I tried reading the BFD's ELF's code, but it's rather not a light reading. I also tried to get something from the documentation, but I would need an example to see how it works. Could anyone point me some easier example for me, to know…
Griwes
  • 8,805
  • 2
  • 43
  • 70
3
votes
1 answer

creating Linux i386 a.out executable shorter than 4097 bytes

I'm trying to create a Linux i386 a.out executable shorter than 4097 bytes, but all my efforts have failed so far. I'm compiling it with: $ nasm -O0 -f bin -o prog prog.nasm && chmod +x prog I'm testing it in a Ubuntu 10.04 i386 VM running Linux…
pts
  • 80,836
  • 20
  • 110
  • 183
3
votes
1 answer

Magic value collision between MachO fat binaries and Java class files

Both Java .class files and Mach-O fat binaries have the same magic signature, 0xCAFEBABE. When reading binary files, what's a good way to disambiguate?
Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281
1
2 3