multiple SECTIONS and/or MEMORY commands

Alan Modra amodra@bigpond.net.au
Mon Oct 29 19:24:00 GMT 2001


On Mon, Oct 29, 2001 at 09:45:04PM +0000, John Marshall wrote:
> 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?

There may have been some such restriction in the past, but looking at
ldgram.y, I see no reason why you can't have multiple MEMORY or SECTIONS
commands.  If there is a contradiction between ld.texinfo and ldgram.y,
ldgram.y is the definitive source. ;-)

Alan



More information about the Binutils mailing list