This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Enable hidden visibility in libc.a compiled with PIE
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Sun, 20 Aug 2017 11:00:37 -0700
- Subject: Re: [PATCH] Enable hidden visibility in libc.a compiled with PIE
- Authentication-results: sourceware.org; auth=none
- References: <20170808164040.GA31184@gmail.com> <CAMe9rOpvfgRuuZ=HGi9y+2jyymJy_LeCx1_BR4w-VSHSv8pQ-Q@mail.gmail.com>
On Mon, Aug 14, 2017 at 5:51 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Aug 8, 2017 at 9:40 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>> When building libc.a with PIE, enable hidden visibility to allow direct
>> access to definitions within libc.a without using GOT.
>>
>> Size comparison of elf/ldconfig when the compiler defaults to -fPIE:
>>
>> On x86-64:
>> text data bss dec hex
>> Before: 619206 20132 5488 644826 9d6da
>> After : 619062 20132 5488 644682 9d64a
>> On i686:
>> text data bss dec hex
>> Before: 556305 10816 3056 570177 8b341
>> After : 553688 10756 3056 567500 8a8cc
>>
>> OK for master?
>>
>> H.J.
>> ---
>> * include/libc-symbols.h (attribute_hidden): Enable hidden
>> visibility in libc.a compiled with PIE.
>> ---
>> include/libc-symbols.h | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/libc-symbols.h b/include/libc-symbols.h
>> index fe3ab81c51..d6a1c260f6 100644
>> --- a/include/libc-symbols.h
>> +++ b/include/libc-symbols.h
>> @@ -363,7 +363,8 @@ for linking")
>> strong_alias(real, name)
>> #endif
>>
>> -#if defined SHARED || defined LIBC_NONSHARED
>> +#if defined SHARED || defined LIBC_NONSHARED \
>> + || (BUILD_PIE_DEFAULT && IS_IN (libc))
>> # define attribute_hidden __attribute__ ((visibility ("hidden")))
>> #else
>> # define attribute_hidden
>> --
>> 2.13.4
>>
>
> Any comments or objections?
>
I will check it in tomorrow.
--
H.J.