Project

General

Profile

Actions

Bug #10102

closed

incorrect ld scripts for x86 test programs

Added by Sergey Smolov about 4 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
High
Category:
Test Engine
Target version:
Start date:
02/06/2020
Due date:
% Done:

0%

Estimated time:
Detected in build:
master
Platform:
Published in build:

Description

For x86 test programs emulation on QEMU4V, the following approach can be used. Test program should be compiled as bootable drive and run on QEMU4V ("-hda" option). The following linker script should be generated:

SECTIONS
{
    /* The BIOS loads the code from the disk to this location.
     * We must tell that to the linker so that it can properly
     * calculate the addresses of symbols we might jump to.
     */
    . = 0x7c00;
    .text :
    {
        __start = .;
        *(.text)
        /* Place the magic boot bytes at the end of the first 512 sector of the disk. */
        . = 0x1FE;
        SHORT(0xAA55)
    }
}

Now ld scripts look as follows:

ENTRY(_start)
SECTIONS
{
  . = 0x7C00;
  .text : { *(".text")}
  . = 0x8000;
  .data : { *(".data")}
  .bss : { *(".bss COMMON")}
  . = ALIGN(8);
  . = . + 0x10000;
  stack_top = .;
}

Actions

Also available in: Atom PDF