This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Code16gcc strings
- From: Raul Hudea <rhudea at develop4all dot com>
- To: binutils at sources dot redhat dot com
- Date: 16 Apr 2002 13:55:02 +0300
- Subject: Code16gcc strings
Hi,
I try to write a small bios using .code16 and .code16gcc.
The problem that I have is that the bios code is loaded at 0xf0000, and
when I want to access the strings from .rodata section, the generated
code is the following one:
xorl %ebx, %ebx # EBX = 0
movzwl %bx, %eax # EAX = 0
movzbl (%eax,%ebp), %eax
^
| %eax is base, and %ebp is index, meaning that it reads from
(%eax+%ebp) = 0 + %ebp instead of 0xf0000 + %ebp.
I want to know if it is possible read the string relative to 0xf0000
instead of 0x0 or to have the code generated in relative locations, not
in absolute ones. Any other ideas or solutions are welcomed.
This is the linker script I use:
MEMORY { rom : ORIGIN = 0x0, LENGTH = 64k }
SECTIONS {
.text 0x0 : AT (0x0) {
*(.text)
. = ALIGN (32);
}
.data 0x0 : AT (0x0)
{
*(.rodata)
*(.rodata.str*)
*(.data)
. = ALIGN (32);
} > rom =0
.bss (NOLOAD) : {
*(.bss) *(COMMON)
. = ALIGN (4);
} > rom = 0
.note (NOLOAD) : {
*(.note)
}
.comment (NOLOAD) : {
*(.comment)
}
.stab (NOLOAD) : {
*(.stab)
}
.stabstr (NOLOAD) : {
*(.stabstr)
}
}
I tried to put AT(0xF0000), but the linker gives me some error like
"relocation truncated to fit: R_386_16" which I don't know what it
means.
But even if it does not link, it still generates the code which is
exactly the above one.
TIA,
Raul.