Unreviewed patches

H. J. Lu hjl@lucon.org
Tue Jun 3 16:48:00 GMT 2003


On Tue, Jun 03, 2003 at 09:15:21AM -0700, Richard Henderson wrote:
> On Tue, Jun 03, 2003 at 09:12:35AM -0700, H. J. Lu wrote:
> > I am enclosing my proposal here.
> 
> This is not a complete proposal.  You don't specify what
> we're supposed to do with the other 63 bits that are not
> currently defined.
> 
> 
The linker should refuse processing the input if they are set.

Here is the updated one.


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 number of gFlag/psFlag pairs is 1. 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.

The remaining bits in gFlag and psFlag are reserved.

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. If the number of gFlag/psFlag pairs is not 1 or any reserved bits in the note section in an input relocatable file are set, the linker should refuse processing the input file.
7. The note section should be removed from the output when generating executable or shared library.




More information about the Binutils mailing list