X11 ASM code fails to run


dmarschal

Member
Joined
Feb 13, 2009
Messages
116
Location
Hungary
Website
www.marschalgrips.com
Hello,


I have problems running the following code:



Code:
.text

.data


.extern XOpenDisplay

.extern XCloseDisplay


.globl _start

_start:

mov r0,#0

bl XOpenDisplay


bl XCloseDisplay


mov r0,#0

mov r7,#1

swi 0


.bss

.end



I tried to assemble it from cdevtools 0.0.39



Code:
as xwin.s -o xwin.o

ld -lX11 -L../../usr/lib xwin.o -o xwin



When I want to run the executable I get



Code:
-bash: ./xwin: No such file or directory



(I also receive the same error when trying to run GLES2 code.)



The file is here, and 'file xwin' says



Code:
xwin: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped


The C version works fine. What libraries or LD options the code is missing?


By the way, PandoraWaveBreaker does not compile, it cannot find 'pvrPVR2D_X11WSEGL'.


Thanks,


Dennis
 
Code:
.text

.data

...

_start:

mov r0,#0
Code in data section? Don't know if that's supposed to work.

I tried to assemble it from cdevtools 0.0.39
Can they compile C hello world? That "not found" error usually comes when incorrect dynamic linker is set in the binary (usually means wrong/bad toolchain).
 
Last edited by a moderator:
I usually assemble and link with gcc, even if there's nothing but assembly. That should take care of whatever libraries you need. It'll also run the C preprocessor on .S files.


If you run gcc with -v you can see what it's linking by default.
 
I usually assemble and link with gcc, even if there's nothing but assembly. That should take care of whatever libraries you need. It'll also run the C preprocessor on .S files.


If you run gcc with -v you can see what it's linking by default.

Thank you! I will check that and report back.


On code in .data section. It works fine and I use it when I have to modify memory. This saves a lot of memory for storing .data offsets in .text section.
 
Back
Top