This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Section Anchors and named sections
David Edelsohn <dje@watson.ibm.com> writes:
> Instead of creating a new hook, this new patch splits out the
> alignment computation from assemble_variable() and applies it to DECLs
> before calculating section information for section anchor blocks. Then
> sections that either are flagged as SECTION_NOSWITCH or SECTION_NAMED are
> excluded from blocks. If a unique section name was not applied, the
> section anchor method is allowed to proceed.
I didn't quite follow the explanation in your original message, sorry.
Could you give a quick example of the kind of situation you mean?
(I got the impression that all the code-related details were in
your message, but I couldn't quite piece them together without
a testcase.)
The alignment-related parts of your patch looked plausible,
but because I didn't really understand what the problem was,
I can't really comment on them yet. This part:
> Then sections that either are flagged as SECTION_NOSWITCH or
> SECTION_NAMED are excluded from blocks.
isn't right though. We definitely want to handle named sections,
and the decision to allow them was very much a deliberate one.
You were talking about unique sections earlier, but having a
SECTION_NAMED section does not imply anything about uniqueness.
SECTION_UNNAMED and SECTION_NAMED are only supposed to control how
the section statement is printed; the former uses a special callback,
while the latter uses the general named_section hook. They aren't
supposed to say anything else about the section.
For ELF, where all sections are declared in the same way, there's no
real need for SECTION_UNNAMED at all. Many of the standard sections
(such as .data.rel* family) are handled as SECTION_NAMED already.
As a cleanup, we should probably get rid of *_SECTION_ASM_OPs for
ELF-only targets, and use SECTION_NAMED for everything.
Richard