brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 173ec14 Raw
38 lines · cpp
1//===------ MachOLinkGraphTests.cpp - Unit tests for MachO LinkGraphs -----===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "JITLinkTestUtils.h"10 11#include "llvm/ADT/STLExtras.h"12#include "llvm/ExecutionEngine/JITLink/JITLink.h"13#include "llvm/ExecutionEngine/JITLink/MachO.h"14#include "llvm/ExecutionEngine/Orc/SymbolStringPool.h"15 16#include "llvm/Testing/Support/Error.h"17#include "gtest/gtest.h"18 19using namespace llvm;20using namespace llvm::jitlink;21 22TEST(MachOLinkGraphTest, GetStandardSections) {23  // Check that LinkGraph construction works as expected.24  LinkGraph G("foo", std::make_shared<orc::SymbolStringPool>(),25              Triple("arm64-apple-darwin"), SubtargetFeatures(),26              getGenericEdgeKindName);27 28  auto &Data = getMachODefaultRWDataSection(G);29  EXPECT_TRUE(Data.empty());30  EXPECT_EQ(Data.getName(), orc::MachODataDataSectionName);31  EXPECT_EQ(Data.getMemProt(), orc::MemProt::Read | orc::MemProt::Write);32 33  auto &Text = getMachODefaultTextSection(G);34  EXPECT_TRUE(Text.empty());35  EXPECT_EQ(Text.getName(), orc::MachOTextTextSectionName);36  EXPECT_EQ(Text.getMemProt(), orc::MemProt::Read | orc::MemProt::Exec);37}38