flat assembler
Message board for the users of flat assembler.

Index > Non-x86 architectures > FASM ARM32-ARM64 Development

Author
Thread Post new topic Reply to topic
alCoPaUL



Joined: 20 Jun 2023
Posts: 4
Location: NYC
alCoPaUL 02 Jul 2023, 21:22
hey, this is my first post.

i see that the webpage of fasmarm is current as of this month of 2023.

i just wanna share an example of Quine in ARM64. as a benchmark or a sample.

it runs in latest Ubuntu (Linux on Windows Subsystem) with the arm64 cross compilers and libc6 (arm64). there's a bug tho after building an ARM64 executable - it assumes that it runs in an ARM64 Ubuntu Distro and hardcodely references a file that is not there. so you have to move files from folder to folder. the said missing file when ARM64 executables are run are there, installed.

thanks..

save as printfarm64.asm

Code:
/*
;
; aarch64-linux-gnu-as printfarm64.asm -o printfarm64.o
; aarch64-linux-gnu-ld -lc /usr/aarch64-linux-gnu/lib/libc.so.6 -o printfarm64 printfarm64.o
;
;  ***     copy the contents of /usr/aarch64-linux-gnu/lib/ to /lib/
;
;  ****    dpkg -L libc6-arm64-cross | grep -i ld-linux-aarch64.so.1
;          /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1
;
;  *****   dpkg -L libc6 | grep -i libc.so.6
;          /usr/aarch64-linux-gnu/lib/libc.so.6
;
;;
;~ House Of Guillermo [GIMO]
;~~ alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf], NYC 7/1/2023 5:46 PM EDT - 7/2/2023 5:11 PM EDT
;
*/
.section .text
.global _start
.extern printf,putchar,exit
_start:
LDR X0,=msg
BL printf
MOV X0,34
BL putchar
LDR X0,=msg
BL printf
MOV X0,34
BL putchar
MOV X0,0
BL exit
.section .data
msg:.asciz "/*
;
; aarch64-linux-gnu-as printfarm64.asm -o printfarm64.o
; aarch64-linux-gnu-ld -lc /usr/aarch64-linux-gnu/lib/libc.so.6 -o printfarm64 printfarm64.o
;
;  ***     copy the contents of /usr/aarch64-linux-gnu/lib/ to /lib/
;
;  ****    dpkg -L libc6-arm64-cross | grep -i ld-linux-aarch64.so.1
;          /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1
;
;  *****   dpkg -L libc6 | grep -i libc.so.6
;          /usr/aarch64-linux-gnu/lib/libc.so.6
;
;;
;~ House Of Guillermo [GIMO]
;~~ alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf], NYC 7/1/2023 5:46 PM EDT - 7/2/2023 5:11 PM EDT
;
*/
.section .text
.global _start
.extern printf,putchar,exit
_start:
LDR X0,=msg
BL printf
MOV X0,34
BL putchar
LDR X0,=msg
BL printf
MOV X0,34
BL putchar
MOV X0,0
BL exit
.section .data
msg:.asciz "    


this has no errors if it can be roundtripped .. 1.) as/ld printfarm64.asm 2.) ./printfarm64 > arm64xx2.asm 3.) go to 1 replacing printfarm64.asm with arm64xx2.asm 4.) ./arm64xx2 5.) and so on..

assembling the source will generate warnings that can be not taken seriously coz the processes are alright..
Post 02 Jul 2023, 21:22
View user's profile Send private message Visit poster's website Reply with quote
alCoPaUL



Joined: 20 Jun 2023
Posts: 4
Location: NYC
alCoPaUL 02 Jul 2023, 22:41
btw, the linux arm64 architecture is via qemu and the website of Azeria helped me to setup my ARM dev box...

https://azeria-labs.com/arm-on-x86-qemu-user/

regards,
Post 02 Jul 2023, 22:41
View user's profile Send private message Visit poster's website Reply with quote
alCoPaUL



Joined: 20 Jun 2023
Posts: 4
Location: NYC
alCoPaUL 04 Jul 2023, 06:01
ARM32

Code:
/*
;
;  arm-linux-gnueabihf-as 32Ge.asm -o 32Ge.o
;  arm-linux-gnueabihf-gcc -static -o 32Ge 32Ge.o
;
;~~ arm32quine v1.0-044
;
;~ House Of Guillermo [GIMO]
;~~ alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf], NYC 7/3/2023 1:40 AM
*/
.section .text
.global main
.extern printf,putchar,exit
main:
LDR R0,=msg
BL printf
MOV R0,#34
BL putchar
LDR R0,=msg
BL printf
MOV R0,#34
BL putchar
MOV R0,#0
BL exit
.section .data
msg:.asciz "/*
;
;  arm-linux-gnueabihf-as 32Ge.asm -o 32Ge.o
;  arm-linux-gnueabihf-gcc -static -o 32Ge 32Ge.o
;
;~~ arm32quine v1.0-044
;
;~ House Of Guillermo [GIMO]
;~~ alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf], NYC 7/3/2023 1:40 AM
*/
.section .text
.global main
.extern printf,putchar,exit
main:
LDR R0,=msg
BL printf
MOV R0,#34
BL putchar
LDR R0,=msg
BL printf
MOV R0,#34
BL putchar
MOV R0,#0
BL exit
.section .data
msg:.asciz "
    
Post 04 Jul 2023, 06:01
View user's profile Send private message Visit poster's website Reply with quote
alCoPaUL



Joined: 20 Jun 2023
Posts: 4
Location: NYC
alCoPaUL 07 Jul 2023, 23:58
Code:
/*
;
; aarch64-linux-gnu-as printfarm64.asm -o printfarm64.o
; aarch64-linux-gnu-gcc -static -o printfarm64 printfarm64.o
;
;;
;~ House Of Guillermo [GIMO]
;~~ alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf], NYC 7/1/2023 5:46 PM EDT - 7/2/2023 5:11 PM EDT
;
*/
.section .text
.global main
.extern printf,putchar,exit
main:
LDR X0,=msg
BL printf
MOV X0,34
BL putchar
LDR X0,=msg
BL printf
MOV X0,34
BL putchar
MOV X0,0
BL exit
.section .data
msg:.asciz "/*
;
; aarch64-linux-gnu-as printfarm64.asm -o printfarm64.o
; aarch64-linux-gnu-gcc -static -o printfarm64 printfarm64.o
;
;;
;~ House Of Guillermo [GIMO]
;~~ alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf], NYC 7/1/2023 5:46 PM EDT - 7/2/2023 5:11 PM EDT
;
*/
.section .text
.global main
.extern printf,putchar,exit
main:
LDR X0,=msg
BL printf
MOV X0,34
BL putchar
LDR X0,=msg
BL printf
MOV X0,34
BL putchar
MOV X0,0
BL exit
.section .data
msg:.asciz "    


with qemu, aarch64 & arm cross build tools under Debian GNU/Linux 11, Ubuntu 22.04.2 LTS (Windows Subsystem For Linux)
Post 07 Jul 2023, 23:58
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.