Hi Arm experts,
I have a load command to load a structure in assembly code as below:
adrp x4,ASM_NAME(forkx)
This load instruction is not giving the proper address of the structure that i have intended: took the gdb trace at this point and following is the details:
1. We can see the register content at the time of load and x4 have 0x55783dd000
(gdb) info registers
x0 0x30a0 12448
x1 0x0 0
x2 0x7fdf1bf6b0 549203998384
x3 0x55ad57f898 367980443800
x4 0x55783dd000 367089537024
x5 0x0 0
x6 0x1 1
2. If i see the forkx address it is:
(gdb) print &forkx$13 = (sprocess * __be *) 0x55783dd5c0 <__be_forkx>
My intention is to load the address 0x55783dd5c0 but it is loading 0x55783dd000. this is causing the issue in the subsequent commands as invalid address is gettig accessed.
Is this is a known behaviour with adrp? do i need to handle this with any other way? Please help me in this. Thanks.
Thanks for the reply,
AASM_NAME(forkx) will be converted to __be_forkx by the compiler and at the runtime it should have got the address from thisa__be_forkx have the address as mention in the trace above and same is not loaded by ADRP command.you mentioned "The behavior is not only known, but also designed as such", with this do you mean to say this is the expected behavior using ADRP instruction?I am using aarch64 architecture and reading the manual and usage of the instruction with arm link below:http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0040d/Bgbbihdc.html - As per this, it should load the address of the symbol specified.Please let me know if you have any input on this.
DeepakHegde said:I am using aarch64 architecture and reading the manual and usage of the instruction with arm link below:http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0040d/Bgbbihdc.html - As per this, it should load the address of the symbol specified.Please let me know if you have any input on this.
The article linked (1) isn't the architecture's manual, and (2) doesn't describe adrp.
Thanks a lot for the reply surati, got what i need to do. and understood how adrp works.