Project

General

Profile

Actions

Bug #10102

closed

incorrect ld scripts for x86 test programs

Added by Sergey Smolov almost 5 years ago. Updated over 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 #1

Updated by Sergey Smolov almost 5 years ago

  • Assignee set to Alexander Kamkin
Actions #2

Updated by Alexander Kamkin almost 5 years ago

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

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.
Actions #3

Updated by Sergey Smolov almost 5 years ago

  • Status changed from Resolved to Verified
Actions #4

Updated by Alexander Protsenko over 1 year ago

  • Status changed from Verified to Closed
Actions

Also available in: Atom PDF