x86: Use sysdep.o from libc.a in static libraries
Commit Message
Fedora needs to relink libpthread.a into a single object file to support
some application needs. Starting with
commit fb1cf108115f7e2e4510859693431b3473657d77
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Oct 13 11:58:53 2015 -0700
Add INLINE_SYSCALL_ERROR_RETURN_VALUE
this prevents static linking due to multiple copies of the functions
from sysdep.o.
The attached patch skips adding sysdep.o for static libraries. Okay to
commit?
(No bug filed because this is a downstream bug only, but dropping the
additional copy of sysdep.o seems to make sense upstream as well.)
Thanks,
Florian
Comments
On 08/04/2016 05:19 AM, Florian Weimer wrote:
> Fedora needs to relink libpthread.a into a single object file to
> support some application needs. Starting with
>
> commit fb1cf108115f7e2e4510859693431b3473657d77
> Author: H.J. Lu <hjl.tools@gmail.com>
> Date: Tue Oct 13 11:58:53 2015 -0700
>
> Add INLINE_SYSCALL_ERROR_RETURN_VALUE
>
> this prevents static linking due to multiple copies of the functions
> from sysdep.o.
>
> The attached patch skips adding sysdep.o for static libraries. Okay
> to commit?
>
> (No bug filed because this is a downstream bug only, but dropping the
> additional copy of sysdep.o seems to make sense upstream as well.)
Just to be clear: User visible changes need bugs, downstream or not.
I leave it up to you to decide if you want a bug to track this or not,
I'm not picky since this is an odd case where any change is visible
as a change in the statically linked objects.
On 08/04/2016 05:57 PM, Carlos O'Donell wrote:
> On 08/04/2016 05:19 AM, Florian Weimer wrote:
>> Fedora needs to relink libpthread.a into a single object file to
>> support some application needs. Starting with
>>
>> commit fb1cf108115f7e2e4510859693431b3473657d77
>> Author: H.J. Lu <hjl.tools@gmail.com>
>> Date: Tue Oct 13 11:58:53 2015 -0700
>>
>> Add INLINE_SYSCALL_ERROR_RETURN_VALUE
>>
>> this prevents static linking due to multiple copies of the functions
>> from sysdep.o.
>>
>> The attached patch skips adding sysdep.o for static libraries. Okay
>> to commit?
>>
>> (No bug filed because this is a downstream bug only, but dropping the
>> additional copy of sysdep.o seems to make sense upstream as well.)
>
> Just to be clear: User visible changes need bugs, downstream or not.
I filed bug 20452 to track this.
Florian
x86: Use sysdep.o from libc.a in static libraries
Static libraries can use the sysdep.o copy in libc.a without
a performance penalty. This results in a visible difference
if libpthread.a is relinked into a single object file (which
is needed to support libraries which check for the presence
of certain symbols to enable threading support, which generally
fails with static linking unless libpthread.a is relinked).
2016-08-04 Florian Weimer <fweimer@redhat.com>
Use sysdep.o from libc.a in static libraries.
* sysdeps/unix/sysv/linux/i386/Makefile
(libpthread-shared-only-routines): Add sysdep.
(librt-shared-only-routines): Likewise.
@@ -48,9 +48,11 @@ endif
ifeq ($(subdir),nptl)
# pull in __syscall_error routine
libpthread-routines += sysdep
+libpthread-shared-only-routines += sysdep
endif
ifeq ($(subdir),rt)
# pull in __syscall_error routine
librt-routines += sysdep
+librt-shared-only-routines += sysdep
endif