Re: RFC: Mark a section to be discarded for DSO and executable

2007-01-09 Thread Rod Evans

H. J. Lu wrote:

With LTO, an object file may contain sections with IL, which
can be discarded when building DSO and executable. Currently we can't
mark such sections with gABI. With GNU linker, we can use a
linker script to discard such sections. But it will be more generic
to make a section to be discarded for DSO and executable in gABI.
In that case, we don't need a special linker script to discard
such sections. Something like

#define SHF_DISCARD 0x800

would work.


We invented:

#define  SHF_EXCLUDE 0x8000

a long time ago, which is applied to some sections within relocatable
objects.  Sections tagged with this flag are removed from any final
object (executables of .so's).

This probably should have followed a SHF_SUNW_ conversion, but this
was invented long before we thought about OS specific flags.



 SHF_EXCLUDE

This section is excluded from input to the link-edit of an executable
or shared object. This flag is ignored if the SHF_ALLOC flag is also
set, or if relocations exist against the section.

--

Rod.


Re: RFC: Mark a section to be discarded for DSO and executable

2007-01-09 Thread Rod Evans

Lu, Hongjiu wrote:


It looks like SHF_EXCLUDE is exactly what I am looking for. How useful
is it in your experiences?


As far as I can tell, this was introduced with the SYSTEM V APPLICATION
BINARY INTERFACE for the PowerPC Processor Supplement back in
September 1995 :-)

Then the Fortran folks got a hold of it for adding some specific sections
that they didn't want added to the final output file.

Whether it's being used today by any of our compiler components I don't
know.  I'll put some feelers out.

--

Rod.


Re: RFC: Mark a section to be discarded for DSO and executable

2007-01-09 Thread Rod Evans

Rod Evans wrote:

Lu, Hongjiu wrote:


It looks like SHF_EXCLUDE is exactly what I am looking for. How useful
is it in your experiences?


As far as I can tell, this was introduced with the SYSTEM V APPLICATION
BINARY INTERFACE for the PowerPC Processor Supplement back in
September 1995 :-)

Then the Fortran folks got a hold of it for adding some specific sections
that they didn't want added to the final output file.

Whether it's being used today by any of our compiler components I don't
know.  I'll put some feelers out.


Our compiler folks tell me that they can create optimization (.annotate)
sections that are used during the compilation process, but are expected
to be excluded from the final executable or shared object, and that these
sections are being tagged SHF_EXCLUDE.


--

Rod.