Subject: Re: Adding Multiboot support (or not)
To: None <tech-kern@netbsd.org, port-i386@netbsd.org>
From: Pavel Cahyna <pavel.cahyna@st.mff.cuni.cz>
List: tech-kern
Date: 02/14/2006 20:30:42
On Mon, Feb 13, 2006 at 05:49:38PM +0000, Nick Hudson wrote:
> On Sunday 12 February 2006 04:38, Jason Thorpe wrote:
> > On Feb 11, 2006, at 1:30 PM, Pavel Cahyna wrote:
> > > In my case it won't, unless I add an explicit statement for .rodata:
> >
> > Right, this is a bug in ld(1).
>
> Does this fix it?
With your patch and all references to .rodata commented out in the
ldscript, the kernel links as needed.
With the Jason's original suggestion, it works too. Thanks!
script#1:
ENTRY(KERNEL_BASE_phys)
SECTIONS
{
KERNEL_BASE_phys = 0x00100000;
KERNEL_BASE_virt = 0xc0100000;
/* Read-only sections, merged into text segment: */
.text (KERNEL_BASE_virt) :
AT (KERNEL_BASE_phys)
{
*(.text)
*(.text.*)
*(.stub)
/* *(.rodata) */
} =0
/* .rodata :
AT (LOADADDR(.text) + (ADDR(.rodata) - ADDR(.text)))
{
*(.rodata)
} */
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
/* Align the data segment to start on a page boundary. */
. = ALIGN(0x1000);
.data :
AT (LOADADDR(.text) + (ADDR(.data) - ADDR(.text)))
{
__data_start = . ;
*(.data)
*(.data.*)
}
PROVIDE (_edata = .);
PROVIDE (edata = .);
__bss_start = . ;
.bss :
AT (LOADADDR(.text) + (ADDR(.bss) - ADDR(.text)))
{
*(.bss)
*(.bss.*)
*(COMMON)
. = ALIGN(32 / 8);
}
. = ALIGN(32 / 8);
PROVIDE (_end = .) ;
PROVIDE (end = .) ;
}
result#1:
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x001000 0xc0100000 0x00100000 0x642413 0x642413 R E 0x1000
LOAD 0x644000 0xc0743000 0x00743000 0x43610 0x91b74 RW 0x1000
Section to Segment mapping:
Segment Sections...
00 .text .rodata .rodata.str1.1 .rodata.str1.32 link_set_malloc_types link_set_ieee80211_funcs link_set_sysctl_funcs link_set_domains link_set_pools link_set_vfsops link_set_vfs_hooks link_set_evcnts link_set_dkwedge_methods link_set_bufq_strats .rodata.str1.4
01 .data .bss
script#2:
ENTRY(KERNEL_BASE_phys)
SECTIONS
{
KERNEL_BASE_phys = 0x00100000;
KERNEL_BASE_virt = 0xc0100000;
/* Read-only sections, merged into text segment: */
.text (KERNEL_BASE_virt) :
AT (KERNEL_BASE_phys)
{
*(.text)
*(.text.*)
*(.stub)
*(.rodata)
} =0
/* .rodata :
AT (LOADADDR(.text) + (ADDR(.rodata) - ADDR(.text)))
{
*(.rodata)
} */
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
/* Align the data segment to start on a page boundary. */
. = ALIGN(0x1000);
.data :
AT (LOADADDR(.text) + (ADDR(.data) - ADDR(.text)))
{
__data_start = . ;
*(.data)
*(.data.*)
}
PROVIDE (_edata = .);
PROVIDE (edata = .);
__bss_start = . ;
.bss :
AT (LOADADDR(.text) + (ADDR(.bss) - ADDR(.text)))
{
*(.bss)
*(.bss.*)
*(COMMON)
. = ALIGN(32 / 8);
}
. = ALIGN(32 / 8);
PROVIDE (_end = .) ;
PROVIDE (end = .) ;
}
result#2:
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x001000 0xc0100000 0x00100000 0x6423f3 0x6423f3 R E 0x1000
LOAD 0x644000 0xc0743000 0x00743000 0x43610 0x91b74 RW 0x1000
Section to Segment mapping:
Segment Sections...
00 .text .rodata.str1.1 .rodata.str1.32 link_set_malloc_types link_set_ieee80211_funcs link_set_sysctl_funcs link_set_domains link_set_pools link_set_vfsops link_set_vfs_hooks link_set_evcnts link_set_dkwedge_methods link_set_bufq_strats .rodata.str1.4
01 .data .bss
Pavel