public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dave Korn <dave.korn.cygwin@googlemail.com>
To: Mohamed Shafi <shafitvm@gmail.com>
Cc: GCC <gcc@gcc.gnu.org>
Subject: Re: Output sections
Date: Sat, 18 Jul 2009 11:48:00 -0000	[thread overview]
Message-ID: <4A61B97A.7030009@gmail.com> (raw)
In-Reply-To: <ba0bd44d0907180149s2f135eccp4be437f1f34351e2@mail.gmail.com>

Mohamed Shafi wrote:
> Hello all,
> 
> Is it possible to emit a assembler directive at the end of each sections?
> Say like section_end
> Is there any support for doing something like this in the back-end files?
> Or should i need to the make changes in the gcc sources?
> Is so do does anyone know in which function it should happen?

  There isn't really such a concept as 'end of a section' until you get to
final-link time and get all the contributions from different .o files to a
given section.  During assembler output GCC treats sections as random access,
switching freely from one to another and back; it doesn't have any concept of
starting/stopping/opening/closing a section but just jumps into any one it
likes completely ad-hoc.

  Assuming you're happy with adding something to the end of each section in
each generated .s file, you could use the TARGET_ASM_FILE_END hook to output
directives that re-enter each used section and then output your new directive.
 You may find it hard to know which sections have been used or not in a given
file - you can define TARGET_ASM_NAMED_SECTION and make a note of which
sections get invoked there, but I'm not sure if that gets called for all
sections e.g. init/fini, you may have to try it and see.

    cheers,
      DaveK

  reply	other threads:[~2009-07-18 11:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-18  8:49 Mohamed Shafi
2009-07-18 11:48 ` Dave Korn [this message]
2009-07-31 13:42   ` Mohamed Shafi
2009-08-01  6:24     ` Dave Korn
2009-08-01  6:37       ` Mohamed Shafi
2009-08-01  7:08         ` Dave Korn
2009-08-01  8:02           ` Mohamed Shafi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A61B97A.7030009@gmail.com \
    --to=dave.korn.cygwin@googlemail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=shafitvm@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).