This is the mail archive of the binutils@sources.redhat.com 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]

multiple SECTIONS and/or MEMORY commands


The ld documention (in the Options node) cautions

	Note that specifying a script in this way [as an implicit linker
	script] should only be used to augment the main linker script;
	if you want to use some command that logically can only appear
	once, such as the `SECTIONS' or `MEMORY' command, you must
	replace the default linker script using the `-T' option. 

Is this appearing-only-once thing simply convention, or is there (or might
there be in the future) something in the linker that depends on it?

On the system I work with, there's a natural divide between ordinary
sections and memory regions, like .text/coderes and .data+.bss+etc/datares,
which all programs have, and extra ones (foosec/foosecres) that a program
might define for itself.

So far, I've had the ordinary ones defined in SECTIONS and MEMORY commands
in the default script, and when a particular program needs to, it
*augments* it with a little linker script just containing something like

	MEMORY { foosecres : ORIGIN = 0x0, LENGTH = 32768 }
	SECTIONS { foosec : { *(foosec) } > foosecres }

i.e., I've had these commands appearing more than once, but in context
it seems pretty logical, and to date it seems to work fine.

I'm quite happy to rearrange things so that we replace instead of
augmenting, but, because it will mean an incompatible change to
users' makefiles, I'd like to be sure that it's really necessary.

Thanks,

    John


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