This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

Re: RFC -- add section alignment/size hooks to gold plugin interface


> 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
> https://dl.acm.org/citation.cfm?id=1152181.
>
> 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
gold/ChangeLog.

- 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
ld_plugin_tag enum:

include/
        * 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
        and LDPT_GET_INPUT_SECTION_SIZE.

>        * 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

gold/
        * testsuite/Makefile.am (plugin_layout_with_alignment): New test.

Also, please update the GCC wiki page with your new interfaces:

   https://gcc.gnu.org/wiki/whopr/driver

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.

-cary


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