http://sourceware.org/bugzilla/show_bug.cgi?id=15534

            Bug ID: 15534
           Summary: ld breaks malloc when -fPIE -pie is used on solaris
                    sparcs
           Product: binutils
           Version: 2.23
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: jullien at eligis dot com

using pie on solaris 10 sparc breaks malloc (malloc returns 0 NOMEM):

Using gcc 4.8 and all recent gnu tools compiled with:
../configure \
    --with-gnu-as    --with-as=/usr/local/bin/as \
    --with-gnu-ld    --with-ld=/usr/local/bin/ld \
    --enable-shared                              \
    --disable-nls                                \
    --enable-languages=c,c++

on good old UltraSparc 10 having 512Mb of mem gives me a malloc error using
this simple test:

#include <stdlib.h>
#include <stdio.h>
int
main()
{
  printf("malloc %p\n", malloc(100));
}

$ gcc -o foo -fPIE -pie foo.c && ./foo
malloc 0
$ gcc -o foo foo.c && ./foo
malloc 20918

Standard solaris ld, silently ignores pie request and program works well.

Two acceptable solutions I see:
- raise an error, "ld does not support pie on this architecture"
- silently ignore pie as does solaris sparc ld

You can read http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57409 which is related
to this issue.

Thank you for your attention

Christian

-- 
You are receiving this mail because:
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to