[llvm] [JITLink][AArch32] Add dynamic lookup for relocation fixup infos (PR #71649)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 09:32:33 PST 2023


Stefan =?utf-8?q?Gränitz?= <stefan.graenitz at gmail.com>,
Stefan =?utf-8?q?Gränitz?= <stefan.graenitz at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/71649 at github.com>


================
@@ -155,68 +164,130 @@ struct HalfWords {
   const uint16_t Lo; // Second halfword
 };
 
-/// Collection of named constants per fixup kind. It may contain but is not
-/// limited to the following entries:
+struct FixupInfoBase {
+  virtual ~FixupInfoBase() {}
+};
----------------
lhames wrote:

Did you consider using a function pointer in `FixupInfoBaseArm` and `FixupInfoBaseThumb`? I think that'd save you one indirection (for the vtable lookup) each time:

```
struct FixupInfoBaseArm {
  bool (*checkOpcode)(uint32_t Wd) const = nullptr;
};

struct FixupInfoBaseThumb {
  bool (*checkOpcode)(uint16_t Hi, uint16_t Lo) const = nullptr;
};
```

It might also give you the option to dynamically disable opcode checks (by using a null `checkOpcode` member) in the case where the input is trusted (e.g. an in-memory object just generated by a trusted compiler)


https://github.com/llvm/llvm-project/pull/71649


More information about the llvm-commits mailing list