public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Jeff Law <law@redhat.com>
Cc: Magnus Granberg <zorry@gentoo.org>, gcc-patches@gcc.gnu.org
Subject: [testsuite] PATCH: Check if -pg available
Date: Tue, 13 Jan 2015 13:04:00 -0000	[thread overview]
Message-ID: <20150113125432.GB18558@gmail.com> (raw)
In-Reply-To: <54B444E4.1080700@redhat.com>

On Mon, Jan 12, 2015 at 03:04:20PM -0700, Jeff Law wrote:
> On 01/12/15 14:51, Magnus Granberg wrote:
> >måndag 12 januari 2015 12.11.17 skrev  H.J. Lu:
> >>On Mon, Jan 12, 2015 at 12:03 PM, Jeff Law <law@redhat.com> wrote:
> >>>On 01/12/15 12:59, H.J. Lu wrote:
> >>>>I don't know if -pg will work PIE on any targets.  For Linux/x86
> >>>>the choices of crt1.o are
> >>>>
> >>>>%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}
> >>>>
> >>>>-shared, -pg and -pie are mutually exclusive. Those crt1 files are
> >>>>only crt1 files provided by glibc.  You can't even try -pg -pie on
> >>>>Linux without changing glibc.
> >>>
> >>>You're totally missing the point.  What I care about is *why*.
> >>>
> >With -pg it use gcrt1.o object file and that file is not compile with -fPIC.
> >When you build a shared lib on x86_64 all the objects files need to be buiit
> >with -fPIC else you get a error like that one abow and it is the same problems
> >when you build bin with -fPIE and linke with -pie.
> >Glibc do not provide one that is compile with -fPIC
> Is there some reason why glibc could not provide gcrt1.o compiled with
> -fPIC?
> 
> 

Here is a patch to check if -pg is available.  If -pg doesn't link,
profiling isn't available.  OK for trunk?

Thanks.


H.J.
---
 gcc/testsuite/lib/target-supports.exp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 0ac9646..7c09399 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -546,6 +546,12 @@ proc check_profiling_available { test_what } {
 	    set profiling_available_saved 0
 	} else {
 	    set profiling_available_saved 1
+	    if { [check_no_compiler_messages_nocache profiling executable {
+		  int main() { return 0; } } "-pg"] } {
+		set profiling_available_saved 1
+	     } else {
+		set profiling_available_saved 0
+	    }
 	}
     }
 
-- 
1.9.3

  parent reply	other threads:[~2015-01-13 12:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-12  0:25 [testsuite] PATCH: Add check_effective_target_pie H.J. Lu
2015-01-12 18:28 ` Jeff Law
2015-01-12 19:58   ` H.J. Lu
2015-01-12 19:59     ` Jeff Law
     [not found]       ` <CAMe9rOp1R-FewC1D9fODCe3ia82Ve8YxvfzHPBCaSa9zn4xi+Q@mail.gmail.com>
     [not found]         ` <54B42880.2040800@redhat.com>
2015-01-12 20:16           ` H.J. Lu
2015-01-12 22:01             ` Magnus Granberg
2015-01-12 22:12               ` Jeff Law
2015-01-13 13:03                 ` H.J. Lu
2015-01-13 19:45                   ` Jeff Law
2015-02-10 23:11                     ` Rainer Orth
2015-02-11 14:04                       ` H.J. Lu
2015-02-11 14:11                         ` Rainer Orth
2015-02-11 14:20                           ` H.J. Lu
2015-02-11 15:19                             ` Rainer Orth
2015-02-11 15:45                               ` H.J. Lu
2015-02-11 16:16                                 ` Rainer Orth
2015-02-11 16:45                                   ` H.J. Lu
2015-01-13 13:04                 ` H.J. Lu [this message]
2015-01-13 13:15                   ` [testsuite] PATCH: Check if -pg available H.J. Lu
2015-01-13 19:49                   ` Jeff Law
2015-01-13 20:47                     ` H.J. Lu
2015-01-13 21:14                       ` Jeff Law
2015-01-13 14:56                 ` [testsuite] PATCH: Add check_effective_target_pie H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150113125432.GB18558@gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=zorry@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).