This is the mail archive of the
mailing list for the binutils project.
Re: RFC -- add section alignment/size hooks to gold plugin interface
- From: Cary Coutant <ccoutant at gmail dot com>
- To: Than McIntosh <thanm at google dot com>
- Cc: Binutils <binutils at sourceware dot org>, Han Shen <shenhan at google dot com>, David Li <davidxl at google dot com>, Sriraman Tallam <tmsriram at google dot com>
- Date: Sun, 21 Feb 2016 18:30:21 -0800
- Subject: Re: RFC -- add section alignment/size hooks to gold plugin interface
- Authentication-results: sourceware.org; auth=none
- References: <CA+Ur55F-eMa3-k6qN-7hzehvrYeeyOkMjk6vMYQW+9=Fbf8fzQ at mail dot gmail dot com>
> I would like to enhance the gold linker to support plugins that want to ask
> for the size and alignment requirement of specific input sections. A first
> draft of a patch that implements this is attached; I would welcome any
> questions + comments.
> The motivation for this work is enabling things such as static data layout,
> e.g. reordering of .bss/.data/.rodata sections to reduce padding and/or
> improve cache utilization. There is a paper that talks about this at
> This is my first attempt at contributing to gold, so any pointers on
> process, documentation, testing, etc would be appreciated.
Thanks! This looks good except for a few minor things:
- You generated the diff backwards, so it reads as a reversion of your patch.
- The new files you've added should list just 2016 as the copyright date.
- plugin-api.h is in a separate directory (include) with its own
ChangeLog, so the entry for that should be in include/ChangeLog, not
- ChangeLog and regenerated files like Makefile.in should be omitted
from the patch. It's customary to post the ChangeLog entries above the
patch (and include them in the commit message). If the patch is an
attachment, it's easier for the reviewer if you can also paste the
ChangeLog entries into the plain text of the message itself. Each
block of ChangeLog entries should be preceded by the directory where
the ChangeLog is located (e.g., "include/" or "include/ChangeLog";
"gold/" or "gold/ChangeLog").
- ChangeLog entries should read as complete sentences, starting with a
capital and ending with a period.
> * plugin-api.h: add new hooks to the plugin transfer vector to
> to support querying section alignment and section size
Please list each new hook separately, and separate the change to the
* plugin-api.h (ld_plugin_get_input_section_alignment): New hook.
(ld_plugin_get_input_section_size): New hook.
(ld_plugin_tag): Add LDPT_GET_INPUT_SECTION_ALIGNMENT
> * plugin.cc (Plugin::load): include hooks for get_input_section_size
> and get_input_section_alignment to transfer vector
Please add entries for get_input_section_alignment and
get_input_section_size (each described as "New function").
> * testsuite/Makefile.am: Add plugin_layout_with_alignment.sh test
Rewrite this as
* testsuite/Makefile.am (plugin_layout_with_alignment): New test.
Also, please update the GCC wiki page with your new interfaces:
Since this affects the plugin API used by GCC, you should also include
gcc-patches in the discussion. When this is ready to checkin, you'll
also need to update include/plugin-api.h in the GCC tree as well to
keep them in sync.