This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [Android] The reason why -Bsymbolic is turned on by default
- From: Andrew Haley <aph at redhat dot com>
- To: Alexander Ivchenko <aivchenk at gmail dot com>
- Cc: gcc <gcc at gcc dot gnu dot org>
- Date: Wed, 03 Apr 2013 10:25:59 +0100
- Subject: Re: [Android] The reason why -Bsymbolic is turned on by default
- References: <CACysShhf84eXKOVLrnB_GxGvPzLwWsGFgR4k4SrYz+UThuqATQ at mail dot gmail dot com>
On 03/29/2013 06:55 PM, Alexander Ivchenko wrote:
> When compiling a shared library with "-mandroid -shared" the option
> -Bsymbolic for linker is turned on by default. What was the reason
> behind that default? Isn't using of -Bsymbolic somehow dangerous and
> should be avoided..?
Yes indeed, -Bsymbolic is dangerous.
> (as e.g. is explained in the mail from Richard
> Henderson http://gcc.gnu.org/ml/gcc/2001-05/msg01551.html).
>
> Since there is no (AFAIK) option like -Bno-symbolic we cannot use
> -fno-pic binary with COPY relocations in it (android dynamic loader
> will throw an error when there is COPY relocation against DT_SYMBOLIC
> library..)
Sure, that's true. If a library is built with -Bsymbolic then you
must build executables PIC. That's just how it is.
As to why Android turned it on by default -- we are not clairvoyant!
:-)
Andrew.