https://sourceware.org/bugzilla/show_bug.cgi?id=33408

            Bug ID: 33408
           Summary: Misleading linker error message for R_X86_64_TPOFF32
           Product: binutils
           Version: 2.46 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---
            Target: x86

[hjl@gnu-cfl-3 tls-5]$ cat x.c 
__attribute__ ((tls_model ("local-exec"))) __thread int i;

int *
foo (void)
{
  return &i;
}
[hjl@gnu-cfl-3 tls-5]$ make clean
rm -f *.o foo* *.so
[hjl@gnu-cfl-3 tls-5]$ cat x.c
__attribute__ ((tls_model ("local-exec"))) __thread int i;

int *
foo (void)
{
  return &i;
}
[hjl@gnu-cfl-3 tls-5]$ make
gcc -O2 -fPIC   -c -o x.o x.c
./ld -shared -o libx.so x.o
./ld: x.o: relocation R_X86_64_TPOFF32 against symbol `i' can not be used when
making a shared object; recompile with -fPIC
./ld: failed to set dynamic section sizes: bad value
make: *** [Makefile:30: libx.so] Error 1
[hjl@gnu-cfl-3 tls-5]$ 

This is a programmer's error to use local-exec.  But linker error message is
misleading.

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

Reply via email to