Segfault with -pie on IA64

Jakub Jelinek jakub@redhat.com
Fri Oct 31 09:15:00 GMT 2003


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



More information about the Binutils mailing list