public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix documentation of -mpoke-function-name ARM option
@ 2019-12-15 18:42 Jérémy Lefaure
  2020-01-10 10:23 ` [PING][PATCH] " Jérémy Lefaure
  2020-02-20 22:08 ` [PING^2][PATCH] " Jérémy Lefaure
  0 siblings, 2 replies; 8+ messages in thread
From: Jérémy Lefaure @ 2019-12-15 18:42 UTC (permalink / raw)
  To: gcc-patches

Hi!

Since in ARM state the value of PC is the address of the current
instruction plus 8 bytes, the code inspecting the value of PC stored at
FP + 0 should look at location PC - 16 : PC - 8 points to the stmfd
instruction, PC - 16 points two words before, where the top 8 bits are
set.

gcc/
2019-12-14  Jérémy Lefaure <jeremy@lefaure.fr>

	* config/arm/arm.c (-mpoke-function-name): Fix documentation in comment.
	* doc/invoke.texi (-mpoke-function-name): Fix documentation.

Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c
+++ gcc/config/arm/arm.c
@@ -20738,9 +20738,9 @@ arm_asm_declare_function_name (FILE *file, const c
 
    When performing a stack backtrace, code can inspect the value
    of 'pc' stored at 'fp' + 0.  If the trace function then looks
-   at location pc - 12 and the top 8 bits are set, then we know
+   at location pc - 16 and the top 8 bits are set, then we know
    that there is a function name embedded immediately preceding this
-   location and has length ((pc[-3]) & 0xff000000).
+   location and has length ((pc[-4]) & 0xff000000).
 
    We assume that pc is declared as a pointer to an unsigned long.
 
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi
+++ gcc/doc/invoke.texi
@@ -18080,9 +18080,9 @@ preceding the function prologue.  The generated co
 
 When performing a stack backtrace, code can inspect the value of
 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
-location @code{pc - 12} and the top 8 bits are set, then we know that
+location @code{pc - 16} and the top 8 bits are set, then we know that
 there is a function name embedded immediately preceding this location
-and has length @code{((pc[-3]) & 0xff000000)}.
+and has length @code{((pc[-4]) & 0xff000000)}.
 
 @item -mthumb
 @itemx -marm

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

* [PING][PATCH] Fix documentation of -mpoke-function-name ARM option
  2019-12-15 18:42 [PATCH] Fix documentation of -mpoke-function-name ARM option Jérémy Lefaure
@ 2020-01-10 10:23 ` Jérémy Lefaure
  2020-02-20 22:08 ` [PING^2][PATCH] " Jérémy Lefaure
  1 sibling, 0 replies; 8+ messages in thread
From: Jérémy Lefaure @ 2020-01-10 10:23 UTC (permalink / raw)
  To: gcc-patches

Hello,

Ping for https://gcc.gnu.org/ml/gcc-patches/2019-12/msg01081.html.

Thank you,
Jérémy

On Sun, Dec 15, 2019 at 07:20:26PM +0100, Jérémy Lefaure wrote:
> Hi!
> 
> Since in ARM state the value of PC is the address of the current
> instruction plus 8 bytes, the code inspecting the value of PC stored at
> FP + 0 should look at location PC - 16 : PC - 8 points to the stmfd
> instruction, PC - 16 points two words before, where the top 8 bits are
> set.
> 
> gcc/
> 2019-12-14  Jérémy Lefaure <jeremy@lefaure.fr>
> 
> 	* config/arm/arm.c (-mpoke-function-name): Fix documentation in comment.
> 	* doc/invoke.texi (-mpoke-function-name): Fix documentation.
> 

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

* [PING^2][PATCH] Fix documentation of -mpoke-function-name ARM option
  2019-12-15 18:42 [PATCH] Fix documentation of -mpoke-function-name ARM option Jérémy Lefaure
  2020-01-10 10:23 ` [PING][PATCH] " Jérémy Lefaure
@ 2020-02-20 22:08 ` Jérémy Lefaure
  2020-02-24 21:19   ` Sandra Loosemore
  1 sibling, 1 reply; 8+ messages in thread
From: Jérémy Lefaure @ 2020-02-20 22:08 UTC (permalink / raw)
  To: gcc-patches

Hello,

Ping for https://gcc.gnu.org/ml/gcc-patches/2019-12/msg01081.html.

Thank you,
Jérémy

On Sun, Dec 15, 2019 at 07:20:26PM +0100, Jérémy Lefaure wrote:
> Hi!
> 
> Since in ARM state the value of PC is the address of the current
> instruction plus 8 bytes, the code inspecting the value of PC stored at
> FP + 0 should look at location PC - 16 : PC - 8 points to the stmfd
> instruction, PC - 16 points two words before, where the top 8 bits are
> set.
> 
> gcc/
> 2019-12-14  Jérémy Lefaure <jeremy@lefaure.fr>
> 
> 	* config/arm/arm.c (-mpoke-function-name): Fix documentation in comment.
> 	* doc/invoke.texi (-mpoke-function-name): Fix documentation.
> 

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

* Re: [PING^2][PATCH] Fix documentation of -mpoke-function-name ARM option
  2020-02-20 22:08 ` [PING^2][PATCH] " Jérémy Lefaure
@ 2020-02-24 21:19   ` Sandra Loosemore
  2020-03-08 17:19     ` blatinox
  0 siblings, 1 reply; 8+ messages in thread
From: Sandra Loosemore @ 2020-02-24 21:19 UTC (permalink / raw)
  To: Jérémy Lefaure, gcc-patches

On 2/20/20 3:08 PM, Jérémy Lefaure wrote:
> Hello,
> 
> Ping for https://gcc.gnu.org/ml/gcc-patches/2019-12/msg01081.html.
> 
> Thank you,
> Jérémy
> 
> On Sun, Dec 15, 2019 at 07:20:26PM +0100, Jérémy Lefaure wrote:
>> Hi!
>>
>> Since in ARM state the value of PC is the address of the current
>> instruction plus 8 bytes, the code inspecting the value of PC stored at
>> FP + 0 should look at location PC - 16 : PC - 8 points to the stmfd
>> instruction, PC - 16 points two words before, where the top 8 bits are
>> set.
>>
>> gcc/
>> 2019-12-14  Jérémy Lefaure <jeremy@lefaure.fr>
>>
>> 	* config/arm/arm.c (-mpoke-function-name): Fix documentation in comment.
>> 	* doc/invoke.texi (-mpoke-function-name): Fix documentation.
>>
> 

The patch looks OK to me from a documentation point of view, but I'm no 
expert about the technical correctness of the change.  Maybe an ARM 
maintainer can review this?

-Sandra

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

* Re: [PING^2][PATCH] Fix documentation of -mpoke-function-name ARM option
  2020-02-24 21:19   ` Sandra Loosemore
@ 2020-03-08 17:19     ` blatinox
  0 siblings, 0 replies; 8+ messages in thread
From: blatinox @ 2020-03-08 17:19 UTC (permalink / raw)
  To: Sandra Loosemore
  Cc: gcc-patches, Nick Clifton, Richard Earnshaw,
	Ramana Radhakrishnan, Kyrylo Tkachov

Hi Sandra,

On Mon, Feb 24, 2020 at 02:19:21PM -0700, Sandra Loosemore wrote:
> On 2/20/20 3:08 PM, Jérémy Lefaure wrote:
> > Hello,
> > 
> > Ping for https://gcc.gnu.org/ml/gcc-patches/2019-12/msg01081.html.
> > 
> > Thank you,
> > Jérémy
> > 
> > On Sun, Dec 15, 2019 at 07:20:26PM +0100, Jérémy Lefaure wrote:
> > > Hi!
> > > 
> > > Since in ARM state the value of PC is the address of the current
> > > instruction plus 8 bytes, the code inspecting the value of PC stored at
> > > FP + 0 should look at location PC - 16 : PC - 8 points to the stmfd
> > > instruction, PC - 16 points two words before, where the top 8 bits are
> > > set.
> > > 
> > > gcc/
> > > 2019-12-14  Jérémy Lefaure <jeremy@lefaure.fr>
> > > 
> > > 	* config/arm/arm.c (-mpoke-function-name): Fix documentation in comment.
> > > 	* doc/invoke.texi (-mpoke-function-name): Fix documentation.
> > > 
> > 
> 
> The patch looks OK to me from a documentation point of view, but I'm no
> expert about the technical correctness of the change.  Maybe an ARM
> maintainer can review this?
> 

Thank you for taking the time to review this patch.
I hope that an ARM maintainer will have time to review it too.


Thank you,
Jérémy

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

* Re: [PING^2][PATCH] Fix documentation of -mpoke-function-name ARM option
  2020-03-22 18:15 ` Jérémy Lefaure
@ 2020-03-23 14:10   ` Richard Earnshaw
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Earnshaw @ 2020-03-23 14:10 UTC (permalink / raw)
  To: Jérémy Lefaure, Wilco Dijkstra; +Cc: GCC Patches

On 22/03/2020 18:15, Jérémy Lefaure wrote:
> Hi Wilco,
> 
> On Mon, Mar 09, 2020 at 05:53:41PM +0000, Wilco Dijkstra wrote:
>> Hi,
>>
>> There is no single PC offset that is correct given CPUs may use different offsets.
> 
> Isn't it always an offset of 8 in ARM mode and 4 bytes in Thumb mode ?
> At least in ARMv7 and in AArch32 state in ARMv8 ?
> 

No, it depends on the architecture version.  Prior to ARMv5 it was
implementation defined.  Some cores would use +12 in Arm state, others +8.

> 
>> GCC may also schedule the instruction that stores the PC. This feature used to
>> work on early Arms but is no longer functional or useful today, so the best way
>> forward is to remove it altogether. There are many similar options that have
>> been deprecated for years.
>>
> I didn't know that this feature is no longer working. Thank your for the
> info.

The poke-function-name feature depends on the long-deprecated APCS
variant of the procedure call standard (the AAPCS has been the standard
for well over 10 years now).  I don't think we should be adding (or,
now, even trying to fix) features that are dependent on it.  We will be
moving away from codegen support for this type of frame layout in the
not too distant future.

R.

> 
> 
> Thank your for having reviewed my patch,
> Jérémy
> 


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

* Re: [PING^2][PATCH] Fix documentation of -mpoke-function-name ARM option
  2020-03-09 17:53 Wilco Dijkstra
@ 2020-03-22 18:15 ` Jérémy Lefaure
  2020-03-23 14:10   ` Richard Earnshaw
  0 siblings, 1 reply; 8+ messages in thread
From: Jérémy Lefaure @ 2020-03-22 18:15 UTC (permalink / raw)
  To: Wilco Dijkstra; +Cc: GCC Patches

Hi Wilco,

On Mon, Mar 09, 2020 at 05:53:41PM +0000, Wilco Dijkstra wrote:
> Hi,
> 
> There is no single PC offset that is correct given CPUs may use different offsets.

Isn't it always an offset of 8 in ARM mode and 4 bytes in Thumb mode ?
At least in ARMv7 and in AArch32 state in ARMv8 ?


> GCC may also schedule the instruction that stores the PC. This feature used to
> work on early Arms but is no longer functional or useful today, so the best way
> forward is to remove it altogether. There are many similar options that have
> been deprecated for years.
> 
I didn't know that this feature is no longer working. Thank your for the
info.


Thank your for having reviewed my patch,
Jérémy

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

* Re: [PING^2][PATCH] Fix documentation of -mpoke-function-name ARM option
@ 2020-03-09 17:53 Wilco Dijkstra
  2020-03-22 18:15 ` Jérémy Lefaure
  0 siblings, 1 reply; 8+ messages in thread
From: Wilco Dijkstra @ 2020-03-09 17:53 UTC (permalink / raw)
  To: blatinox; +Cc: GCC Patches

Hi,

There is no single PC offset that is correct given CPUs may use different offsets.
GCC may also schedule the instruction that stores the PC. This feature used to
work on early Arms but is no longer functional or useful today, so the best way
forward is to remove it altogether. There are many similar options that have
been deprecated for years.

Cheers,
Wilco

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

end of thread, other threads:[~2020-03-23 14:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-15 18:42 [PATCH] Fix documentation of -mpoke-function-name ARM option Jérémy Lefaure
2020-01-10 10:23 ` [PING][PATCH] " Jérémy Lefaure
2020-02-20 22:08 ` [PING^2][PATCH] " Jérémy Lefaure
2020-02-24 21:19   ` Sandra Loosemore
2020-03-08 17:19     ` blatinox
2020-03-09 17:53 Wilco Dijkstra
2020-03-22 18:15 ` Jérémy Lefaure
2020-03-23 14:10   ` Richard Earnshaw

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