Launchpad has imported 9 comments from the remote bug at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65612.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2015-03-27T18:26:08+00:00 Hjl-tools wrote:

On Linux/x86, r221732 gave

FAIL: g++.dg/ext/mv14.C  -std=gnu++11 execution test
FAIL: g++.dg/ext/mv14.C  -std=gnu++14 execution test
FAIL: g++.dg/ext/mv14.C  -std=gnu++98 execution test
FAIL: g++.dg/ext/mv15.C  -std=gnu++11 execution test
FAIL: g++.dg/ext/mv15.C  -std=gnu++14 execution test
FAIL: g++.dg/ext/mv15.C  -std=gnu++98 execution test
FAIL: g++.dg/ext/mv1.C  -std=gnu++11 execution test
FAIL: g++.dg/ext/mv1.C  -std=gnu++14 execution test
FAIL: g++.dg/ext/mv1.C  -std=gnu++98 execution test

when compiled with -fPIE -pie.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1568899/comments/0

------------------------------------------------------------------------
On 2015-03-29T19:29:53+00:00 Ubizjak wrote:

I don't think the compiler is at fault here.

Tracing the executable, I got:

Breakpoint 1, 0x0000555555554780 in __cpu_indicator_init@plt ()
(gdb) disass
Dump of assembler code for function __cpu_indicator_init@plt:
=> 0x0000555555554780 <+0>:     jmpq   *0x2018ba(%rip)        # 0x555555756040 
<[email protected]>
   0x0000555555554786 <+6>:     pushq  $0x4
   0x000055555555478b <+11>:    jmpq   0x555555554720
End of assembler dump.
(gdb) p/x *0x555555756040
$1 = 0x786

(gdb) si
0x0000000000000786 in ?? ()

Some kind of fixup is missing for [email protected] value.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1568899/comments/1

------------------------------------------------------------------------
On 2015-03-29T19:57:51+00:00 Hjl-tools wrote:

(gdb) bt
#0  0x0000000000000706 in ?? ()
#1  0x0000555555554b69 in foo ()
    at /export/gnu/import/git/gcc/gcc/testsuite/g++.dg/ext/mv1.C:32
#2  0x00007ffff7de76b8 in _dl_relocate_object ()
   from /lib64/ld-linux-x86-64.so.2
#3  0x00007ffff7ddea4a in dl_main () from /lib64/ld-linux-x86-64.so.2
#4  0x00007ffff7df28d5 in _dl_sysdep_start () from /lib64/ld-linux-x86-64.so.2
#5  0x00007ffff7ddfce1 in _dl_start () from /lib64/ld-linux-x86-64.so.2
#6  0x00007ffff7ddbcd8 in _start () from /lib64/ld-linux-x86-64.so.2
#7  0x0000000000000001 in ?? ()
#8  0x00007fffffffe18d in ?? ()
#9  0x0000000000000000 in ?? ()
(gdb) f 1
#1  0x0000555555554b69 in foo ()
    at /export/gnu/import/git/gcc/gcc/testsuite/g++.dg/ext/mv1.C:32
32      int (*p)() = &foo;
(gdb) disass
Dump of assembler code for function _Z3foov.resolver(void):
   0x0000555555554b60 <+0>:     sub    $0x8,%rsp
   0x0000555555554b64 <+4>:     callq  0x555555554700 <__cpu_indicator_init@plt>
=> 0x0000555555554b69 <+9>:     mov    0x200740(%rip),%rsi        # 
0x5555557552b0
   0x0000555555554b70 <+16>:    mov    0xc(%rsi),%edx
   0x0000555555554b73 <+19>:    mov    %edx,%eax
   0x0000555555554b75 <+21>:    mov    %edx,%ecx
   0x0000555555554b77 <+23>:    and    $0x400,%eax
   0x0000555555554b7c <+28>:    and    $0x40,%ecx
   0x0000555555554b7f <+31>:    cmp    %ecx,%eax
   0x0000555555554b81 <+33>:    cmovg  %ecx,%eax
   0x0000555555554b84 <+36>:    test   %eax,%eax
   0x0000555555554b86 <+38>:    jle    0x555555554b98 
<_Z3foov.resolver(void)+56>
   0x0000555555554b88 <+40>:    lea    -0xbf(%rip),%rax        # 0x555555554ad0 
<_Z3foov.avx2_ssse3>
   0x0000555555554b8f <+47>:    add    $0x8,%rsp
   0x0000555555554b93 <+51>:    retq   
   0x0000555555554b94 <+52>:    nopl   0x0(%rax)
   0x0000555555554b98 <+56>:    cmpl   $0x8,0x8(%rsi)
   0x0000555555554b9c <+60>:    jne    0x555555554bb0 
<_Z3foov.resolver(void)+80---Type <return> to continue, or q <return> to 
quit---q
Quit
(gdb) disass 0x0000555555554700,+16
Dump of assembler code from 0x555555554700 to 0x555555554710:
   0x0000555555554700 <__cpu_indicator_init@plt+0>:     jmpq   *0x200be2(%rip)  
      # 0x5555557552e8 <[email protected]>
   0x0000555555554706 <__cpu_indicator_init@plt+6>:     pushq  $0x2
   0x000055555555470b <__cpu_indicator_init@plt+11>:    jmpq   0x5555555546c0
End of assembler dump.
(gdb) 

We can't call __cpu_indicator_init in PIE while PIE is being relocated.
Its .got.plt section hasn't been updated.  It works for non-PIE since
no update on .got.plt section is required.  Can we move __cpu_indicator_init
to main executable?

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1568899/comments/2

------------------------------------------------------------------------
On 2015-03-29T20:11:58+00:00 Hjl-tools wrote:

Created attachment 35173
A patch to move __cpu_indicator_init

This patch is incomplete.  We need to handle backward compatibility
as well as versioned functions in shared library.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1568899/comments/3

------------------------------------------------------------------------
On 2015-03-29T20:51:36+00:00 Hjl-tools wrote:

Created attachment 35175
A patch to add __cpu_indicator_init to libgcc.a

This patch adds _cpu_indicator_init to libgcc.a and hides
it from linker with backward binary compatibility.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1568899/comments/4

------------------------------------------------------------------------
On 2015-03-30T02:24:16+00:00 Hjl-tools wrote:

Created attachment 35176
A testcase with DSO

[hjl@gnu-tools-1 pr65612]$ make
g++ -O2    -c -o main.o main.cc
g++ -shared -fPIC -O2  -o libmv20.so mv20.cc
g++ -O2  -o x main.o libmv20.so -Wl,-R,.
./x
Makefile:8: recipe for target 'all' failed
make: *** [all] Segmentation fault (core dumped)
[hjl@gnu-tools-1 pr65612]$

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1568899/comments/5

------------------------------------------------------------------------
On 2015-03-30T22:35:34+00:00 Hjl-tools wrote:

A patch is posted at

https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01598.html

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1568899/comments/6

------------------------------------------------------------------------
On 2015-04-17T12:58:39+00:00 Hjl-0 wrote:

Author: hjl
Date: Fri Apr 17 12:58:07 2015
New Revision: 222178

URL: https://gcc.gnu.org/viewcvs?rev=222178&root=gcc&view=rev
Log:
Hide __cpu_indicator_init/__cpu_model from linker

We shouldn't call external function, __cpu_indicator_init, while an object
is being relocated since its .got.plt section hasn't been updated.  It
works for non-PIE since no update on .got.plt section is required.  This
patch creates libgcc.so as a linker script, hides __cpu_indicator_init
and __cpu_model in libgcc.so.1 from linker, forces linker to resolve
__cpu_indicator_init and __cpu_model to their hidden definitions in
libgcc.a while providing backward binary compatibility.

gcc/testsuite/

        PR target/65612
        * g++.dg/ext/mv18.C: New test.
        * g++.dg/ext/mv19.C: Likewise.
        * g++.dg/ext/mv20.C: Likewise.
        * g++.dg/ext/mv21.C: Likewise.
        * g++.dg/ext/mv22.C: Likewise.
        * g++.dg/ext/mv23.C: Likewise.

libgcc/

        PR target/65612
        * config.host (tmake_file): Add t-slibgcc-libgcc for Linux/x86.
        * config/i386/cpuinfo.c (__cpu_model): Initialize.
        (__cpu_indicator_init@GCC_4.8.0): New.
        (__cpu_model@GCC_4.8.0): Likewise.
        * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Add
        -DUSE_ELF_SYMVER.

Added:
    trunk/gcc/testsuite/g++.dg/ext/mv18.C
    trunk/gcc/testsuite/g++.dg/ext/mv19.C
    trunk/gcc/testsuite/g++.dg/ext/mv20.C
    trunk/gcc/testsuite/g++.dg/ext/mv21.C
    trunk/gcc/testsuite/g++.dg/ext/mv22.C
    trunk/gcc/testsuite/g++.dg/ext/mv23.C
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libgcc/ChangeLog
    trunk/libgcc/config.host
    trunk/libgcc/config/i386/cpuinfo.c
    trunk/libgcc/config/i386/t-linux

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1568899/comments/7

------------------------------------------------------------------------
On 2015-04-17T13:37:16+00:00 Hjl-tools wrote:

Fixed for 6.0.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1568899/comments/8


** Changed in: gcc
       Status: Unknown => Fix Released

** Changed in: gcc
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1568899

Title:
  ld: a.out: hidden symbol `__cpu_model' in /usr/lib/gcc/x86_64-linux-
  gnu/5/libgcc.a(cpuinfo.o) is referenced by DSO

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/1568899/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to