@@ -26,26 +26,47 @@ auto &Sec =
26
26
27
27
auto ArmCfg = getArmConfigForCPUArch(ARMBuildAttrs::v7);
28
28
29
- constexpr uint64_t DataAlignment = 4 ;
30
29
constexpr uint64_t ArmAlignment = 4 ;
31
30
constexpr uint64_t ThumbAlignment = 2 ;
32
31
constexpr uint64_t AlignmentOffset = 0 ;
33
32
34
33
constexpr orc::ExecutorAddrDiff SymbolOffset = 0 ;
35
34
constexpr orc::ExecutorAddrDiff SymbolSize = 4 ;
36
35
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
+ };
41
66
42
- TEST (AArch32_ELF, readAddendDataErrors) {
67
+ TEST_F (AArch32Errors_ELF, readAddendDataErrors) {
68
+ Block &ZerosBlock = createBlock (Zeros, 0x1000 );
43
69
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);
49
70
50
71
// Invalid edge kind is the only error we can raise here right now.
51
72
Edge::Kind Invalid = Edge::GenericEdgeKind::Invalid;
0 commit comments