This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold] PR gold/18048 Patch to support non-toplevel and nesting INCLUDE
- From: HÃn ShÄn (ææ) <shenhan at google dot com>
- To: Cary Coutant <ccoutant at google dot com>
- Cc: binutils <binutils at sourceware dot org>, Doug Kwan <dougkwan at google dot com>, Jing Yu <jingyu at google dot com>, c-compiler-chrome <c-compiler-chrome at google dot com>
- Date: Tue, 3 Mar 2015 19:47:58 -0800
- Subject: Re: [gold] PR gold/18048 Patch to support non-toplevel and nesting INCLUDE
- Authentication-results: sourceware.org; auth=none
- References: <CACkGtrhJCrzWxDetpA8L8i87nHMfqQSeGP5pOVEKKpJ_5c=d5A at mail dot gmail dot com> <CAHACq4q0kuYKDv1omz2Mp0Gf+qcac8D+OS8NmGM10iXpeMYD7g at mail dot gmail dot com>
HI Cary, thanks, that's great! (didn't notice you have a quick/good solution).
I'll back-port it to chromeos after your submission.
Thanks,
Han
On Tue, Mar 3, 2015 at 6:23 PM, Cary Coutant <ccoutant@google.com> wrote:
>> Hi here is the patch for PR gold/18048 - gold does not support
>> non-toplevel INCLUDE properly. With this bug, Gold fails to build one
>> particular package (coreboot) of ChromeOs.
>
> Thanks for working on this, but I think it can be much, much, simpler.
>
> All we really need is three new productions at the top level:
>
> top:
> ...
> | PARSING_SECTIONS_BLOCK sections_block
> | PARSING_SECTION_COMMANDS section_cmds
> | PARSING_MEMORY_DEF memory_defs
>
> Then we can just pass a first_token to script_include_directive(), like this:
>
> | INCLUDE string
> { script_include_directive(PARSING_SECTIONS_BLOCK,
> closure, $2.value, $2.length); }
>
> ...and have it pass that on to read_script_file().
>
> I did have to clone the productions for file_or_sections_cmd, because
> the INCLUDE directive there could have meant either
> PARSING_LINKER_SCRIPT or PARSING_SECTIONS_BLOCK, depending on context.
>
> I'll commit the attached patch after I update a few of the script
> tests to exercise INCLUDE directives.
>
> -cary
--
Han Shen | Software Engineer | shenhan@google.com | +1-650-440-3330