bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/22978] New: [2.30, 2.31 Regression]


From: danglin at gcc dot gnu.org
Subject: [Bug ld/22978] New: [2.30, 2.31 Regression]
Date: Sun, 18 Mar 2018 14:19:05 +0000

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

            Bug ID: 22978
           Summary: [2.30, 2.31 Regression]
           Product: binutils
           Version: 2.31 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: danglin at gcc dot gnu.org
  Target Milestone: ---

The run_ld.c test from gcc is incorrectly linked using binutils 2.30 and later
with -pie.

/* { dg-do run } */
/* { dg-require-effective-target tls_runtime } */
/* { dg-add-options tls } */

extern void abort (void);

__thread int tls_ld __attribute__((tls_model("local-dynamic"))) = 1;
__thread int tls_ld2 __attribute__((tls_model("local-dynamic"))) = 2;

int get_ld (void)
{
  return tls_ld + tls_ld2;
}

int *get_ldp (void)
{
  return &tls_ld;
}

int main (void)
{
  int val;

  val = get_ld ();
  if (val != 1 + 2)
    abort ();

  val = *get_ldp ();
  if (val != 1)
    abort ();

  return 0;
}

Executing on host: /home/dave/gnu/gcc/objdir/gcc/xgcc
-B/home/dave/gnu/gcc/objdi
r/gcc/ /home/dave/gnu/gcc/gcc/gcc/testsuite/gcc.dg/torture/tls/run-ld.c    
-fno
-diagnostics-show-caret -fdiagnostics-color=never    -O0  -pie -fPIE   -ansi
-pe
dantic-errors  -lm  -o ./run-ld.exe    (timeout = 300)
spawn -ignore SIGHUP /home/dave/gnu/gcc/objdir/gcc/xgcc
-B/home/dave/gnu/gcc/obj
dir/gcc/ /home/dave/gnu/gcc/gcc/gcc/testsuite/gcc.dg/torture/tls/run-ld.c
-fno-d
iagnostics-show-caret -fdiagnostics-color=never -O0 -pie -fPIE -ansi
-pedantic-e
rrors -lm -o ./run-ld.exe
PASS: gcc.dg/torture/tls/run-ld.c   -O0  -pie -fPIE  (test for excess errors)
Setting LD_LIBRARY_PATH to
:/home/dave/gnu/gcc/objdir/gcc:/home/dave/gnu/gcc/obj
dir/hppa-linux-gnu/./libatomic/.libs::/home/dave/gnu/gcc/objdir/gcc:/home/dave/g
nu/gcc/objdir/hppa-linux-gnu/./libatomic/.libs:/home/dave/gnu/gcc/objdir/hppa-li
nux-gnu/libstdc++-v3/src/.libs:/home/dave/gnu/gcc/objdir/hppa-linux-gnu/libssp/.
libs:/home/dave/gnu/gcc/objdir/hppa-linux-gnu/libgomp/.libs:/home/dave/gnu/gcc/o
bjdir/hppa-linux-gnu/libatomic/.libs:/home/dave/gnu/gcc/objdir/./gcc:/home/dave/
gnu/gcc/objdir/./prev-gcc:/home/dave/gnu/gcc/objdir/hppa-linux-gnu/libstdc++-v3/
src/.libs:/home/dave/gnu/gcc/objdir/hppa-linux-gnu/libssp/.libs:/home/dave/gnu/g
cc/objdir/hppa-linux-gnu/libgomp/.libs:/home/dave/gnu/gcc/objdir/hppa-linux-gnu/
libatomic/.libs:/home/dave/gnu/gcc/objdir/./gcc:/home/dave/gnu/gcc/objdir/./prev
-gcc
Execution timeout is: 300
spawn [open ...]
FAIL: gcc.dg/torture/tls/run-ld.c   -O0  -pie -fPIE  execution test

Typical link command is:

/home/dave/gnu/binutils/objdir/ld/ld-new -plugin
/home/dave/gnu/gcc/objdir/gcc/liblto_plugin.so
-plugin-opt=/home/dave/gnu/gcc/objdir/gcc/lto-wrapper
-plugin-opt=-fresolution=run-ld.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id
--eh-frame-hdr -dynamic-linker /lib/ld.so.1  -o ./run-ld.exe
/usr/lib/hppa-linux-gnu/Scrt1.o /usr/lib/hppa-linux-gnu/crti.o
/home/dave/gnu/gcc/objdir/gcc/crtbeginS.o -L/home/dave/gnu/gcc/objdir/gcc
-L/lib/hppa-linux-gnu -L/usr/lib/hppa-linux-gnu run-ld.o -lm -v -lgcc
--as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/home/dave/gnu/gcc/objdir/gcc/crtendS.o /usr/lib/hppa-linux-gnu/crtn.o -pie

As far as I can tell, the tls_ld and tls_ld2 variables are not linked
correctly.
When it is linked correctly, I see the following:

Breakpoint 1, __GI___tls_get_addr (ti=0x41001214) at dl-tls.c:825
825     dl-tls.c: No such file or directory.
(gdb) x/2x $r26
0x41001214:     0x00000001      0x00000000
(gdb) c
Continuing.

Breakpoint 1, __GI___tls_get_addr (ti=0x41001200) at dl-tls.c:825
825     in dl-tls.c
(gdb) x/2x $r26
0x41001200:     0x00000001      0x00000004

With Debian 2.30, I see:

Starting program: /home/dave/gnu/gcc/objdir/gcc/testsuite/gcc/run-ld.exe

Breakpoint 1, __GI___tls_get_addr (ti=0x4100121c) at dl-tls.c:825
825     dl-tls.c: No such file or directory.
(gdb) x/2x $r26
0x4100121c:     0x00000001      0x00000000
(gdb) c
Continuing.

Breakpoint 1, __GI___tls_get_addr (ti=0x41001208) at dl-tls.c:825
825     in dl-tls.c
(gdb) x/2x $r26
0x41001208:     0x00000001      0x00000000

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]