below/HelloSilicon

'Hello world' doesn't work on silicon

pavel-stryber opened this issue · 3 comments

adr X1, helloworld // string to print

adr X1, helloworld needs to be changed to:
adrp x1, helloworld@PAGE
add x1, x1, helloworld@PAGEOFF

below commented

How does it not work? I just re-tested it, and it produces the expected output.

As the data here is read only and contained in the .text segment, I believe it is OK to use adr here.

I've missed to remove '.data' directive from the original source. Sorry for inconvenience.

I had following:

.global _start // Provide program starting address
.align 2

_start: mov x0, #1
	adr x1, helloworld
	mov x2, #13	// length of the string
	mov x16, #4	// write system call
	svc #0x80	// Output the string

	mov x0, #0
	mov x16, #1
	svc #0x80	// call to terminate

.data
helloworld: .ascii "Hello World!\n"
below commented

Always happy to discuss assembly ;) Thanks for asking questions!