[...@gnu-6 foo]$ cat x.c 
extern int x;

int *
foo ()
{
  return &x;
}
[...@gnu-6 foo]$ cat y.c
int x = 2;

extern int * foo ();

int
_start ()
{
 int *p = foo ();
 return *p;
}

[...@gnu-6 foo]$ cat foo.t
ENTRY(_start)
SECTIONS
{
  .text : {*(.text)}
  .data : {*(.data)}
  /DISCARD/ : {*(*)}
}
[...@gnu-6 foo]$ make
gcc -fPIC   -c -o x.o x.c
gcc -fPIC   -c -o y.o y.c
./ld -T foo.t -o foo  x.o y.o
make: *** [foo] Segmentation fault
make: *** Deleting file `foo'
[...@gnu-6 foo]$

-- 
           Summary: Linker crash to discarded output sections
           Product: binutils
           Version: 2.21 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: hjl dot tools at gmail dot com
                CC: bug-binutils at gnu dot org


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

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

Reply via email to