This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Test for profiling support (_mcount/gprof)


On Thu, Aug 17, 2017 at 12:44 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 08/16/2017 11:19 PM, H.J. Lu wrote:
>> -pg and -pie are mutually exclusive since they need different crt1.o,
>> gcrrt1.o vs Scrt1.o.  Make -pg overrdies -pie.
>>
>>       * Makeconfig (+link-pie-before-libc): Add CRT-* hook to override
>>       the startup object.
>
> Typo (gcrrt1.o), and the commit message is confusing.  There is no -pg
> involved at the linking stage.
>
> gcrt1.o is deliberately compiled so that it is compatible with PIE, so
> the patch itself is okay.

This is what I checked in.

-- 
H.J.
---
>From eb13870b4379abf2f15dac8683276e96b83fff4e Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 16 Aug 2017 14:15:43 -0700
Subject: [PATCH] Support mcount/gprof test with GCC defaulting to PIE

The mcount/gprof test should be linked with gcrt1.o, not Scrt1.o.

* Makeconfig (+link-pie-before-libc): Add CRT-* hook to override
the startup object.
---
 Makeconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]