[PATCH] D139888: [lld][ARM] support absolute thunks for Armv4T Thumb and interworking

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 17 20:38:06 PST 2022


MaskRay accepted this revision.
MaskRay added inline comments.


================
Comment at: lld/ELF/Thunks.cpp:737
+  };
+
+  memcpy(buf, data, sizeof(data));
----------------
delete blank line. 


================
Comment at: lld/ELF/Thunks.cpp:753
+      0xfd, 0xe7,             // b #-6 ; Arm recommended sequence to follow bx pc
+      0x04, 0xf0, 0x1f, 0xe5, // ldr pc, [pc, #-4]
+      0x00, 0x00, 0x00, 0x00, // L1: .word S
----------------



================
Comment at: lld/ELF/Thunks.cpp:756
+  };
+
+  memcpy(buf, data, sizeof(data));
----------------
delete blank line. 


================
Comment at: lld/ELF/Thunks.cpp:777
+  };
+
+  memcpy(buf, data, sizeof(data));
----------------
delete blank line.


================
Comment at: lld/ELF/Thunks.cpp:795
+      0x1c, 0xff, 0x2f, 0xe1, //     bx ip
+      0x00, 0x00, 0x00, 0x00, // L2: .word S - (P + (L1 - P) + 8)
+  };
----------------
`S - (P + (L1 - P) + 8)` can be simplified


================
Comment at: lld/ELF/Thunks.cpp:1160
+      return make<ARMV4PILongThunk>(s, a);
+    else if (thumb_target)
+      return make<ARMV4ABSLongBXThunk>(s, a);
----------------
ditto below


================
Comment at: lld/ELF/Thunks.cpp:1237
+      return addThunkV6M(reloc, s, a);
+    else if (config->armHasBlx)
+      return addThunkArmv5v6(reloc, s, a);
----------------



================
Comment at: lld/test/ELF/arm-bl-v4t.s:2
+// REQUIRES: arm
+// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv4t-none-linux-gnueabi %s -o %t
+// RUN: echo "SECTIONS { \
----------------
Use `split-file %s %t`. See some new tests


================
Comment at: lld/test/ELF/arm-bl-v4t.s:21
+
+// On Armv4T there is no blx instruction so long branch/exchange looks slightly
+// different.
----------------
`///` for non-RUN non-CHECK comments


================
Comment at: lld/test/ELF/arm-bx-v4t.s:59
+  bx lr
+// FAR: 06000000 <target>:
+// FAR-NEXT: 6000000: f000 f802    	bl	0x6000008 <__Thumbv4ABSLongBXThunk__start> @ imm = #0x4
----------------
`FAR-LABEL: <target>:` (omit addresses so that diagnostics will be better in case of an error)


================
Comment at: lld/test/ELF/arm-bx-v4t.s:73
+
+// NEAR: 01000014 <target>:
+// NEAR-NEXT:  1000014: f000 f802    	bl	0x100001c <__Thumbv4ABSLongBXThunk__start> @ imm = #0x4
----------------
Align (omit addresses so that diagnostics will be better in case of an error))


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139888/new/

https://reviews.llvm.org/D139888



More information about the llvm-commits mailing list