diff mbox

Test for profiling support (_mcount/gprof)

Message ID 907f751a-3916-64c9-f650-df182fb3cdce@redhat.com
State New
Headers show

Commit Message

Florian Weimer Aug. 16, 2017, 8:09 a.m. UTC
On 08/16/2017 09:43 AM, Andreas Schwab wrote:
> https://build.opensuse.org/package/live_build_log/home:Andreas_Schwab:glibc/glibc-testsuite/f/i586

One has to download the whole log file to find this:

[ 2374s] gcc: error: -pg and -fomit-frame-pointer are incompatible

This looks like a GCC deficiency.  Anyway, please try the attached patch.

Thanks,
Florian

Comments

Szabolcs Nagy Aug. 16, 2017, 8:41 a.m. UTC | #1
On 16/08/17 09:09, Florian Weimer wrote:
> [ 2374s] gcc: error: -pg and -fomit-frame-pointer are incompatible
> 
> This looks like a GCC deficiency.  Anyway, please try the attached patch.

for the record:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69690
Andreas Schwab Aug. 16, 2017, 3:05 p.m. UTC | #2
On Aug 16 2017, Florian Weimer <fweimer@redhat.com> wrote:

> tst-gmon: Build with -fno-omit-frame-pointer
>
> If glibc is built with -fomit-frame-pointer to undo the effect of
> configuring GCC with --enable-frame-pointer, using -pg by itself results
> in a build failure:

This works, but what does this have to do with --enable-frame-pointer?

Andreas.
Florian Weimer Aug. 16, 2017, 3:07 p.m. UTC | #3
On 08/16/2017 05:05 PM, Andreas Schwab wrote:
> On Aug 16 2017, Florian Weimer <fweimer@redhat.com> wrote:
> 
>> tst-gmon: Build with -fno-omit-frame-pointer
>>
>> If glibc is built with -fomit-frame-pointer to undo the effect of
>> configuring GCC with --enable-frame-pointer, using -pg by itself results
>> in a build failure:
> 
> This works, but what does this have to do with --enable-frame-pointer?

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

Thanks,
Florian
Andreas Schwab Aug. 16, 2017, 3:20 p.m. UTC | #4
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.

Andreas.
Florian Weimer Aug. 16, 2017, 3:28 p.m. UTC | #5
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?

Thanks,
Florian
Andreas Schwab Aug. 16, 2017, 3:30 p.m. UTC | #6
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.

Andreas.
Florian Weimer Aug. 16, 2017, 3:32 p.m. UTC | #7
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.

Thanks,
Florian
H.J. Lu Aug. 16, 2017, 8:03 p.m. UTC | #8
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.
Florian Weimer Aug. 16, 2017, 9:04 p.m. UTC | #9
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.

Thanks,
Florian
Andreas Schwab Aug. 17, 2017, 6:36 a.m. UTC | #10
On Aug 16 2017, Florian Weimer <fweimer@redhat.com> wrote:

> But GCC does it by default if you don't build with
> --enable-frame-pointer,

No, it doesn't.  This has no effect in general.

Andreas.
Florian Weimer Oct. 5, 2017, 10:52 a.m. UTC | #11
On 08/16/2017 10:09 AM, Florian Weimer wrote:
> tst-gmon: Build with -fno-omit-frame-pointer
> 
> If glibc is built with -fomit-frame-pointer to undo the effect of
> configuring GCC with --enable-frame-pointer, using -pg by itself results
> in a build failure:
> 
> gcc: error: -pg and -fomit-frame-pointer are incompatible
> 
> 2017-08-16  Florian Weimer<fweimer@redhat.com>
> 
> 	* gmon/Makefile (CFLAGS-tst-gmon.c): Add -fno-omit-frame-pointer.
> 
> diff --git a/gmon/Makefile b/gmon/Makefile
> index 39f11acec2..62d96543ff 100644
> --- a/gmon/Makefile
> +++ b/gmon/Makefile
> @@ -38,7 +38,7 @@ endif
>   # The mcount code won't work without a frame pointer.
>   CFLAGS-mcount.c := -fno-omit-frame-pointer
>   
> -CFLAGS-tst-gmon.c := -pg
> +CFLAGS-tst-gmon.c := -fno-omit-frame-pointer -pg
>   LDFLAGS-tst-gmon := $(no-pie-ldflag)
>   CRT-tst-gmon := $(csu-objpfx)gcrt1.o
>   tst-gmon-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon.data

Is this patch still needed?

Thanks,
Florian
Andreas Schwab Oct. 5, 2017, 12:19 p.m. UTC | #12
On Okt 05 2017, Florian Weimer <fweimer@redhat.com> wrote:

> On 08/16/2017 10:09 AM, Florian Weimer wrote:
>> tst-gmon: Build with -fno-omit-frame-pointer
>>
>> If glibc is built with -fomit-frame-pointer to undo the effect of
>> configuring GCC with --enable-frame-pointer, using -pg by itself results
>> in a build failure:
>>
>> gcc: error: -pg and -fomit-frame-pointer are incompatible
>>
>> 2017-08-16  Florian Weimer<fweimer@redhat.com>
>>
>> 	* gmon/Makefile (CFLAGS-tst-gmon.c): Add -fno-omit-frame-pointer.
>>
>> diff --git a/gmon/Makefile b/gmon/Makefile
>> index 39f11acec2..62d96543ff 100644
>> --- a/gmon/Makefile
>> +++ b/gmon/Makefile
>> @@ -38,7 +38,7 @@ endif
>>   # The mcount code won't work without a frame pointer.
>>   CFLAGS-mcount.c := -fno-omit-frame-pointer
>>   -CFLAGS-tst-gmon.c := -pg
>> +CFLAGS-tst-gmon.c := -fno-omit-frame-pointer -pg
>>   LDFLAGS-tst-gmon := $(no-pie-ldflag)
>>   CRT-tst-gmon := $(csu-objpfx)gcrt1.o
>>   tst-gmon-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon.data
>
> Is this patch still needed?

Sure.

Andreas.
Florian Weimer Oct. 5, 2017, 12:20 p.m. UTC | #13
On 10/05/2017 02:19 PM, Andreas Schwab wrote:
> On Okt 05 2017, Florian Weimer <fweimer@redhat.com> wrote:
> 
>> On 08/16/2017 10:09 AM, Florian Weimer wrote:
>>> tst-gmon: Build with -fno-omit-frame-pointer
>>>
>>> If glibc is built with -fomit-frame-pointer to undo the effect of
>>> configuring GCC with --enable-frame-pointer, using -pg by itself results
>>> in a build failure:
>>>
>>> gcc: error: -pg and -fomit-frame-pointer are incompatible
>>>
>>> 2017-08-16  Florian Weimer<fweimer@redhat.com>
>>>
>>> 	* gmon/Makefile (CFLAGS-tst-gmon.c): Add -fno-omit-frame-pointer.
>>>
>>> diff --git a/gmon/Makefile b/gmon/Makefile
>>> index 39f11acec2..62d96543ff 100644
>>> --- a/gmon/Makefile
>>> +++ b/gmon/Makefile
>>> @@ -38,7 +38,7 @@ endif
>>>    # The mcount code won't work without a frame pointer.
>>>    CFLAGS-mcount.c := -fno-omit-frame-pointer
>>>    -CFLAGS-tst-gmon.c := -pg
>>> +CFLAGS-tst-gmon.c := -fno-omit-frame-pointer -pg
>>>    LDFLAGS-tst-gmon := $(no-pie-ldflag)
>>>    CRT-tst-gmon := $(csu-objpfx)gcrt1.o
>>>    tst-gmon-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon.data
>>
>> Is this patch still needed?
> 
> Sure.

Shall I commit it, then?

Thanks,
Florian
Andreas Schwab Oct. 5, 2017, 12:31 p.m. UTC | #14
On Okt 05 2017, Florian Weimer <fweimer@redhat.com> wrote:

> Shall I commit it, then?

Yes, please.

Andreas.
Florian Weimer Oct. 5, 2017, 12:37 p.m. UTC | #15
On 10/05/2017 02:31 PM, Andreas Schwab wrote:
> On Okt 05 2017, Florian Weimer <fweimer@redhat.com> wrote:
> 
>> Shall I commit it, then?
> 
> Yes, please.

Done.

Thanks,
Florian
diff mbox

Patch

tst-gmon: Build with -fno-omit-frame-pointer

If glibc is built with -fomit-frame-pointer to undo the effect of
configuring GCC with --enable-frame-pointer, using -pg by itself results
in a build failure:

gcc: error: -pg and -fomit-frame-pointer are incompatible

2017-08-16  Florian Weimer  <fweimer@redhat.com>

	* gmon/Makefile (CFLAGS-tst-gmon.c): Add -fno-omit-frame-pointer.

diff --git a/gmon/Makefile b/gmon/Makefile
index 39f11acec2..62d96543ff 100644
--- a/gmon/Makefile
+++ b/gmon/Makefile
@@ -38,7 +38,7 @@  endif
 # The mcount code won't work without a frame pointer.
 CFLAGS-mcount.c := -fno-omit-frame-pointer
 
-CFLAGS-tst-gmon.c := -pg
+CFLAGS-tst-gmon.c := -fno-omit-frame-pointer -pg
 LDFLAGS-tst-gmon := $(no-pie-ldflag)
 CRT-tst-gmon := $(csu-objpfx)gcrt1.o
 tst-gmon-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon.data