13d4e9d5eSLang Hames //===-------- ObjectLinkingLayerTest.cpp - ObjectLinkingLayer tests -------===//
23d4e9d5eSLang Hames //
33d4e9d5eSLang Hames // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
43d4e9d5eSLang Hames // See https://llvm.org/LICENSE.txt for license information.
53d4e9d5eSLang Hames // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
63d4e9d5eSLang Hames //
73d4e9d5eSLang Hames //===----------------------------------------------------------------------===//
83d4e9d5eSLang Hames
93d4e9d5eSLang Hames #include "llvm/ExecutionEngine/Orc/Shared/ObjectFormats.h"
103d4e9d5eSLang Hames #include "gtest/gtest.h"
113d4e9d5eSLang Hames
123d4e9d5eSLang Hames using namespace llvm;
133d4e9d5eSLang Hames using namespace llvm::orc;
143d4e9d5eSLang Hames
153d4e9d5eSLang Hames namespace {
163d4e9d5eSLang Hames
TEST(ObjectFormatsTest,MachOInitializerSections)173d4e9d5eSLang Hames TEST(ObjectFormatsTest, MachOInitializerSections) {
183d4e9d5eSLang Hames EXPECT_TRUE(isMachOInitializerSection("__DATA,__objc_selrefs"));
193d4e9d5eSLang Hames EXPECT_TRUE(isMachOInitializerSection("__DATA,__mod_init_func"));
203d4e9d5eSLang Hames EXPECT_TRUE(isMachOInitializerSection("__DATA,__objc_classlist"));
213d4e9d5eSLang Hames EXPECT_TRUE(isMachOInitializerSection("__TEXT,__swift5_proto"));
223d4e9d5eSLang Hames EXPECT_TRUE(isMachOInitializerSection("__TEXT,__swift5_protos"));
233d4e9d5eSLang Hames EXPECT_TRUE(isMachOInitializerSection("__TEXT,__swift5_types"));
243d4e9d5eSLang Hames EXPECT_FALSE(isMachOInitializerSection("__DATA,__not_an_init_sec"));
253d4e9d5eSLang Hames }
263d4e9d5eSLang Hames
TEST(ObjectFormatsTest,ELFInitializerSections)273d4e9d5eSLang Hames TEST(ObjectFormatsTest, ELFInitializerSections) {
283d4e9d5eSLang Hames EXPECT_TRUE(isELFInitializerSection(".init_array"));
293d4e9d5eSLang Hames EXPECT_TRUE(isELFInitializerSection(".init_array.0"));
303d4e9d5eSLang Hames EXPECT_FALSE(isELFInitializerSection(".text"));
31*e76ac807SJeff Niu EXPECT_TRUE(isELFInitializerSection(".ctors.0"));
323d4e9d5eSLang Hames }
333d4e9d5eSLang Hames
343d4e9d5eSLang Hames } // end anonymous namespace
35