This is the mail archive of the gcc@gcc.gnu.org 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]

Re: section placement q


Artur Skawina wrote:
> > So during the scope of the __strings__ attribute, the old (".rodata")
> > section identifier is stacked and replaced with ".some_string_section".
> 
> But would this really solve the problem? Yes, it could reduce the
> ugliness a bit, but is potentialy dangerous. As you still have to
> make sure no "local" strings are used later, i'm not convinced this
> is actually an improvement over the conservative approach.

A much more thorough approach, without the danger and still with
sharing, is to have the linker optimise, à la -ffunction-sections
-fdata-sections.  But extend the linker's gc-sections to do something
like: put section .S in .init.S unless anybody from outside .init*
references the section.

There's probably a way to do that with the existing linker and multiple
link stages.

That would even mean you wouldn't have to type "__init" before each
function of the appropriate kind.  You'd only use it for the few things
that are referenced by non-init but should be discarded after anyway.

-- Jamie

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