This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[testsuite] PATCH: Check if -pg available
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Magnus Granberg <zorry at gentoo dot org>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 13 Jan 2015 04:54:32 -0800
- Subject: [testsuite] PATCH: Check if -pg available
- Authentication-results: sourceware.org; auth=none
- References: <20150111235837 dot GA26961 at gmail dot com> <54B42880 dot 2040800 at redhat dot com> <CAMe9rOq4mS7MtgrfLAKg2htp99rbZVcY8enGGiVSU5c9xG+3eQ at mail dot gmail dot com> <2219602 dot BYtQkL3Scp at laptop1 dot gw dot ume dot nu> <54B444E4 dot 1080700 at redhat dot 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