On Thu, 17 Nov 2016, Janne Grunau wrote:

On 2016-11-14 00:24:46 +0200, Martin Storsjö wrote:
Check these constraints even for non-pic-elf configurations, to
catch the issues without having to build/test a pic-elf configuration
to find out.
---
This would have caught the issue in the vp9mc, without actually
having to test a pic configuration.
---
 libavutil/arm/asm.S | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
index 4ac0ea2..55aa5ff 100644
--- a/libavutil/arm/asm.S
+++ b/libavutil/arm/asm.S
@@ -184,6 +184,14 @@ T       ldr             \rd, [\rd]
 .endm

 .macro  movrelx         rd,  val, gp
+    .ifc \rd,r12
+      .ifb \gp
+        .error          "movrelx rd=r12, needs a manually set gp"
+      .endif
+    .endif
+    .ifc \gp,\rd
+        .error          "movrelx rd=gp doesn't work"
+    .endif

this doesn't work as movrelx is intended, the register holding the GOT
is saved via the gp register alias. Following should prevent at least
the using r12 as rd error:

diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
index 4ac0ea2..49f0a49 100644
--- a/libavutil/arm/asm.S
+++ b/libavutil/arm/asm.S
@@ -185,17 +185,23 @@ T       ldr             \rd, [\rd]

.macro  movrelx         rd,  val, gp
#if CONFIG_PIC && defined(__ELF__)
+    .ifc \rd,r12
+      .if .Lpic_gp == 12
+        .error          "movrelx rd=r12, needs a manually set gp"

I don't see how this would error out at all, for "movrelx r12, X(foo)" though, which was the situation I had.

Wouldn't it need something like this:

      .if .Lpic_gp == 12
        .error          "movrelx rd=r12, needs a manually set gp"
      .elseif !.Lpic_gp
        .error          "movrelx rd=r12, needs a manually set gp"
      .if

+      .endif
+    .endif
+    @ not sure if this should end up in in the patch
+    .ifc \gp,r12
+        .error "you are an evil person"
+    .endif

Something like that should probably be included, but with a more serious message :P

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to