1 //===- ELFTest.cpp - Tests for ELF.cpp ------------------------------------===//
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-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Object/ELF.h"
10 #include "gtest/gtest.h"
11
12 using namespace llvm;
13 using namespace llvm::object;
14 using namespace llvm::ELF;
15
TEST(ELFTest,getELFRelocationTypeNameForVE)16 TEST(ELFTest, getELFRelocationTypeNameForVE) {
17 EXPECT_EQ("R_VE_NONE", getELFRelocationTypeName(EM_VE, R_VE_NONE));
18 EXPECT_EQ("R_VE_REFLONG", getELFRelocationTypeName(EM_VE, R_VE_REFLONG));
19 EXPECT_EQ("R_VE_REFQUAD", getELFRelocationTypeName(EM_VE, R_VE_REFQUAD));
20 EXPECT_EQ("R_VE_SREL32", getELFRelocationTypeName(EM_VE, R_VE_SREL32));
21 EXPECT_EQ("R_VE_HI32", getELFRelocationTypeName(EM_VE, R_VE_HI32));
22 EXPECT_EQ("R_VE_LO32", getELFRelocationTypeName(EM_VE, R_VE_LO32));
23 EXPECT_EQ("R_VE_PC_HI32", getELFRelocationTypeName(EM_VE, R_VE_PC_HI32));
24 EXPECT_EQ("R_VE_PC_LO32", getELFRelocationTypeName(EM_VE, R_VE_PC_LO32));
25 EXPECT_EQ("R_VE_GOT32", getELFRelocationTypeName(EM_VE, R_VE_GOT32));
26 EXPECT_EQ("R_VE_GOT_HI32", getELFRelocationTypeName(EM_VE, R_VE_GOT_HI32));
27 EXPECT_EQ("R_VE_GOT_LO32", getELFRelocationTypeName(EM_VE, R_VE_GOT_LO32));
28 EXPECT_EQ("R_VE_GOTOFF32", getELFRelocationTypeName(EM_VE, R_VE_GOTOFF32));
29 EXPECT_EQ("R_VE_GOTOFF_HI32",
30 getELFRelocationTypeName(EM_VE, R_VE_GOTOFF_HI32));
31 EXPECT_EQ("R_VE_GOTOFF_LO32",
32 getELFRelocationTypeName(EM_VE, R_VE_GOTOFF_LO32));
33 EXPECT_EQ("R_VE_PLT32", getELFRelocationTypeName(EM_VE, R_VE_PLT32));
34 EXPECT_EQ("R_VE_PLT_HI32", getELFRelocationTypeName(EM_VE, R_VE_PLT_HI32));
35 EXPECT_EQ("R_VE_PLT_LO32", getELFRelocationTypeName(EM_VE, R_VE_PLT_LO32));
36 EXPECT_EQ("R_VE_RELATIVE", getELFRelocationTypeName(EM_VE, R_VE_RELATIVE));
37 EXPECT_EQ("R_VE_GLOB_DAT", getELFRelocationTypeName(EM_VE, R_VE_GLOB_DAT));
38 EXPECT_EQ("R_VE_JUMP_SLOT", getELFRelocationTypeName(EM_VE, R_VE_JUMP_SLOT));
39 EXPECT_EQ("R_VE_COPY", getELFRelocationTypeName(EM_VE, R_VE_COPY));
40 EXPECT_EQ("R_VE_DTPMOD64", getELFRelocationTypeName(EM_VE, R_VE_DTPMOD64));
41 EXPECT_EQ("R_VE_DTPOFF64", getELFRelocationTypeName(EM_VE, R_VE_DTPOFF64));
42 EXPECT_EQ("R_VE_TLS_GD_HI32",
43 getELFRelocationTypeName(EM_VE, R_VE_TLS_GD_HI32));
44 EXPECT_EQ("R_VE_TLS_GD_LO32",
45 getELFRelocationTypeName(EM_VE, R_VE_TLS_GD_LO32));
46 EXPECT_EQ("R_VE_TPOFF_HI32",
47 getELFRelocationTypeName(EM_VE, R_VE_TPOFF_HI32));
48 EXPECT_EQ("R_VE_TPOFF_LO32",
49 getELFRelocationTypeName(EM_VE, R_VE_TPOFF_LO32));
50 EXPECT_EQ("R_VE_CALL_HI32", getELFRelocationTypeName(EM_VE, R_VE_CALL_HI32));
51 EXPECT_EQ("R_VE_CALL_LO32", getELFRelocationTypeName(EM_VE, R_VE_CALL_LO32));
52 }
53
TEST(ELFTest,getELFRelativeRelocationType)54 TEST(ELFTest, getELFRelativeRelocationType) {
55 EXPECT_EQ(0U, getELFRelativeRelocationType(EM_VE));
56 }
57