diff mbox

PATCH] PR target/65612: Multiversioning doesn't work with DSO nor PIE

Message ID CAJMcOU8xHsE6ZyVSHy90AUgkSpY8FfG53xT+jGO=TALo27ViSA@mail.gmail.com
State New
Headers show

Commit Message

Jack Howarth March 31, 2015, 4:39 p.m. UTC
On Tue, Mar 31, 2015 at 12:14 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Mar 31, 2015 at 9:09 AM, Jack Howarth <howarth.at.gcc@gmail.com> wrote:
>> H.J.,
>>     Did you attach the correct version of the patch? I don't see
>> anything conditional on linux.
>>             Jack
>
> My patch will build and install libgcc_nonshared.a for all targets.  If you
> don't link against it, nothing is changed.  On Linux, it is used via the
> init_spec change.

Isn't...


problematic for Solaris? I am unfamiliar with the Solaris spec
handling but sol2.h doesn't seem to have any instances of -lgcc which
might imply they use the stock compiler invocation which will now have
a non-existent libgcc_nonshared static library.
     Also, are you leaving the cpu symbols in libgcc.a on non-linux
targets? If not, the linkage failure reported in
https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01668.html will occur,
no?
        Jack
>
> --
> H.J.

Comments

H.J. Lu March 31, 2015, 5 p.m. UTC | #1
On Tue, Mar 31, 2015 at 9:39 AM, Jack Howarth <howarth.at.gcc@gmail.com> wrote:
> On Tue, Mar 31, 2015 at 12:14 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Tue, Mar 31, 2015 at 9:09 AM, Jack Howarth <howarth.at.gcc@gmail.com> wrote:
>>> H.J.,
>>>     Did you attach the correct version of the patch? I don't see
>>> anything conditional on linux.
>>>             Jack
>>
>> My patch will build and install libgcc_nonshared.a for all targets.  If you
>> don't link against it, nothing is changed.  On Linux, it is used via the
>> init_spec change.
>
> Isn't...
>
> diff --git a/gcc/gcc.c b/gcc/gcc.c
> index d956c36..3fbd549 100644
> --- a/gcc/gcc.c
> +++ b/gcc/gcc.c
> @@ -1566,6 +1566,7 @@ init_spec (void)
>         if (in_sep && *p == '-' && strncmp (p, "-lgcc", 5) == 0)
>           {
>             init_gcc_specs (&obstack,
> +                           "-lgcc_nonshared "
>                             "-lgcc_s"
>  #ifdef USE_LIBUNWIND_EXCEPTIONS
>                             " -lunwind"
> @@ -1591,6 +1592,7 @@ init_spec (void)
>             /* Ug.  We don't know shared library extensions.  Hope that
>                systems that use this form don't do shared libraries.  */
>             init_gcc_specs (&obstack,
> +                           "libgcc_nonshared.a%s "
>                             "-lgcc_s",
>                             "libgcc.a%s",
>                             "libgcc_eh.a%s"
>
> problematic for Solaris? I am unfamiliar with the Solaris spec
> handling but sol2.h doesn't seem to have any instances of -lgcc which
> might imply they use the stock compiler invocation which will now have
> a non-existent libgcc_nonshared static library.

libgcc_nonshared.a is built and installed for all targets.

>      Also, are you leaving the cpu symbols in libgcc.a on non-linux
> targets? If not, the linkage failure reported in
> https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01668.html will occur,
> no?

My current patch doesn't change what are in libgcc.a.  It
adds libgcc_nonshared.a for all targets, which contains
the same cpuinfo.o as in libgcc.a or a dummy .o if libgcc.a
doesn't have cpuinfo.o.
Jack Howarth March 31, 2015, 6:33 p.m. UTC | #2
On Tue, Mar 31, 2015 at 1:00 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Mar 31, 2015 at 9:39 AM, Jack Howarth <howarth.at.gcc@gmail.com> wrote:
>> On Tue, Mar 31, 2015 at 12:14 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> On Tue, Mar 31, 2015 at 9:09 AM, Jack Howarth <howarth.at.gcc@gmail.com> wrote:
>>>> H.J.,
>>>>     Did you attach the correct version of the patch? I don't see
>>>> anything conditional on linux.
>>>>             Jack
>>>
>>> My patch will build and install libgcc_nonshared.a for all targets.  If you
>>> don't link against it, nothing is changed.  On Linux, it is used via the
>>> init_spec change.
>>
>> Isn't...
>>
>> diff --git a/gcc/gcc.c b/gcc/gcc.c
>> index d956c36..3fbd549 100644
>> --- a/gcc/gcc.c
>> +++ b/gcc/gcc.c
>> @@ -1566,6 +1566,7 @@ init_spec (void)
>>         if (in_sep && *p == '-' && strncmp (p, "-lgcc", 5) == 0)
>>           {
>>             init_gcc_specs (&obstack,
>> +                           "-lgcc_nonshared "
>>                             "-lgcc_s"
>>  #ifdef USE_LIBUNWIND_EXCEPTIONS
>>                             " -lunwind"
>> @@ -1591,6 +1592,7 @@ init_spec (void)
>>             /* Ug.  We don't know shared library extensions.  Hope that
>>                systems that use this form don't do shared libraries.  */
>>             init_gcc_specs (&obstack,
>> +                           "libgcc_nonshared.a%s "
>>                             "-lgcc_s",
>>                             "libgcc.a%s",
>>                             "libgcc_eh.a%s"
>>
>> problematic for Solaris? I am unfamiliar with the Solaris spec
>> handling but sol2.h doesn't seem to have any instances of -lgcc which
>> might imply they use the stock compiler invocation which will now have
>> a non-existent libgcc_nonshared static library.
>
> libgcc_nonshared.a is built and installed for all targets.
>
>>      Also, are you leaving the cpu symbols in libgcc.a on non-linux
>> targets? If not, the linkage failure reported in
>> https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01668.html will occur,
>> no?
>
> My current patch doesn't change what are in libgcc.a.  It
> adds libgcc_nonshared.a for all targets, which contains
> the same cpuinfo.o as in libgcc.a or a dummy .o if libgcc.a
> doesn't have cpuinfo.o.


I can confirm that the most current patch bootstraps on
x86_64-apple-darwin14 and that all of the new tests show up as
unsupported in the test suite.
          Jack

>
> --
> H.J.
diff mbox

Patch

diff --git a/gcc/gcc.c b/gcc/gcc.c
index d956c36..3fbd549 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1566,6 +1566,7 @@  init_spec (void)
        if (in_sep && *p == '-' && strncmp (p, "-lgcc", 5) == 0)
          {
            init_gcc_specs (&obstack,
+                           "-lgcc_nonshared "
                            "-lgcc_s"
 #ifdef USE_LIBUNWIND_EXCEPTIONS
                            " -lunwind"
@@ -1591,6 +1592,7 @@  init_spec (void)
            /* Ug.  We don't know shared library extensions.  Hope that
               systems that use this form don't do shared libraries.  */
            init_gcc_specs (&obstack,
+                           "libgcc_nonshared.a%s "
                            "-lgcc_s",
                            "libgcc.a%s",
                            "libgcc_eh.a%s"