[GOLD Patch] Grammar additions to handle INCLUDE directives

Sterling Augustine saugustine@google.com
Fri Nov 11 20:12:00 GMT 2011


Hi All,

This patch fixes up Gold's grammar so that script_include_directive
gets called whenever a it encounters a syntactically valid INCLUDE
directive.

Gnu.ld accepts the include directive in all of the following locations:

INCLUDE foo
MEMORY
{
	INCLUDE foo
	amemory : ORIGIN = 0, LENGTH = 16
}

SECTIONS
{
	INCLUDE foo
	.asection : { *(.asection)
	    INCLUDE foo
	  }
}

One could implement script_include_directive with a simple call to
read_script_file, but read_script_file doesn't do the directory-search
properly. Fixing the FIXME for relative paths there would be a big
step toward proper support for the INCLUDE directive, because the
semantics for the two cases are the same. It would probably need an
additional parameter though.

Sterling

2011-11-11  Sterling Augustine  <saugustine@google.com>

	* yyscript.y (section_cmd): Add support for INCLUDE directive.
	(file_or_sections_cmd): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: include.patch
Type: text/x-patch
Size: 748 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20111111/4726cc7a/attachment.bin>


More information about the Binutils mailing list