From patchwork Wed Aug 16 21:10:59 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: 22169 Received: (qmail 23875 invoked by alias); 16 Aug 2017 21:11:04 -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 23858 invoked by uid 89); 16 Aug 2017 21:11:03 -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:content-transfer-encoding; bh=I3DGpaXxQND4WdX64ujaBfI4D1EaVElxxp03FVsj7Zw=; b=H2PRtMxyBd/kuIAvJ2wEk1MlIkmXV3S8d+JTPWB8CHKts5LGOhjxHG2Xz2gWpQqeh0 AP6xNlkMVrY5Fj0fz73QpXSDPvU15mkJEVFks6hBx5GsWJ35s5opweij2KbXHyMTUrrI MbAAwymDrVdF1vn4lAE5+Em7Qx1QicPJnGGtmKjcgey+ENSS1XCxNLlUGD0jKsrp2Dzs rjHPASQ2iMNgOlLNeAiiHpLxrSV+HFvX9IgLnbT6hWDT+QB9jnpIswipcXxfuDn99ayV bODvIBA3ZN5SwO89GOMDdS5Ygy+T8MUny2Pu+kGCbLPWPixJpod+ZLhYlygj7al1n+D8 /7vg== X-Gm-Message-State: AHYfb5hWlnABHsZ5fUgzshPdWV5f1UNh1YOfIJD+xw8HYmzdmm/Y52ke 97M4v93WYnEOR0PeBuCfY/hUnmUKLw== X-Received: by 10.202.81.68 with SMTP id f65mr4030051oib.2.1502917860428; Wed, 16 Aug 2017 14:11:00 -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:10:59 -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: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))\