# \[PATCH\] powerpc/8xx: Force VIRT\_IMMR\_BASE to be a positive number

- Subsystems: LINUX FOR POWERPC (32-BIT AND 64-BIT), THE REST
- Maintainers: Madhavan Srinivasan, Linus Torvalds
- List: linuxppc-dev
- 1 message, 1 author
- Page: https://ratatoskr.run/linuxppc-dev/2016/07/9491080/t

## \[PATCH\] powerpc/8xx: Force VIRT\_IMMR\_BASE to be a positive number

- From: Scott Wood \<oss@buserror.net\>
- Date: 2016-07-09 08:28:49 
- Message: https://ratatoskr.run/linuxppc-dev/2016/07/9491080.md

```text
The asm-offsets mechanism generates signed numbers, even if the
input value is explicitly unsigned.  This causes a problem with
older binutils (e.g. 2.23), which sign-extend a negative number
when @h is applied.  Thus, this instruction:

	cmpli   cr0, r11, VIRT_IMMR_BASE@h

resulted in this:

Error: operand out of range (0xfffffff0 is not between 0x00000000 and
0x0000ffff)

By casting to a larger type, we can force the output to be expressed
as a positive number.

Signed-off-by: Scott Wood <oss@buserror.net>
Cc: Christophe Leroy <redacted>
---
 arch/powerpc/kernel/asm-offsets.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 247f640..b89d14c 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -754,7 +754,7 @@ int main(void)
 	DEFINE(PPC_DBELL_SERVER, PPC_DBELL_SERVER);
 
 #ifdef CONFIG_PPC_8xx
-	DEFINE(VIRT_IMMR_BASE, __fix_to_virt(FIX_IMMR_BASE));
+	DEFINE(VIRT_IMMR_BASE, (u64)__fix_to_virt(FIX_IMMR_BASE));
 #endif
 
 	return 0;
-- 
2.7.4
```
