This is the mail archive of the
mailing list for the binutils project.
Re: FRV and Blackfin PT_GNU_STACK
- From: "Jie Zhang" <jzhang918 at gmail dot com>
- To: binutils at sourceware dot org, "Dave Brolley" <brolley at redhat dot com>, "Alexandre Oliva" <aoliva at redhat dot com>, "Jie Zhang" <jie dot zhang at analog dot com>, "Bernd Schmidt" <bernd dot schmidt at analog dot com>
- Date: Tue, 20 Jun 2006 17:01:40 +0800
- Subject: Re: FRV and Blackfin PT_GNU_STACK
- References: <20060619155936.GC13901@bubble.grove.modra.org>
On 6/19/06, Alan Modra <firstname.lastname@example.org> wrote:
[Replying from my ADI address failed. So I use my Gmail account. ]
When testing SIZEOF_HEADERS relaxation, I noticed that a fix in
http://sources.redhat.com/ml/binutils/2006-05/msg00318.html for PT_NOTE
p_memsz broke PT_GNU_STACK p_memsz for frv and bfin. To get this field
set, these ports create an output .stack section with the desired stack
size (and alignment) and tack it on to the PT_GNU_STACK header using
elf_backend_modify_segment_map. It's very much a hack, since you're not
supposed to create sections like this in the output bfd. One
consequence is that the .stack section header doesn't get its type
correct (you'd expect NOBITS) or size set (which is fortunate in a way,
because otherwise you'd end up with a large useless PROGBITS section in
the object file).
The question I have is this: Do you want a .stack section in the output
file? Or should this section really be attached as an input section
that extends the .bss output section? Or do without the section
entirely and just magically tweak PT_GNU_STACK?
From the code of binfmt_elf_fdpic.c in linux kernel, it seems the
.stack section is not needed. The kernel gets the stack size for the
FDPIC ELF application is from p_memsz of the PT_GNU_STACK segment.
I'm not sure if my thought is right on why a .stack section is used
here, since I'm not the original writer of the code. The .stack
section is used to help set the PT_GNU_STACK segment size, since
segment size is calculated by sum up the size of all the sections of
it. If we want to eliminate the use of the section entirely, where can
we magically tweak PT_GNU_STACK? Is there already a hook we can use or
we have to add one?