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: Segfault with -pie on IA64


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


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