Mercurial > hg > CbC > CbC_llvm
comparison lld/lib/Core/DefinedAtom.cpp @ 150:1d019706d866
LLVM10
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 15:10:13 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
147:c2174574ed3a | 150:1d019706d866 |
---|---|
1 //===- DefinedAtom.cpp ------------------------------------------*- C++ -*-===// | |
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/Support/ErrorHandling.h" | |
10 #include "lld/Core/DefinedAtom.h" | |
11 #include "lld/Core/File.h" | |
12 | |
13 namespace lld { | |
14 | |
15 DefinedAtom::ContentPermissions DefinedAtom::permissions() const { | |
16 // By default base permissions on content type. | |
17 return permissions(this->contentType()); | |
18 } | |
19 | |
20 // Utility function for deriving permissions from content type | |
21 DefinedAtom::ContentPermissions DefinedAtom::permissions(ContentType type) { | |
22 switch (type) { | |
23 case typeCode: | |
24 case typeResolver: | |
25 case typeBranchIsland: | |
26 case typeBranchShim: | |
27 case typeStub: | |
28 case typeStubHelper: | |
29 case typeMachHeader: | |
30 return permR_X; | |
31 | |
32 case typeConstant: | |
33 case typeCString: | |
34 case typeUTF16String: | |
35 case typeCFI: | |
36 case typeLSDA: | |
37 case typeLiteral4: | |
38 case typeLiteral8: | |
39 case typeLiteral16: | |
40 case typeDTraceDOF: | |
41 case typeCompactUnwindInfo: | |
42 case typeProcessedUnwindInfo: | |
43 case typeObjCImageInfo: | |
44 case typeObjCMethodList: | |
45 return permR__; | |
46 | |
47 case typeData: | |
48 case typeDataFast: | |
49 case typeZeroFill: | |
50 case typeZeroFillFast: | |
51 case typeObjC1Class: | |
52 case typeLazyPointer: | |
53 case typeLazyDylibPointer: | |
54 case typeNonLazyPointer: | |
55 case typeThunkTLV: | |
56 return permRW_; | |
57 | |
58 case typeGOT: | |
59 case typeConstData: | |
60 case typeCFString: | |
61 case typeInitializerPtr: | |
62 case typeTerminatorPtr: | |
63 case typeCStringPtr: | |
64 case typeObjCClassPtr: | |
65 case typeObjC2CategoryList: | |
66 case typeInterposingTuples: | |
67 case typeTLVInitialData: | |
68 case typeTLVInitialZeroFill: | |
69 case typeTLVInitializerPtr: | |
70 return permRW_L; | |
71 | |
72 case typeUnknown: | |
73 case typeTempLTO: | |
74 case typeSectCreate: | |
75 case typeDSOHandle: | |
76 return permUnknown; | |
77 } | |
78 llvm_unreachable("unknown content type"); | |
79 } | |
80 | |
81 } // namespace |