Disassembly bug with LDR addresses

Used for discussing the various tools in the book as well as encouraging members to share tools

Disassembly bug with LDR addresses

Postby Siguza » Mon Apr 18, 2016 4:36 pm

jtool and disarm both disassemble LDR addresses to 1/4 of what they should be.

bash$ cat one.S
ldr w0, #4
bash$ aarch64-elf-as -o one.o one.S
bash$ aarch64-elf-objcopy -O binary one.o one.b
bash$ disarm one.b
0x00000000 0x18000020 LDR W0, #1

bash$ cat two.S
.section __TEXT,__text,regular,pure_instructions
.ios_version_min 9, 3
.globl _main
.align 2
ldr w0, #4
bash$ xcrun -sdk iphoneos as -arch arm64 -o two.o two.S
bash$ xcrun -sdk iphoneos ld -arch arm64 -ios_version_min 9.3 -L$iSDK/usr/lib -lSystem -o two two.o
bash$ jtool -d two
Warning: companion file ./two.ARM64.58E3340D-6AC2-3250-8EA2-341DF970B78B not found
Disassembling from file offset 0x7fb4, Address 0x100007fb4
; // function #1
100007fb4 LDR W0, #1 ; X0 = *(100007fb8) = 1 ... ?
Done 1
User avatar
Posts: 200
Joined: Thu Jan 28, 2016 10:38 am

Re: Disassembly bug with LDR addresses

Postby morpheus » Mon Apr 18, 2016 8:54 pm

Thank you! Noted and fixed. Needed a <<2 there.

Reason why jtool/disarm report same is because they are both compiled with same library.

Updates to both coming soon

Site Admin
Posts: 650
Joined: Thu Apr 11, 2013 6:24 pm

Return to Tools

Who is online

Users browsing this forum: Google [Bot] and 1 guest