Why the gnu linker option "-oformat binary" puts the ".data" segment at 0x0200000

I am writing some kind of “free” code for the i386 real mode and stumbled upon some strange errors while PXE loads my code:

PXE-E79: NBP is too big to fit in free base memory
PXE-M0F: Exiting Intel Boot Agent.

after reusing my binaries, I highlighted it as having any data or code after

.data

segment marker.

After hexdumping, I found that ld moved instructions to 0x0200000all places.

I am currently creating my flat box using:

ld --oformat binary

Questions:

  • Why lddoes this?

  • Is it parameter specific oformat?

+3
source share
2 answers

1) , , , (, , "2 MiB" 80x86), , script, , -, " , ".

2) , " " ( ).

. script, -, " , ", " , ".

, , - , , , script. " , " script, script .

+1

1-ld script. -v, 2 - oformat 3 - , -z max-page-size = 0x

0x100 0x1000 , 0x500 .

Salu2

0

All Articles