[llvm] [JITLink][AArch32] Unittest for error paths of readAddend and applyFixup functionality (PR #69636)
Stefan Gränitz via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 7 03:00:40 PST 2023
================
@@ -0,0 +1,113 @@
+//===------- AArch32ErrorTests.cpp - Test AArch32 error handling ----------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <llvm/ExecutionEngine/JITLink/aarch32.h>
+
+#include "llvm/Testing/Support/Error.h"
+#include "gtest/gtest.h"
+
+using namespace llvm;
+using namespace llvm::jitlink;
+using namespace llvm::jitlink::aarch32;
+using namespace llvm::support;
+using namespace llvm::support::endian;
+
+constexpr unsigned PointerSize = 4;
+auto G = std::make_unique<LinkGraph>("foo", Triple("armv7-linux-gnueabi"),
+ PointerSize, llvm::endianness::little,
+ getGenericEdgeKindName);
+auto &Sec =
+ G->createSection("__data", orc::MemProt::Read | orc::MemProt::Write);
+orc::ExecutorAddr B1DummyAddr(0x1000);
+
+auto ArmCfg = getArmConfigForCPUArch(ARMBuildAttrs::v7);
+
+TEST(AArch32_ELF, readAddendErrors) {
+ // Permanently undefined instruction
+ // 11110:op:imm4:1:op1:imm12
+ // op = 1111111 Permanent undefined
+ // op1 = 010
+ ArrayRef<char> Content = "0xf7f0a000";
----------------
weliveindetail wrote:
Oh this doesn't initialize the memory with a 4-byte `0xf7f0a000`, but with a 11-byte string `"0xf7f0a000\0"`. I guess we should use something like the `makeHalfWords()` helper from AArch32Tests.cpp
https://github.com/llvm/llvm-project/pull/69636
More information about the llvm-commits
mailing list