Skip to content

Commit be511cc

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:fa23d2b9d972 into amd-gfx:b5cf6611d3a0
Local branch amd-gfx b5cf661 Merged main:7c44167daa75 into amd-gfx:294af0383f6c Remote branch main fa23d2b [JITLink][AArch32] Add test fixture with helper functions in error tests
2 parents b5cf661 + fa23d2b commit be511cc

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 481714
19+
#define LLVM_MAIN_REVISION 481715
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/unittests/ExecutionEngine/JITLink/AArch32ErrorTests.cpp

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,47 @@ auto &Sec =
2626

2727
auto ArmCfg = getArmConfigForCPUArch(ARMBuildAttrs::v7);
2828

29-
constexpr uint64_t DataAlignment = 4;
3029
constexpr uint64_t ArmAlignment = 4;
3130
constexpr uint64_t ThumbAlignment = 2;
3231
constexpr uint64_t AlignmentOffset = 0;
3332

3433
constexpr orc::ExecutorAddrDiff SymbolOffset = 0;
3534
constexpr orc::ExecutorAddrDiff SymbolSize = 4;
3635

37-
template <size_t sizeOfArray>
38-
ArrayRef<char> toArrayRefChar(const uint8_t (&Zeros)[sizeOfArray]) {
39-
return ArrayRef<char>(reinterpret_cast<const char *>(&Zeros), sizeof(Zeros));
40-
}
36+
class AArch32Errors_ELF : public testing::Test {
37+
protected:
38+
ArmConfig ArmCfg = getArmConfigForCPUArch(ARMBuildAttrs::v7);
39+
std::unique_ptr<LinkGraph> G;
40+
Section *S = nullptr;
41+
42+
const uint8_t Zeros[4]{0x00, 0x00, 0x00, 0x00};
43+
44+
public:
45+
static void SetUpTestCase() {}
46+
47+
void SetUp() override {
48+
G = std::make_unique<LinkGraph>("foo", Triple("armv7-linux-gnueabi"),
49+
PointerSize, endianness::little,
50+
aarch32::getEdgeKindName);
51+
S = &G->createSection("__data", orc::MemProt::Read | orc::MemProt::Write);
52+
}
53+
54+
void TearDown() override {}
55+
56+
protected:
57+
template <size_t Size>
58+
Block &createBlock(const uint8_t (&Content)[Size], uint64_t Addr,
59+
uint64_t Alignment = 4) {
60+
ArrayRef<char> CharContent{reinterpret_cast<const char *>(&Content),
61+
sizeof(Content)};
62+
return G->createContentBlock(*S, CharContent, orc::ExecutorAddr(Addr),
63+
Alignment, AlignmentOffset);
64+
}
65+
};
4166

42-
TEST(AArch32_ELF, readAddendDataErrors) {
67+
TEST_F(AArch32Errors_ELF, readAddendDataErrors) {
68+
Block &ZerosBlock = createBlock(Zeros, 0x1000);
4369
constexpr uint64_t ZerosOffset = 0;
44-
const uint8_t Zeros[] = {0x00, 0x00, 0x00, 0x00};
45-
constexpr orc::ExecutorAddr ZerosBlockAddr(0x0000);
46-
auto &ZerosBlock =
47-
G->createContentBlock(Sec, toArrayRefChar(Zeros), ZerosBlockAddr,
48-
DataAlignment, AlignmentOffset);
4970

5071
// Invalid edge kind is the only error we can raise here right now.
5172
Edge::Kind Invalid = Edge::GenericEdgeKind::Invalid;

0 commit comments

Comments
 (0)