[1/2] arm: Clear the gp register alias at the end of functions

Message ID 1478777225-8920-1-git-send-email-martin@martin.st
State Committed
Commit 824e8c284054f323f854892d1b4739239ed1fdc7
Headers show

Commit Message

Martin Storsjö Nov. 10, 2016, 11:27 a.m.
We reset .Lpic_gp to zero at the start of each function, which means
that the logic within movrelx for clearing gp when necessary will
be missed.

This fixes using movrelx in different functions with a different
helper register.
---
 libavutil/arm/asm.S | 3 +++
 1 file changed, 3 insertions(+)

Comments

Martin Storsjö Nov. 10, 2016, noon | #1
On Thu, 10 Nov 2016, Martin Storsjö wrote:

> We reset .Lpic_gp to zero at the start of each function, which means
> that the logic within movrelx for clearing gp when necessary will
> be missed.
>
> This fixes using movrelx in different functions with a different
> helper register.
> ---
> libavutil/arm/asm.S | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
> index 1a048b5..4ac0ea2 100644
> --- a/libavutil/arm/asm.S
> +++ b/libavutil/arm/asm.S
> @@ -83,6 +83,9 @@ ELF     .section .note.GNU-stack,"",%progbits @ Mark stack as non-executable
>         put_pic         %(.Lpic_idx - 1)
>         .noaltmacro
>       .endif
> +      .if .Lpic_gp
> +        .unreq          gp
> +      .endif
> ELF     .size   \name, . - \name
> FUNC    .endfunc
>         .purgem endfunc
> -- 
> 2.7.4

OK'd by Janne on irc.

// Martin

Patch

diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
index 1a048b5..4ac0ea2 100644
--- a/libavutil/arm/asm.S
+++ b/libavutil/arm/asm.S
@@ -83,6 +83,9 @@  ELF     .section .note.GNU-stack,"",%progbits @ Mark stack as non-executable
         put_pic         %(.Lpic_idx - 1)
         .noaltmacro
       .endif
+      .if .Lpic_gp
+        .unreq          gp
+      .endif
 ELF     .size   \name, . - \name
 FUNC    .endfunc
         .purgem endfunc