[PATCH] Test for profiling support (_mcount/gprof)
H.J. Lu
hjl.tools@gmail.com
Wed Aug 16 21:19:00 GMT 2017
On Wed, Aug 16, 2017 at 2:10 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Aug 16, 2017 at 2:04 PM, Florian Weimer <fweimer@redhat.com> wrote:
>> On 08/16/2017 10:03 PM, H.J. Lu wrote:
>>> On Wed, Aug 16, 2017 at 8:32 AM, Florian Weimer <fweimer@redhat.com> wrote:
>>>> On 08/16/2017 05:30 PM, Andreas Schwab wrote:
>>>>> On Aug 16 2017, Florian Weimer <fweimer@redhat.com> wrote:
>>>>>
>>>>>> On 08/16/2017 05:20 PM, Andreas Schwab wrote:
>>>>>>> On Aug 16 2017, Florian Weimer <fweimer@redhat.com> wrote:
>>>>>>>
>>>>>>>> If you don't use --enable-frame-pointer for GCC, there's no apparent
>>>>>>>> reason to me to build glibc with --fomit-frame-pointer because it's the
>>>>>>>> default (albeit in a fashion that is compatible with -pg).
>>>>>>>
>>>>>>> That is not true.
>>>>>>
>>>>>> It is currently true—I don't see why anyone would want to build glibc
>>>>>> this way. Could you enlighten me?
>>>>>
>>>>> To omit the frame pointer.
>>>>
>>>> But GCC does it by default if you don't build with
>>>> --enable-frame-pointer, at least on i386, which is the architecture for
>>>> which you reported the failure.
>>>
>>> gmon/tst-gmon-gprof also fails with GCC defaulting to PIE.
>>
>> That would be a real failure (due to ASLR). Does linking with -pg
>> ordinarily disable PIE? I suppose we could add -pg to LDFLAGS for this
>> test because as Andreas explained earlier, it won't link in the system
>> profiling libraries.
>>
>
> -pg and -pie are mutually exclusive since they need different crt1.os,
> gcrrt1.o vs Scrt1.o. This patch works for me:
>
> diff --git a/Makeconfig b/Makeconfig
> index 5f2469116c..b51904b797 100644
> --- a/Makeconfig
> +++ b/Makeconfig
> @@ -409,7 +409,7 @@ ifndef +link-pie
> +link-pie-before-libc = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
> $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
> $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
> - $(addprefix $(csu-objpfx),S$(start-installed-name)) \
> + $(firstword $(CRT-$(@F)) $(csu-objpfx)S$(start-installed-name)) \
> $(+preinit) $(+prectorS) \
> $(filter-out $(addprefix $(csu-objpfx),start.o \
> S$(start-installed-name))\
>
>
Tested with GCC defaulting to PIE. OK for master?
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Support-pg-with-GCC-defaulting-to-PIE.patch
Type: text/x-patch
Size: 1097 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20170816/b3f4f5f9/attachment.bin>
More information about the Libc-alpha
mailing list