Closed
Description
I cloned the repo, did cd HelloSilicon/Chapter\ 02
, ran make
then ran these commands:
objdump -d movexamps
objdump -d -M no-aliases movexamps
objdump -d --macho movexamps
objdump -d --macho -M no-aliases movexamps
These 3
objdump -d movexamps
objdump -d --macho movexamps
objdump -d --macho -M no-aliases movexamps
produce the same disassembly:
$ objdump -d movexamps
movexamps: file format mach-o arm64
Disassembly of section __TEXT,__text:
0000000100003f7c <_start>:
100003f7c: 42 c7 8d d2 mov x2, #28218
100003f80: a2 eb a9 f2 movk x2, #20317, lsl #16
100003f84: 82 db df f2 movk x2, #65244, lsl #32
100003f88: 82 46 e2 f2 movk x2, #4660, lsl #48
100003f8c: e1 03 02 2a mov w1, w2
100003f90: 41 f8 7f d3 lsl x1, x2, #1
100003f94: 41 fc 41 d3 lsr x1, x2, #1
100003f98: 41 fc 41 93 asr x1, x2, #1
100003f9c: 41 04 c2 93 ror x1, x2, #1
100003fa0: 01 60 b5 d2 mov x1, #2868903936
100003fa4: a1 05 80 12 mov w1, #-46
100003fa8: 21 00 80 12 mov w1, #-2
100003fac: 00 00 80 d2 mov x0, #0
100003fb0: 30 00 80 d2 mov x16, #1
100003fb4: 01 10 00 d4 svc #0x80
$ objdump -d --macho movexamps
movexamps:
(__TEXT,__text) section
_start:
100003f7c: 42 c7 8d d2 mov x2, #28218
100003f80: a2 eb a9 f2 movk x2, #20317, lsl #16
100003f84: 82 db df f2 movk x2, #65244, lsl #32
100003f88: 82 46 e2 f2 movk x2, #4660, lsl #48
100003f8c: e1 03 02 2a mov w1, w2
100003f90: 41 f8 7f d3 lsl x1, x2, #1
100003f94: 41 fc 41 d3 lsr x1, x2, #1
100003f98: 41 fc 41 93 asr x1, x2, #1
100003f9c: 41 04 c2 93 ror x1, x2, #1
100003fa0: 01 60 b5 d2 mov x1, #2868903936
100003fa4: a1 05 80 12 mov w1, #-46
100003fa8: 21 00 80 12 mov w1, #-2
100003fac: 00 00 80 d2 mov x0, #0
100003fb0: 30 00 80 d2 mov x16, #1
100003fb4: 01 10 00 d4 svc #0x80
$ objdump -d --macho -M no-aliases movexamps
movexamps:
(__TEXT,__text) section
_start:
100003f7c: 42 c7 8d d2 mov x2, #28218
100003f80: a2 eb a9 f2 movk x2, #20317, lsl #16
100003f84: 82 db df f2 movk x2, #65244, lsl #32
100003f88: 82 46 e2 f2 movk x2, #4660, lsl #48
100003f8c: e1 03 02 2a mov w1, w2
100003f90: 41 f8 7f d3 lsl x1, x2, #1
100003f94: 41 fc 41 d3 lsr x1, x2, #1
100003f98: 41 fc 41 93 asr x1, x2, #1
100003f9c: 41 04 c2 93 ror x1, x2, #1
100003fa0: 01 60 b5 d2 mov x1, #2868903936
100003fa4: a1 05 80 12 mov w1, #-46
100003fa8: 21 00 80 12 mov w1, #-2
100003fac: 00 00 80 d2 mov x0, #0
100003fb0: 30 00 80 d2 mov x16, #1
100003fb4: 01 10 00 d4 svc #0x80
$
Only -M no-aliases
without --macho
changes any instructions
$ objdump -d -M no-aliases movexamps
movexamps: file format mach-o arm64
Disassembly of section __TEXT,__text:
0000000100003f7c <_start>:
100003f7c: 42 c7 8d d2 mov x2, #28218
100003f80: a2 eb a9 f2 movk x2, #20317, lsl #16
100003f84: 82 db df f2 movk x2, #65244, lsl #32
100003f88: 82 46 e2 f2 movk x2, #4660, lsl #48
100003f8c: e1 03 02 2a orr w1, wzr, w2
100003f90: 41 f8 7f d3 lsl x1, x2, #1
100003f94: 41 fc 41 d3 lsr x1, x2, #1
100003f98: 41 fc 41 93 asr x1, x2, #1
100003f9c: 41 04 c2 93 extr x1, x2, x2, #1
100003fa0: 01 60 b5 d2 mov x1, #2868903936
100003fa4: a1 05 80 12 mov w1, #-46
100003fa8: 21 00 80 12 mov w1, #-2
100003fac: 00 00 80 d2 mov x0, #0
100003fb0: 30 00 80 d2 mov x16, #1
100003fb4: 01 10 00 d4 svc #0x80
Although it only changes mov w1, w2
-> orr w1, wzr, w2
and ror x1, x2, #1
-> extr x1, x2, x2, #1
. I was promised that
HelloSilicon/Chapter 02/movexamps.s
Lines 37 to 41 in 9fc970d
but it stays the same
100003fa4: a1 05 80 12 mov w1, #-46
100003fa8: 21 00 80 12 mov w1, #-2
I'm on an M1 Macbook Air, macOS 13.2.1, Xcode version 14.1 (14B47b)
$ as --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ objdump --version
Apple LLVM version 14.0.0 (clang-1400.0.29.202)
Optimized build.
Default target: arm64-apple-darwin22.3.0
Host CPU: apple-a12
[...]
$ softwareupdate --list
Software Update Tool
Finding available software
No new software available.
Metadata
Metadata
Assignees
Labels
No labels