Skip to contentSkip to conversation

xen/arm32: head: Fix build when using GAS 2.25.0

PATCH In review Julien Grall 4 participants 4 messages Sep 30, 2019 – Oct 1, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm32: head: Fix build when using GAS 2.25.0

GAS 2.25.0 throws multiple errors when building arm32/head.S:

arm32/head.S: Assembler messages:
arm32/head.S:452: Error: invalid constant (f7f) after fixup arm32/head.S:453: Error: invalid constant (f7f) after fixup arm32/head.S:495: Error: invalid constant (f7f) after fixup arm32/head.S:510: Error: invalid constant (f7f) after fixup arm32/head.S:514: Error: invalid constant (f7f) after fixup arm32/head.S:516: Error: invalid constant (f7f) after fixup arm32/head.S:633: Error: invalid constant (f7f) after fixup

This makes sense because the instruction mov is only able to deal with a specific set of immediate (see "modified immediate constants in ARM instructions"). For any 16-bit immediate, the instruction movw should be used.

It looks like newer version of GAS will seemly switch to movw if the immediate does not fit in the immediate encoding for mov. But we should not rely on this. So switch to movw.

Fixes 23dfe48d10 ("xen/arm32: head: Introduce macros to create table and mapping entry")
---
 xen/arch/arm/arm32/head.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/arm32/head.S +2 -2
index 2fc312f9e0..e9d356f05c 100644
@@ -383,7 +383,7 @@ ENDPROC(cpu_init)
         ldr   r4, =\tbl
         add   r4, r4, r10            /* r4 := paddr(\tlb) */
 
-        mov   r2, #PT_PT             /* r2:r3 := right for linear PT */
+        movw  r2, #PT_PT             /* r2:r3 := right for linear PT */
         orr   r2, r2, r4             /*           + \tlb paddr */
         mov   r3, #0
 
@@ -419,7 +419,7 @@ ENDPROC(cpu_init)
         lsr   r4, \phys, #THIRD_SHIFT
         lsl   r4, r4, #THIRD_SHIFT   /* r4 := PAGE_ALIGNED(phys) */
 
-        mov   r2, #\type             /* r2:r3 := right for section PT */
+        movw  r2, #\type             /* r2:r3 := right for section PT */
         orr   r2, r2, r4             /*          + PAGE_ALIGNED(phys) */
         mov   r3, #0
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 16 lines · Julien Grall

GAS 2.25.0 throws multiple errors when building arm32/head.S:

arm32/head.S: Assembler messages:
arm32/head.S:452: Error: invalid constant (f7f) after fixup arm32/head.S:453: Error: invalid constant (f7f) after fixup arm32/head.S:495: Error: invalid constant (f7f) after fixup arm32/head.S:510: Error: invalid constant (f7f) after fixup arm32/head.S:514: Error: invalid constant (f7f) after fixup arm32/head.S:516: Error: invalid constant (f7f) after fixup arm32/head.S:633: Error: invalid constant (f7f) after fixup

This makes sense because the instruction mov is only able to deal with a specific set of immediate (see "modified immediate constants in ARM instructions"). For any 16-bit immediate, the instruction movw should be used.

Quoted 7 lines

It looks like newer version of GAS will seemly switch to movw if the immediate does not fit in the immediate encoding for mov. But we should not rely on this. So switch to movw.

Fixes 23dfe48d10 ("xen/arm32: head: Introduce macros to create table and mapping entry")

FWIW, Tested-by: Andrew Cooper <[email protected]>, only insofar as it fixing the build.  I haven't booted the resulting binary.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by
#2 lore raw
Quoted 21 lines · Andrew Cooper
Quoted 20 lines · Julien Grall

GAS 2.25.0 throws multiple errors when building arm32/head.S:

arm32/head.S: Assembler messages:
arm32/head.S:452: Error: invalid constant (f7f) after fixup arm32/head.S:453: Error: invalid constant (f7f) after fixup arm32/head.S:495: Error: invalid constant (f7f) after fixup arm32/head.S:510: Error: invalid constant (f7f) after fixup arm32/head.S:514: Error: invalid constant (f7f) after fixup arm32/head.S:516: Error: invalid constant (f7f) after fixup arm32/head.S:633: Error: invalid constant (f7f) after fixup

This makes sense because the instruction mov is only able to deal with a specific set of immediate (see "modified immediate constants in ARM instructions"). For any 16-bit immediate, the instruction movw should be used.

It looks like newer version of GAS will seemly switch to movw if the immediate does not fit in the immediate encoding for mov. But we should not rely on this. So switch to movw.

Quoted 6 lines
Quoted 3 lines
Fixes 23dfe48d10 ("xen/arm32: head: Introduce macros to create table and mapping entry")

FWIW, Tested-by: Andrew Cooper <[email protected]>, only insofar as it fixing the build.  I haven't booted the resulting binary.

Given that this is a straightforward build fix, and due to timezone differences, I have committed it (after verifying it fixes the build myself). I hope that Juergen approves.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 26 lines · Stefano Stabellini
Quoted 25 lines · Andrew Cooper
Quoted 23 lines · Julien Grall

GAS 2.25.0 throws multiple errors when building arm32/head.S:

arm32/head.S: Assembler messages:
arm32/head.S:452: Error: invalid constant (f7f) after fixup arm32/head.S:453: Error: invalid constant (f7f) after fixup arm32/head.S:495: Error: invalid constant (f7f) after fixup arm32/head.S:510: Error: invalid constant (f7f) after fixup arm32/head.S:514: Error: invalid constant (f7f) after fixup arm32/head.S:516: Error: invalid constant (f7f) after fixup arm32/head.S:633: Error: invalid constant (f7f) after fixup

This makes sense because the instruction mov is only able to deal with a specific set of immediate (see "modified immediate constants in ARM instructions"). For any 16-bit immediate, the instruction movw should be used.

It looks like newer version of GAS will seemly switch to movw if the immediate does not fit in the immediate encoding for mov. But we should not rely on this. So switch to movw.

Fixes 23dfe48d10 ("xen/arm32: head: Introduce macros to create table and mapping entry")
Quoted 9 lines
Quoted 2 lines

FWIW, Tested-by: Andrew Cooper <[email protected]>, only insofar as it fixing the build.  I haven't booted the resulting binary.

Given that this is a straightforward build fix, and due to timezone differences, I have committed it (after verifying it fixes the build myself). I hope that Juergen approves.

I do.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel