public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/65886] [5/6 Regression] Copy reloc in PIE incompatible with DSO created by -Wl,-Bsymbolic
Date: Sat, 25 Apr 2015 17:25:00 -0000	[thread overview]
Message-ID: <bug-65886-4-xZk26btDiQ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65886-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65886

--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to H.J. Lu from comment #5)
>
> BTW, you should add -fsymbolic to -fPIC if the shared library will be
> created by -Bsymbolic.  It will improve shared library performance.

Here is an example:

[hjl@gnu-tools-1 pr65886-lto]$ cat a.c
int a = -1;
[hjl@gnu-tools-1 pr65886-lto]$ cat b.c
extern int a;
void
bar ()
{
  a = 30;
}
[hjl@gnu-tools-1 pr65886-lto]$ vi b.c
[hjl@gnu-tools-1 pr65886-lto]$ cat a.c
int a = -1;
[hjl@gnu-tools-1 pr65886-lto]$ cat b.c
extern int a;
void bar () { a = 30; }
[hjl@gnu-tools-1 pr65886-lto]$ make libb.so
/export/build/gnu/gcc-5/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-5/build-x86_64-linux/gcc/ -g -O2 -fsymbolic -fPIC -flto
  -c -o b.o b.c
/export/build/gnu/gcc-5/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-5/build-x86_64-linux/gcc/ -g -O2 -fsymbolic -fPIC -flto
  -c -o a.o a.c
/export/build/gnu/gcc-5/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-5/build-x86_64-linux/gcc/ -flto -Wl,-Bsymbolic -g -O2
-fsymbolic -shared -o libb.so b.o a.o
[hjl@gnu-tools-1 pr65886-lto]$ gdb libb.so
GNU gdb (GDB) Fedora 7.8.2-38.fc21
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from libb.so...done.
(gdb) disass bar
Dump of assembler code for function bar:
   0x00000000000005e0 <+0>:     movl   $0x1e,0x2002be(%rip)        # 0x2008a8
<a>
   0x00000000000005ea <+10>:    retq   
End of assembler dump.
(gdb)


  parent reply	other threads:[~2015-04-25 17:25 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-25 13:45 [Bug target/65886] New: [5/6 Regression] External reference in PIE to DSO created with -Wl,-Bsymbolic hjl.tools at gmail dot com
2015-04-25 13:46 ` [Bug target/65886] " hjl.tools at gmail dot com
2015-04-25 15:47 ` [Bug target/65886] [5/6 Regression] External reference in PIE incompatible with DSO created by -Wl,-Bsymbolic hjl.tools at gmail dot com
2015-04-25 16:33 ` hjl.tools at gmail dot com
2015-04-25 16:51 ` [Bug target/65886] [5/6 Regression] Copy reloc " thiago at kde dot org
2015-04-25 17:06 ` hjl.tools at gmail dot com
2015-04-25 17:08 ` hjl.tools at gmail dot com
2015-04-25 17:25 ` hjl.tools at gmail dot com [this message]
2015-04-25 17:30 ` thiago at kde dot org
2015-04-25 17:37 ` hjl.tools at gmail dot com
2015-04-25 17:42 ` hjl.tools at gmail dot com
2015-04-27  9:05 ` rguenth at gcc dot gnu.org
2015-04-27 12:14 ` jakub at gcc dot gnu.org
2015-04-27 12:22 ` hjl.tools at gmail dot com
2015-04-27 12:37 ` jakub at gcc dot gnu.org
2015-04-27 12:44 ` hjl.tools at gmail dot com
2015-04-27 13:14 ` hjl.tools at gmail dot com
2015-04-27 13:51 ` jakub at gcc dot gnu.org
2015-04-27 19:18 ` thiago at kde dot org
2015-04-29 19:05 ` hjl.tools at gmail dot com
2015-04-29 19:06 ` hjl.tools at gmail dot com
2015-05-05 15:03 ` thiago at kde dot org
2015-05-05 15:09 ` hjl.tools at gmail dot com
2015-05-05 15:12 ` jakub at gcc dot gnu.org
2015-05-05 15:14 ` jakub at gcc dot gnu.org
2015-05-05 15:38 ` hjl.tools at gmail dot com
2015-05-05 15:47 ` jakub at gcc dot gnu.org
2015-05-05 15:48 ` thiago at kde dot org
2015-05-05 15:54 ` thiago at kde dot org
2015-06-30 10:32 ` rguenth at gcc dot gnu.org
2015-07-16  9:17 ` rguenth at gcc dot gnu.org
2015-08-06 18:06 ` thiago at kde dot org
2015-08-06 18:24 ` hjl.tools at gmail dot com
2015-08-06 18:27 ` thiago at kde dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-65886-4-xZk26btDiQ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).