diff --git a/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt b/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt --- a/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt +++ b/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt @@ -24,6 +24,7 @@ JITTargetMachineBuilderTest.cpp LazyCallThroughAndReexportsTest.cpp LookupAndRecordAddrsTest.cpp + MachOPlatformTest.cpp MapperJITLinkMemoryManagerTest.cpp MemoryMapperTest.cpp ObjectLinkingLayerTest.cpp diff --git a/llvm/unittests/ExecutionEngine/Orc/MachOPlatformTest.cpp b/llvm/unittests/ExecutionEngine/Orc/MachOPlatformTest.cpp new file mode 100644 --- /dev/null +++ b/llvm/unittests/ExecutionEngine/Orc/MachOPlatformTest.cpp @@ -0,0 +1,25 @@ +//===----------- MachOPlatformTest.cpp -- Tests for MachOPlatform ---------===// +// +// 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 "OrcTestCommon.h" + +#include "llvm/ExecutionEngine/Orc/MachOPlatform.h" + +using namespace llvm::orc; + +TEST(MachOPlatformTest, InitializerSectionTest) { + EXPECT_TRUE(MachOPlatform::isInitializerSection("__DATA", "__mod_init_func")); + EXPECT_TRUE( + MachOPlatform::isInitializerSection("__DATA", "__objc_classlist")); + EXPECT_TRUE(MachOPlatform::isInitializerSection("__DATA", "__objc_selrefs")); + EXPECT_TRUE(MachOPlatform::isInitializerSection("__TEXT", "__swift5_proto")); + EXPECT_TRUE(MachOPlatform::isInitializerSection("__TEXT", "__swift5_protos")); + EXPECT_TRUE(MachOPlatform::isInitializerSection("__TEXT", "__swift5_types")); + + EXPECT_FALSE(MachOPlatform::isInitializerSection("__TEXT", "__text")); +}