This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Segfault with -pie on IA64
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Ian Wienand <ianw at gelato dot unsw dot edu dot au>
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 31 Oct 2003 08:11:28 +0100
- Subject: Re: Segfault with -pie on IA64
- References: <20031031044637.GG12478@cse.unsw.EDU.AU>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Oct 31, 2003 at 03:46:37PM +1100, Ian Wienand wrote:
> Hi,
>
> Try
>
> echo "int main(void) { return 1; }" > test.c
> gcc -c test.c
^^^^^^^^^^^^^^^ Bug here. All objects you link into PIEs must contain
position independent code, at least on arches which don't support it
(e.g. IA-32 supports position dependent code in PIEs, at the expense
of DT_TEXTREL, although it is not recommended).
Ie. either -fpie, -fPIE, -fpic or -fPIC.
> ld -pie -o test test.o `gcc --print-file-name crtbegin.o`
^^^^^^^^^^^
another bug here. PIEs should use crtbeginS.o. There are other
crt files you need, so you really should use gcc -pie -o test test.o.
> Segmentation fault
This is linker bug. It shouldn't segfault even on buggy input.
Jakub