This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: Unreviewed patches


On Tue, Jun 03, 2003 at 04:45:21PM +0200, Jakub Jelinek wrote:
> On Mon, Jun 02, 2003 at 09:12:44PM -0700, H. J. Lu wrote:
> > On Mon, Jun 02, 2003 at 05:58:05PM -0700, Richard Henderson wrote:
> > > On Mon, Jun 02, 2003 at 12:40:40PM -0400, Jakub Jelinek wrote:
> > > > http://sources.redhat.com/ml/binutils/2003-05/msg00741.html
> > > 
> > > Since I think I suggested PT_GNU_STACK in the first place,
> > > I'm a bit biased, but I like this solution.  It's the least
> > > amount of work for the kernel in execing a new application
> > > short of having a dedicated ET_FLAGS bit (which we don't).
> > > 
> > > The patch is ok.
> > > 
> > 
> > I like the proposal. But I don't like the implementation.
> > I'd like to see a generic note section for properties of
> > a relocatable file. I will make a detailed suggestion
> > tomorrow.
> 
> The other are the ET_REL-only sections used to set the default value.
> Here, I don't understand if you want to keep the merged section in the
> binary/libraries or not and why is a generic section with lots of flags
> better than specialized section (I think ld has about the same amount
> of work with both variants).
> 

That is my point. There is not much more extra work. But we use it
to describe other unique properties.

I am enclosing my proposal here.


H.J.
----
I propose an optional property note section, .note.GNU-property, for relocatable files to describe some unique properties which linker has to take into account when processing the input files. The contents of this note section are:

	.section        .note.GNU-property
	.align          2
	.long           .L1 - .L0
	.long           .L3 - .L2
	.long           1
.L0:
	.asciz         "Compiler Vendor"
.L1:
	.align          2
.L2:
	.long		    gFlag (Generic flag)
	.long		    psFlag (Processor specific flag)
.L3:

gFlag and psFlag can be extended in pairs. The current valid bit in gFlag is

#define NT_GNU_EXEC_STACK	(0x1 << 0)

When this bit is set, it indicates that the input relocatable file contains code which requires executable stack.

If a linker supports the optional property note section, it should follow the rules below when processing the relocatable input for generating relocatable file, executable or shared library:

1. Relocatable files without this note section are considered as the NT_GNU_EXEC_STACK bit is set and as needing executable stack.
2. If any input relocatable files have the NT_GNU_EXEC_STACK bit set, a PT_GNU_STACK segment header should be created with PF_R|PF_W|PF_X.
3. If none of input relocatable files have the NT_GNU_EXEC_STACK bit set, a PT_GNU_STACK segment header should be created with PF_R|PF_W.
4. If all input relocatable files don't have this section, no PT_GNU_STACK segment header should be created.
5. The note section should be preserved in the output relocatable file if any input relocatable files have the note section. The NT_GNU_EXEC_STACK should be set if it is set in any input relocatable files.
6. The note section should be removed from the output when generating executable or shared library.



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