[llvm] [JITLink][AArch32] Add dynamic lookup for relocation fixup infos (PR #71649)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 1 04:18:18 PST 2023
Stefan =?utf-8?q?Gränitz?= <stefan.graenitz at gmail.com>,
Stefan =?utf-8?q?Gränitz?= <stefan.graenitz at gmail.com>,
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>
================
@@ -163,65 +164,107 @@ 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:
+/// FixupInfo base class is required for dynamic lookups.
+struct FixupInfoBase {
+ static const FixupInfoBase *getDynFixupInfo(Edge::Kind K);
+ virtual ~FixupInfoBase() {}
+};
+
+/// FixupInfo checks for Arm edge kinds work on 32-bit words
+struct FixupInfoArm : public FixupInfoBase {
+ bool (*checkOpcode)(uint32_t Wd) = nullptr;
+};
+
+/// FixupInfo check for Thumb32 edge kinds work on a pair of 16-bit halfwords
+struct FixupInfoThumb : public FixupInfoBase {
+ bool (*checkOpcode)(uint16_t Hi, uint16_t Lo) = nullptr;
+};
+
+/// Collection of named constants per fixup kind
///
+/// Mandatory entries:
/// Opcode - Values of the op-code bits in the instruction, with
/// unaffected bits nulled
/// OpcodeMask - Mask with all bits set that encode the op-code
+///
+/// Other common entries:
/// ImmMask - Mask with all bits set that encode the immediate value
/// RegMask - Mask with all bits set that encode the register
///
+/// Specializations can add further custom fields without restrictions.
+///
template <EdgeKind_aarch32 Kind> struct FixupInfo {};
-template <> struct FixupInfo<Arm_Jump24> {
+namespace {
----------------
mikaelholmen wrote:
gcc warns due to the anonymous namespace here (and similarly for FixupInfoArmMova and FixupInfoThumbMov) :
`
../include/llvm/ExecutionEngine/JITLink/aarch32.h:205:20: warning: 'llvm::jitlink::aarch32::FixupInfo<llvm::jitlink::aarch32::Arm_Jump24>' has a base 'llvm::jitlink::aarch32::{anonymous}::FixupInfoArmBranch' whose type uses the anonymous namespace [-Wsubobject-linkage]
205 | template <> struct FixupInfo<Arm_Jump24> : public FixupInfoArmBranch {
| ^~~~~~~~~~~~~~~~~~~~~
`
Is it needed?
https://github.com/llvm/llvm-project/pull/71649
More information about the llvm-commits
mailing list