This is the mail archive of the mailing list for the GCC 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: Output sections

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.


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