Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ARM64] Failed to compile with error "operand 1 should be an integer register" #2

Open
cee1 opened this issue Apr 16, 2020 · 3 comments
Assignees

Comments

@cee1
Copy link

cee1 commented Apr 16, 2020

[PATCH] [ARM64] Use x29 and x30 instead of fp and lr to make GCC
 happy

GCC will abort the compilation with errors:
   "operand 1 should be an integer register ..."

See also https://bugs.webkit.org/show_bug.cgi?id=175512
---
 crt/sel4_arch/aarch64/crt0.S | 4 ++--
 crt/sel4_arch/aarch64/crti.S | 8 ++++----
 crt/sel4_arch/aarch64/crtn.S | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/crt/sel4_arch/aarch64/crt0.S b/crt/sel4_arch/aarch64/crt0.S
index 3bd28b7..d265d06 100644
--- a/crt/sel4_arch/aarch64/crt0.S
+++ b/crt/sel4_arch/aarch64/crt0.S
@@ -12,8 +12,8 @@
 .section .text
 .global _start
 _start:
-	mov fp, #0
-	mov lr, #0
+	mov x29, #0
+	mov x30, #0
 
 	mov x0, sp
 	bl __sel4_start_c
diff --git a/crt/sel4_arch/aarch64/crti.S b/crt/sel4_arch/aarch64/crti.S
index 1119b90..3b85d67 100644
--- a/crt/sel4_arch/aarch64/crti.S
+++ b/crt/sel4_arch/aarch64/crti.S
@@ -12,11 +12,11 @@
 .section .init
 .global _init
 _init:
-	stp fp, lr, [sp, -16]!
-	mov fp, sp
+	stp x29, x30, [sp, -16]!
+	mov x29, sp
 
 .section .fini
 .global _fini
 _fini:
-	stp fp, lr, [sp, -16]!
-	mov fp, sp
+	stp x29, x30, [sp, -16]!
+	mov x29, sp
diff --git a/crt/sel4_arch/aarch64/crtn.S b/crt/sel4_arch/aarch64/crtn.S
index 734ccdc..4af13dc 100644
--- a/crt/sel4_arch/aarch64/crtn.S
+++ b/crt/sel4_arch/aarch64/crtn.S
@@ -10,9 +10,9 @@
  * @TAG(DATA61_BSD)
  */
 .section .init
-	ldp fp, lr, [sp], #16
+	ldp x29, x30, [sp], #16
 	ret
 
 .section .fini
-	ldp fp, lr, [sp], #16
+	ldp x29, x30, [sp], #16
 	ret
-- 
2.25.0

@cee1 cee1 changed the title [ARM64] Failed to compile with error "" [ARM64] Failed to compile with error "operand 1 should be an integer register" Apr 16, 2020
@xurtis
Copy link
Contributor

xurtis commented Apr 17, 2020

Could you please clarify the underlying issue?

Our experience across a number of versions of GCC and clang has shown this not to be an issue in our codebase.

@cee1
Copy link
Author

cee1 commented Apr 23, 2020

It happened during the build process of "seL4 + Linux VMM":

During the compiling, GCC drops error messages, similar to webkit:#175512


Following webkit:#175512, I've made and patch and managed to build the u-boot image "capdl-loader-image-arm-tx2" and boot my TX2 board.

@xurtis
Copy link
Contributor

xurtis commented May 14, 2020

I suspect that it's an issue in GCC7 that has been resolved in later versions.

The issues you linked suggested that the issue was only present in inline assembly, but you do not seem to have encountered any issues assembling the seL4 kernel itself which uses those register names in inline assembly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants