public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] m68k: don't use lea on profiling
@ 2009-11-19 13:51 Sebastian Andrzej Siewior
  2009-11-19 13:57 ` Maxim Kuvyrkov
  0 siblings, 1 reply; 12+ messages in thread
From: Sebastian Andrzej Siewior @ 2009-11-19 13:51 UTC (permalink / raw)
  To: gcc-patches; +Cc: mkuvyrkov

this will not work on large binaries:

|bigeasy@ayoka:~/cc$ echo 'int main(void) { return 0; }' > file.c
|bigeasy@ayoka:~/cc$ m68k-linux-gnu-gcc -o file file.c -static -pg
|/tmp/ccw33VYP.o: In function `main':
|file.c:(.text+0x6): relocation truncated to fit: R_68K_PC16 against `.data'
|collect2: ld returned 1 exit status

This is reported as #36047. It appears that the generated label is unused.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 gcc/config/m68k/linux.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h
index 113f278..79e9151 100644
--- a/gcc/config/m68k/linux.h
+++ b/gcc/config/m68k/linux.h
@@ -146,7 +146,6 @@ along with GCC; see the file COPYING3.  If not see
 #undef FUNCTION_PROFILER
 #define FUNCTION_PROFILER(FILE, LABELNO) \
 {									\
-  asm_fprintf (FILE, "\tlea (%LLP%d,%Rpc),%Ra1\n", (LABELNO));		\
   if (flag_pic)								\
     fprintf (FILE, "\tbsr.l _mcount@PLTPC\n");				\
   else									\
-- 
1.6.2.5

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] m68k: don't use lea on profiling
  2009-11-19 13:51 [PATCH] m68k: don't use lea on profiling Sebastian Andrzej Siewior
@ 2009-11-19 13:57 ` Maxim Kuvyrkov
  2009-11-23 17:35   ` Jeff Law
  2009-11-23 21:57   ` Andreas Schwab
  0 siblings, 2 replies; 12+ messages in thread
From: Maxim Kuvyrkov @ 2009-11-19 13:57 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: gcc-patches, Andreas Schwab

Sebastian Andrzej Siewior wrote:
> this will not work on large binaries:
> 
> |bigeasy@ayoka:~/cc$ echo 'int main(void) { return 0; }' > file.c
> |bigeasy@ayoka:~/cc$ m68k-linux-gnu-gcc -o file file.c -static -pg
> |/tmp/ccw33VYP.o: In function `main':
> |file.c:(.text+0x6): relocation truncated to fit: R_68K_PC16 against `.data'
> |collect2: ld returned 1 exit status
> 
> This is reported as #36047. It appears that the generated label is unused.

As I noted in the PR <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36047> 
neither GLIBC nor uClibc need the argument so we may simply remove it 
(thus getting rid of the PC-relative relocation that causes the problem).

Andreas, does this look OK to you?

> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  gcc/config/m68k/linux.h |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h
> index 113f278..79e9151 100644
> --- a/gcc/config/m68k/linux.h
> +++ b/gcc/config/m68k/linux.h
> @@ -146,7 +146,6 @@ along with GCC; see the file COPYING3.  If not see
>  #undef FUNCTION_PROFILER
>  #define FUNCTION_PROFILER(FILE, LABELNO) \
>  {									\
> -  asm_fprintf (FILE, "\tlea (%LLP%d,%Rpc),%Ra1\n", (LABELNO));		\
>    if (flag_pic)								\
>      fprintf (FILE, "\tbsr.l _mcount@PLTPC\n");				\
>    else									\


-- 
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] m68k: don't use lea on profiling
  2009-11-19 13:57 ` Maxim Kuvyrkov
@ 2009-11-23 17:35   ` Jeff Law
  2009-11-23 18:25     ` Maxim Kuvyrkov
  2009-11-23 20:12     ` Sebastian Andrzej Siewior
  2009-11-23 21:57   ` Andreas Schwab
  1 sibling, 2 replies; 12+ messages in thread
From: Jeff Law @ 2009-11-23 17:35 UTC (permalink / raw)
  To: Maxim Kuvyrkov; +Cc: Sebastian Andrzej Siewior, gcc-patches, Andreas Schwab

On 11/19/09 06:50, Maxim Kuvyrkov wrote:
> Sebastian Andrzej Siewior wrote:
>> this will not work on large binaries:
>>
>> |bigeasy@ayoka:~/cc$ echo 'int main(void) { return 0; }' > file.c
>> |bigeasy@ayoka:~/cc$ m68k-linux-gnu-gcc -o file file.c -static -pg
>> |/tmp/ccw33VYP.o: In function `main':
>> |file.c:(.text+0x6): relocation truncated to fit: R_68K_PC16 against 
>> `.data'
>> |collect2: ld returned 1 exit status
>>
>> This is reported as #36047. It appears that the generated label is 
>> unused.
>
> As I noted in the PR 
> <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36047> neither GLIBC nor 
> uClibc need the argument so we may simply remove it (thus getting rid 
> of the PC-relative relocation that causes the problem).
>
> Andreas, does this look OK to you?
My areas of concern would be:

   1. Does anyone hook the mcount call and expect the a0/a1 to have 
reasonable values.  For example, the kernel tracing code?

   2. When did glibc change to its new approach?  If it was recent, then 
we probably can't assume the newer implementation.

jeff

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] m68k: don't use lea on profiling
  2009-11-23 17:35   ` Jeff Law
@ 2009-11-23 18:25     ` Maxim Kuvyrkov
  2009-11-23 21:58       ` Andreas Schwab
  2009-11-23 20:12     ` Sebastian Andrzej Siewior
  1 sibling, 1 reply; 12+ messages in thread
From: Maxim Kuvyrkov @ 2009-11-23 18:25 UTC (permalink / raw)
  To: Jeff Law; +Cc: Sebastian Andrzej Siewior, gcc-patches, Andreas Schwab

Jeff Law wrote:
> On 11/19/09 06:50, Maxim Kuvyrkov wrote:
>> Sebastian Andrzej Siewior wrote:
>>> this will not work on large binaries:
>>>
>>> |bigeasy@ayoka:~/cc$ echo 'int main(void) { return 0; }' > file.c
>>> |bigeasy@ayoka:~/cc$ m68k-linux-gnu-gcc -o file file.c -static -pg
>>> |/tmp/ccw33VYP.o: In function `main':
>>> |file.c:(.text+0x6): relocation truncated to fit: R_68K_PC16 against 
>>> `.data'
>>> |collect2: ld returned 1 exit status
>>>
>>> This is reported as #36047. It appears that the generated label is 
>>> unused.
>>
>> As I noted in the PR 
>> <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36047> neither GLIBC nor 
>> uClibc need the argument so we may simply remove it (thus getting rid 
>> of the PC-relative relocation that causes the problem).
>>
>> Andreas, does this look OK to you?
> My areas of concern would be:
> 
>   1. Does anyone hook the mcount call and expect the a0/a1 to have 
> reasonable values.  For example, the kernel tracing code?

I don't think so.  M68K kernel does not define any target-specific code 
for profiling.

> 
>   2. When did glibc change to its new approach?  If it was recent, then 
> we probably can't assume the newer implementation.

I looked through revision history of glibc-port and didn't find any 
mentions of _mcount implementation in the m68k directories since GLIBC 2.3.

-- 
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] m68k: don't use lea on profiling
  2009-11-23 17:35   ` Jeff Law
  2009-11-23 18:25     ` Maxim Kuvyrkov
@ 2009-11-23 20:12     ` Sebastian Andrzej Siewior
  1 sibling, 0 replies; 12+ messages in thread
From: Sebastian Andrzej Siewior @ 2009-11-23 20:12 UTC (permalink / raw)
  To: Jeff Law; +Cc: Maxim Kuvyrkov, gcc-patches, Andreas Schwab

* Jeff Law | 2009-11-23 10:30:10 [-0700]:

>>Andreas, does this look OK to you?
>My areas of concern would be:
>
>  1. Does anyone hook the mcount call and expect the a0/a1 to have
>reasonable values.  For example, the kernel tracing code?
I've implemented ftrace support [0] for the nommu variant however it
wasn't merged since they changed the interface a few times and I did not
follow. Back than I had to rip it out in order to compile the kernel
with -pg and it worked with the label.

[0] http://lkml.indiana.edu/hypermail/linux/kernel/0805.1/2054.html

>jeff
>

Sebastian

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] m68k: don't use lea on profiling
  2009-11-19 13:57 ` Maxim Kuvyrkov
  2009-11-23 17:35   ` Jeff Law
@ 2009-11-23 21:57   ` Andreas Schwab
  2009-12-06 20:47     ` [PATCH v2] " Sebastian Andrzej Siewior
  1 sibling, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2009-11-23 21:57 UTC (permalink / raw)
  To: Maxim Kuvyrkov; +Cc: Sebastian Andrzej Siewior, gcc-patches

Maxim Kuvyrkov <maxim@codesourcery.com> writes:

> Sebastian Andrzej Siewior wrote:
>> this will not work on large binaries:
>>
>> |bigeasy@ayoka:~/cc$ echo 'int main(void) { return 0; }' > file.c
>> |bigeasy@ayoka:~/cc$ m68k-linux-gnu-gcc -o file file.c -static -pg
>> |/tmp/ccw33VYP.o: In function `main':
>> |file.c:(.text+0x6): relocation truncated to fit: R_68K_PC16 against `.data'
>> |collect2: ld returned 1 exit status
>>
>> This is reported as #36047. It appears that the generated label is unused.
>
> As I noted in the PR <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36047>
> neither GLIBC nor uClibc need the argument so we may simply remove it
> (thus getting rid of the PC-relative relocation that causes the problem).
>
> Andreas, does this look OK to you?

It should also define NO_PROFILE_COUNTERS.  OK with that change and a
proper ChangeLog entry.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] m68k: don't use lea on profiling
  2009-11-23 18:25     ` Maxim Kuvyrkov
@ 2009-11-23 21:58       ` Andreas Schwab
  0 siblings, 0 replies; 12+ messages in thread
From: Andreas Schwab @ 2009-11-23 21:58 UTC (permalink / raw)
  To: Maxim Kuvyrkov; +Cc: Jeff Law, Sebastian Andrzej Siewior, gcc-patches

Maxim Kuvyrkov <maxim@codesourcery.com> writes:

> I looked through revision history of glibc-port and didn't find any
> mentions of _mcount implementation in the m68k directories since GLIBC
> 2.3.

The libc4 implementation didn't use the profile counter either.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2] m68k: don't use lea on profiling
  2009-11-23 21:57   ` Andreas Schwab
@ 2009-12-06 20:47     ` Sebastian Andrzej Siewior
  2009-12-06 21:28       ` Andreas Schwab
  0 siblings, 1 reply; 12+ messages in thread
From: Sebastian Andrzej Siewior @ 2009-12-06 20:47 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Maxim Kuvyrkov, gcc-patches

this will not work on large binaries:

|bigeasy@ayoka:~/cc$ echo 'int main(void) { return 0; }' > file.c
|bigeasy@ayoka:~/cc$ m68k-linux-gnu-gcc -o file file.c -static -pg
|/tmp/ccw33VYP.o: In function `main':
|file.c:(.text+0x6): relocation truncated to fit: R_68K_PC16 against `.data'
|collect2: ld returned 1 exit status

This is reported as #36047. It appears that the generated label is unused.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Andreas, is this what you had in mind?

 gcc/ChangeLog           |    7 +++++++
 gcc/config/m68k/linux.h |    3 +--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f172477..f0ad5cf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2009-12-06  Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+	PR target/36047
+
+	* config/m68k/linux.h: Remove LABELNO from the mcount statement. It is
+	not used by glibc/uclibc and does not work with large binaries.
+
 2009-12-06  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
 	* doc/install.texi: Document MPC is required.
diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h
index 113f278..1d73ee0 100644
--- a/gcc/config/m68k/linux.h
+++ b/gcc/config/m68k/linux.h
@@ -142,11 +142,10 @@ along with GCC; see the file COPYING3.  If not see
 
 /* Output assembler code to FILE to increment profiler label # LABELNO
    for profiling a function entry.  */
-
+#define NO_PROFILE_COUNTERS 1
 #undef FUNCTION_PROFILER
 #define FUNCTION_PROFILER(FILE, LABELNO) \
 {									\
-  asm_fprintf (FILE, "\tlea (%LLP%d,%Rpc),%Ra1\n", (LABELNO));		\
   if (flag_pic)								\
     fprintf (FILE, "\tbsr.l _mcount@PLTPC\n");				\
   else									\
-- 
1.6.2.5

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] m68k: don't use lea on profiling
  2009-12-06 20:47     ` [PATCH v2] " Sebastian Andrzej Siewior
@ 2009-12-06 21:28       ` Andreas Schwab
  2009-12-11  9:53         ` Maxim Kuvyrkov
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2009-12-06 21:28 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: Maxim Kuvyrkov, gcc-patches

Sebastian Andrzej Siewior <sebastian@breakpoint.cc> writes:

> this will not work on large binaries:
>
> |bigeasy@ayoka:~/cc$ echo 'int main(void) { return 0; }' > file.c
> |bigeasy@ayoka:~/cc$ m68k-linux-gnu-gcc -o file file.c -static -pg
> |/tmp/ccw33VYP.o: In function `main':
> |file.c:(.text+0x6): relocation truncated to fit: R_68K_PC16 against `.data'
> |collect2: ld returned 1 exit status
>
> This is reported as #36047. It appears that the generated label is unused.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> Andreas, is this what you had in mind?

Yes, this is ok.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] m68k: don't use lea on profiling
  2009-12-06 21:28       ` Andreas Schwab
@ 2009-12-11  9:53         ` Maxim Kuvyrkov
  2009-12-11  9:58           ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 12+ messages in thread
From: Maxim Kuvyrkov @ 2009-12-11  9:53 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Sebastian Andrzej Siewior, gcc-patches

On 12/6/09 11:47 PM, Andreas Schwab wrote:
> Sebastian Andrzej Siewior<sebastian@breakpoint.cc>  writes:
>
>> this will not work on large binaries:
>>
>> |bigeasy@ayoka:~/cc$ echo 'int main(void) { return 0; }'>  file.c
>> |bigeasy@ayoka:~/cc$ m68k-linux-gnu-gcc -o file file.c -static -pg
>> |/tmp/ccw33VYP.o: In function `main':
>> |file.c:(.text+0x6): relocation truncated to fit: R_68K_PC16 against `.data'
>> |collect2: ld returned 1 exit status
>>
>> This is reported as #36047. It appears that the generated label is unused.
>>
>> Signed-off-by: Sebastian Andrzej Siewior<bigeasy@linutronix.de>
>> ---
>> Andreas, is this what you had in mind?
>
> Yes, this is ok.

Sebastian,

Do you plan to check in you patch sometime soon?  If you don't have 
write access to the GCC repository I can commit it on your behalf.

Regards,

-- 
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] m68k: don't use lea on profiling
  2009-12-11  9:53         ` Maxim Kuvyrkov
@ 2009-12-11  9:58           ` Sebastian Andrzej Siewior
  2009-12-11 15:39             ` Maxim Kuvyrkov
  0 siblings, 1 reply; 12+ messages in thread
From: Sebastian Andrzej Siewior @ 2009-12-11  9:58 UTC (permalink / raw)
  To: Maxim Kuvyrkov; +Cc: Andreas Schwab, gcc-patches

* Maxim Kuvyrkov | 2009-12-11 12:45:34 [+0300]:

>>Yes, this is ok.
>
>Sebastian,
>
>Do you plan to check in you patch sometime soon?  If you don't have
>write access to the GCC repository I can commit it on your behalf.
Yes please do it. I don't have write access. I though Andreas takes care
of it because he was fine it and is the m68k maintainer.

>Regards,

Sebastian

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] m68k: don't use lea on profiling
  2009-12-11  9:58           ` Sebastian Andrzej Siewior
@ 2009-12-11 15:39             ` Maxim Kuvyrkov
  0 siblings, 0 replies; 12+ messages in thread
From: Maxim Kuvyrkov @ 2009-12-11 15:39 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: Andreas Schwab, gcc-patches

On 12/11/09 12:53 PM, Sebastian Andrzej Siewior wrote:
> * Maxim Kuvyrkov | 2009-12-11 12:45:34 [+0300]:
>
>>> Yes, this is ok.
>>
>> Sebastian,
>>
>> Do you plan to check in you patch sometime soon?  If you don't have
>> write access to the GCC repository I can commit it on your behalf.
> Yes please do it. I don't have write access. I though Andreas takes care
> of it because he was fine it and is the m68k maintainer.

I checked in your patch and closed the PR.

Regards,

-- 
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-12-11 15:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-19 13:51 [PATCH] m68k: don't use lea on profiling Sebastian Andrzej Siewior
2009-11-19 13:57 ` Maxim Kuvyrkov
2009-11-23 17:35   ` Jeff Law
2009-11-23 18:25     ` Maxim Kuvyrkov
2009-11-23 21:58       ` Andreas Schwab
2009-11-23 20:12     ` Sebastian Andrzej Siewior
2009-11-23 21:57   ` Andreas Schwab
2009-12-06 20:47     ` [PATCH v2] " Sebastian Andrzej Siewior
2009-12-06 21:28       ` Andreas Schwab
2009-12-11  9:53         ` Maxim Kuvyrkov
2009-12-11  9:58           ` Sebastian Andrzej Siewior
2009-12-11 15:39             ` Maxim Kuvyrkov

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