Accessing sda_rel data in assembler

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Accessing sda_rel data in assembler

Jump to solution
1,811 Views
Karl_H
Contributor III

I have a global variable declared in a C module that I need to access from an assembler module. If I disassemble the C code, I can see that it is using addressing relative to r13 to access this data.

 

My question is, in assembler, what is the syntax to do this same kind of access? How do I tell the assembler to form the relative offset of myVar from the base of its data section (which is .sbss).

 

.extern myVar 

    lzw    r3, (myVar ???) (r13)

 

What do I put in the ??? spot to tell it that this offset is relative to _ABS_SDA_BASE_ ?

 

Karl

Labels (1)
0 Kudos
Reply
1 Solution
1,191 Views
stanish
NXP Employee
NXP Employee

Hello Karl,

 

I'd suggest you to try this syntax:

 

lwz r3,myVar@sdax(r13) 

 

 

 Stanish

View solution in original post

0 Kudos
Reply
2 Replies
1,192 Views
stanish
NXP Employee
NXP Employee

Hello Karl,

 

I'd suggest you to try this syntax:

 

lwz r3,myVar@sdax(r13) 

 

 

 Stanish

0 Kudos
Reply
1,191 Views
Karl_H
Contributor III

Thanks so much. The version of the assembler reference manual that I was using doesn't list that magic word. But after seeing your reply, I added "sdax" to my google search that I was doing on this last week and it pointed me to a better version of the assembler reference manual that has this token documented as a way of doing small-data-relative accesses. It has other good stuff that my original version doesn't as well.

 

Karl

 

0 Kudos
Reply