From patchwork Wed Aug 16 21:19:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 22170 Received: (qmail 68117 invoked by alias); 16 Aug 2017 21:19:13 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 65181 invoked by uid 89); 16 Aug 2017 21:19:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-oi0-f66.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=fMcjUUrS36QDJDfq2/XzqysL+5B7Nn7+mxWcO0FO5ZM=; b=UrpQ4HfLSDrPtb1edl50qHagrgSSyPTYruuFKlnPdcAvInJD6wGl14fwGcDHfrYWgI 9e1WDxM7zXOathptOlANMR7yQizW3HyqYP10pNllJLLbRZ5rovoSVAVEUHjWe82Za9Cc F3VzUc4ELYHdAaynbQ0mxCJlenqn54QxE+gnblbZxC03HVS0aCkv4moW0HYJsPYhyaby MJOAPOC80NPl0azlUfgu46qcQTpjISLMnrdfReD3RDqKGYTEgVWJ2KoN6OfYvUltuM91 wK43PkD7GSAZHX4uf123UjdIBo+3NSr4ucNGYF7c4sWsqtKPax2YDFuUs3rKJTijKs/W pRlQ== X-Gm-Message-State: AHYfb5jp/2pm2agNwoHHUoQhixxwSdDvKpW5LHt44uSufYQJF4ZC0qcY fmXZ5FbYc67ibMwOYDoZLFHL1awpoQ== X-Received: by 10.202.227.5 with SMTP id a5mr3591468oih.240.1502918349263; Wed, 16 Aug 2017 14:19:09 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <4d15086e-9e54-014b-1a50-16534f287e24@redhat.com> <539fb6f1-9d96-01d5-0f35-f3c312c0ecbb@redhat.com> <87b76487-16d3-78b4-9651-f6d375b9b137@redhat.com> <36b6ab73-342d-0886-8767-ff7fd6dd4d79@redhat.com> <907f751a-3916-64c9-f650-df182fb3cdce@redhat.com> <93df1f7c-b5f9-4ab7-5fe8-87baf94e4d34@redhat.com> <40ca3281-c22c-954d-b11d-5312782971e3@redhat.com> <357353c9-2633-a1a5-4d78-49862087a8a5@redhat.com> From: "H.J. Lu" Date: Wed, 16 Aug 2017 14:19:08 -0700 Message-ID: Subject: Re: [PATCH] Test for profiling support (_mcount/gprof) To: Florian Weimer Cc: Andreas Schwab , GNU C Library On Wed, Aug 16, 2017 at 2:10 PM, H.J. Lu wrote: > On Wed, Aug 16, 2017 at 2:04 PM, Florian Weimer wrote: >> On 08/16/2017 10:03 PM, H.J. Lu wrote: >>> On Wed, Aug 16, 2017 at 8:32 AM, Florian Weimer wrote: >>>> On 08/16/2017 05:30 PM, Andreas Schwab wrote: >>>>> On Aug 16 2017, Florian Weimer wrote: >>>>> >>>>>> On 08/16/2017 05:20 PM, Andreas Schwab wrote: >>>>>>> On Aug 16 2017, Florian Weimer 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? From f19721b98346b9493f3ecb5cd41527e102c7fedf Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 16 Aug 2017 14:15:43 -0700 Subject: [PATCH] Support -pg with GCC defaulting to PIE -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. --- 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))\ -- 2.13.5