http://sourceware.org/bugzilla/show_bug.cgi?id=12928
Summary: Wrong linker relaxation with DTPREL relocation on
alpha
Product: binutils
Version: 2.21
Status: NEW
Severity: normal
Priority: P2
Component: ld
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 5818
--> http://sourceware.org/bugzilla/attachment.cgi?id=5818
Assembly code that fails with enabled linker relaxations
This is a followup from gcc PR 49515 [1].
Attached testcase fails with linker relaxations on alphaev68-pc-linux-gnu:
uros@monolith ~ $ gcc thr-init-2.s
uros@monolith ~ $ ./a.out
a=2 fstat=33554434
Aborted
uros@monolith ~ $ gcc -Wl,--no-relax thr-init-2.s
uros@monolith ~ $ ./a.out
uros@monolith ~ $
ld --version
GNU ld (GNU Binutils) 2.21
Copyright 2010 Free Software Foundation, Inc.
...
But the bug also exists in latest snapshot:
GNU ld (GNU Binutils) 2.21.52.20110623
The c source:
--cut here--
/* { dg-do run } */
/* { dg-require-effective-target tls_runtime } */
/* { dg-add-options tls } */
extern int printf (char *,...);
extern void abort() ;
static __thread int fstat ;
static __thread int fstat = 1;
static __thread int fstat ;
int test_code(int b)
{
fstat += b ;
return fstat;
}
int main (int ac, char *av[])
{
int a = test_code(1);
if ( a != 2 || fstat != 2 )
{
printf ("a=%d fstat=%d\n", a, fstat) ;
abort ();
}
return 0;
}
--cut here--
compiled with -O2 -fpic to produce attached assembly code.
[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49515
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils