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"
+ .endif
+ .endif
+ @ not sure if this should end up in in the patch
+ .ifc \gp,r12
+ .error "you are an evil person"
+ .endif
.ifnb \gp
.if .Lpic_gp
.unreq gp
.endif
gp .req \gp
ldpic gp, _GLOBAL_OFFSET_TABLE_
+ .set .Lpic_gp, 1
.elseif !.Lpic_gp
gp .req r12
ldpic gp, _GLOBAL_OFFSET_TABLE_
+ .set .Lpic_gp, 12
.endif
- .set .Lpic_gp, 1
ldr \rd, .Lpicoff\@
ldr \rd, [gp, \rd]
def_pic \val(GOT), .Lpicoff\@
Using r12 as gp could be valid if r12 was clobbered between two movrelx
Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel