1 //===-------- ObjectLinkingLayerTest.cpp - ObjectLinkingLayer tests -------===//
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-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/ExecutionEngine/Orc/Shared/ObjectFormats.h"
10 #include "gtest/gtest.h"
13 using namespace llvm::orc
;
17 TEST(ObjectFormatsTest
, MachOInitializerSections
) {
18 EXPECT_TRUE(isMachOInitializerSection("__DATA,__objc_selrefs"));
19 EXPECT_TRUE(isMachOInitializerSection("__DATA,__mod_init_func"));
20 EXPECT_TRUE(isMachOInitializerSection("__DATA,__objc_classlist"));
21 EXPECT_TRUE(isMachOInitializerSection("__TEXT,__swift5_proto"));
22 EXPECT_TRUE(isMachOInitializerSection("__TEXT,__swift5_protos"));
23 EXPECT_TRUE(isMachOInitializerSection("__TEXT,__swift5_types"));
24 EXPECT_FALSE(isMachOInitializerSection("__DATA,__not_an_init_sec"));
27 TEST(ObjectFormatsTest
, ELFInitializerSections
) {
28 EXPECT_TRUE(isELFInitializerSection(".init_array"));
29 EXPECT_TRUE(isELFInitializerSection(".init_array.0"));
30 EXPECT_FALSE(isELFInitializerSection(".text"));
31 EXPECT_TRUE(isELFInitializerSection(".ctors.0"));
34 } // end anonymous namespace