Page 1 of 1

set .text section baseaddress

Posted: Sat Aug 25, 2012 11:59 pm
by mordak
hi 8)
i want create new section in c++ and set differnet base Address
for it section is there any way to do it in vc++.
like this

Code: Select all

SECTIONS
{
	. = 0x100000;

	.setup :
	{
		*(.setup)
	}

	. += 0xC0000000;

	.text : AT(ADDR(.text) - 0xC0000000)
	{
		*(.text)
	}

	.data ALIGN (4096) : AT(ADDR(.data) - 0xC0000000)
	{
		*(.data)
		*(.rodata*)
	}

	.bss ALIGN (4096) : AT(ADDR(.bss) - 0xC0000000)
	{
		*(COMMON*)
		*(.bss*)
	}
}


Re: set .text section baseaddress

Posted: Sun Aug 26, 2012 1:01 am
by neon
Hello,

What I see here is two questions: one asking to set the base of .text, the other is asking how to create new sections. Creating new sections is possible (please see next paragraph) but setting a specific location for .text is not... there really isn't any need for it.

The closest thing provided is a pragma extension that can be used for creating sections and section alignment; the actual placement of the sections cannot be set to specific linear addresses as with LD. Also note that it is limited to C linkage of functions. This directive can also be used to define and set section properties that the OS can use when allocating pages for the section.

Re: set .text section baseaddress

Posted: Sun Aug 26, 2012 1:28 am
by mordak
Thank you mike so i must use linker script.