Project

General

Profile

Bug #10102

incorrect ld scripts for x86 test programs

Added by Sergey Smolov 9 months ago. Updated 9 months ago.

Status:
Verified
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 = .;
}

History

#1

Updated by Sergey Smolov 9 months ago

  • Assignee set to Alexander Kamkin
#2

Updated by Alexander Kamkin 9 months ago

  • Target version set to 2.5
  • Status changed from New to Resolved
  • Category set to Test Engine

The following things have been done:

  • Removed the hardcoded suffix .bss ... stack_top = .; from the linker script printer.
  • Added a special section boot, which contains the magic bytes, to x86_base.
#3

Updated by Sergey Smolov 9 months ago

  • Status changed from Resolved to Verified

Also available in: Atom PDF