Running a simple test from glibc tests, I bumped into this problem.
The test defines a static TLS variable with an alignement constraint of 4096.
The compiler generates correctly a TPOFF relocation. At the end of the link 
stage,
the relocated value is evaluated to 8 (it should be the TCB size), not taking
care of the alignement constraint.
Here follows the simple test exploiting the bug:


#define AL 4096
struct foo
{
  int i;
} __attribute ((aligned (AL)));

static __thread struct foo f;


int
main (void)
{
  int result = 0;

  int fail = (((unsigned int) &f) & (AL - 1)) != 0;
  printf ("&f = %p %s\n", &f, fail ? "FAIL" : "OK");
  result |= fail;

  return result;
}

-- 
           Summary: Incorrect relocation for TLS variable using LE access
                    model
           Product: binutils
           Version: 2.15
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: carmelo73 at gmail dot com
                CC: bug-binutils at gnu dot org,carmelo73 at gmail dot com
  GCC host triplet: Linux ReadHat Enterprise AS4 - 2.6.9-5ELsmp
GCC target triplet: SH4


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

------- 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