diff mbox

Test for profiling support (_mcount/gprof)

Message ID CAMe9rOpaoLrx6Wg1R1v0038Lbo0e2exy-yVCRdSYQrrYKqtGeQ@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu Aug. 16, 2017, 9:10 p.m. UTC
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 mbox

Patch

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))\