Accessing sda_rel data in assembler

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Accessing sda_rel data in assembler

跳至解决方案
1,829 次查看
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

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,209 次查看
stanish
NXP Employee
NXP Employee

Hello Karl,

 

I'd suggest you to try this syntax:

 

lwz r3,myVar@sdax(r13) 

 

 

 Stanish

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,210 次查看
stanish
NXP Employee
NXP Employee

Hello Karl,

 

I'd suggest you to try this syntax:

 

lwz r3,myVar@sdax(r13) 

 

 

 Stanish

0 项奖励
回复
1,209 次查看
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 项奖励
回复