This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Grouping in linker sections


I need to arrange code so that some functions appear at the start of the
image along with all the sections needed to run.  Briefly the idea is that
the first few functions will reread the entire binary out of flash again
with error correction enabled.  The current loader does not provide error
correction and cannot be changed.  The minimum amount of code is going to be
dependent on being read from flash by the loader.  The order of the
remainder of the objects is not important.  The sloe concern is that nothing
executing in the first section (up as far as "_early_init_end") has any
dependency on anything after that point.

Extract of linker script is below.  For now I'm just taking the relevant
sections of each object and bundling them together (so one object's .data
section is followed by the next object's .text section).  It's not ideal. 
What I'm trying to do is what is in the comment ("Shorthand") following that
but it's not syntactically correct.  To do this would mean having 4
occurrences of each object (like in the "Longhand" comment).  Is there some
way to group together files in the linker?  Is there another approach more
suited to this use?


Linker script extract:
SECTIONS
{
. = 0x00000000;

. = ALIGN(4);
.text      :
{
	cpu/arm920t/start.o    (.text .rodata)
	board/smdk2410/memsetup.o    (.text .rodata)
	cpu/arm920t/libarm920t.a    (.text .rodata .rodata.str1.4 .data)
	cpu/arm920t/s3c24x0/libs3c24x0.a    (.text .rodata .rodata.str1.4 .data)
	lib_arm/board.o    (.text .rodata .rodata.str1.4 .data)
	board/smdk2410/smdk2410.o    (.text .rodata .rodata.str1.4 .data)
	common/dlmalloc.o    (.text .rodata .rodata.str1.4 .data)
	lib_generic/string.o    (.text .rodata .rodata.str1.4 .data)
	lib_generic/vsprintf.o    (.text .rodata .rodata.str1.4 .data)
	lib_generic/display_options.o    (.text .rodata .rodata.str1.4 .data)
	common/console.o    (.text .rodata .rodata.str1.4 .data)
	board/smdk2410/flash.o    (.text .rodata .rodata.str1.4 .data)
	common/nand_core.o    (.text .rodata .rodata.str1.4 .data)

/*
; Shorthand.
	{
		cpu/arm920t/start.o
		board/smdk2410/memsetup.o
		cpu/arm920t/libarm920t.a
		cpu/arm920t/s3c24x0/libs3c24x0.a
		lib_arm/board.o
		board/smdk2410/smdk2410.o
		common/dlmalloc.o
		lib_generic/string.o
		lib_generic/vsprintf.o
		lib_generic/display_options.o
		common/console.o
		board/smdk2410/flash.o
		common/nand_core.o

	}	(.text .rodata .rodata.str1.4 .data)



; Longhand - Part-of.
	cpu/arm920t/start.o    (.text)
	board/smdk2410/memsetup.o    (.text)
	cpu/arm920t/libarm920t.a    (.text)
	cpu/arm920t/s3c24x0/libs3c24x0.a    (.text)

	cpu/arm920t/start.o    (.rodata)
	board/smdk2410/memsetup.o    (.rodata)
	cpu/arm920t/libarm920t.a    (.rodata)
	cpu/arm920t/s3c24x0/libs3c24x0.a    (.rodata)

	cpu/arm920t/libarm920t.a    (.rodata.str1.4)
	cpu/arm920t/s3c24x0/libs3c24x0.a    (.rodata.str1.4)

	cpu/arm920t/libarm920t.a    (.data)
	cpu/arm920t/s3c24x0/libs3c24x0.a    (.data)

*/

		_early_init_end = .;
/* End of early init code. */

	/* Remainder of code. */
	*(.text)
}

. = ALIGN(4);
.rodata : { *(.rodata) }

. = ALIGN(4);
.data : { *(.data) }

. = ALIGN(4);
.got : { *(.got) }

__u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .;

. = ALIGN(4);
__bss_start = .;
bss : { *(.bss) }
_end = .;
}

-- 
View this message in context: http://www.nabble.com/Grouping-in-linker-sections-tp25823174p25823174.html
Sent from the Sourceware - binutils list mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]