mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[llvm][clang][IFS] Enhancing the llvm-ifs yaml format for symbol lists.
Prior to this change the clang interface stubs format resembled something ending with a symbol list like this: Symbols: a: { Type: Func } This was problematic because we didn't actually want a map format and also because we didn't like that an empty symbol list required "Symbols: {}". That is to say without the empty {} llvm-ifs would crash on an empty list. With this new format it is much more clear which field is the symbol name, and instead the [] that is used to express an empty symbol vector is optional, ie: Symbols: - { Name: a, Type: Func } or Symbols: [] or Symbols: This further diverges the format from existing llvm-elftapi. This is a good thing because although the format originally came from the same place, they are not the same in any way. Differential Revision: https://reviews.llvm.org/D76979
This commit is contained in:
parent
74804cc814
commit
a3e3cecf73
@ -1,8 +1,8 @@
|
||||
# NOTE: Used by weak-mismatch.ifs
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
foobar: { Type: Object, Size: 2 }
|
||||
- { Name: foobar, Type: Object, Size: 2 }
|
||||
...
|
||||
|
@ -1,8 +1,8 @@
|
||||
# NOTE: Used by weak-mismatch.ifs
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
foobar: { Type: Func }
|
||||
- { Name: foobar, Type: Func }
|
||||
...
|
||||
|
@ -5,10 +5,10 @@
|
||||
# CHECK-IFS-NEXT: Filenames:
|
||||
# CHECK-IFS-NEXT: ObjectFileFormat Values: TBD ELF
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-apple-unknown
|
||||
ObjectFileFormat: TBD
|
||||
Symbols:
|
||||
a: { Type: Func }
|
||||
- { Name: a, Type: Func }
|
||||
...
|
||||
|
@ -5,10 +5,10 @@
|
||||
# CHECK-IFS-NEXT: Filenames:
|
||||
# CHECK-IFS-NEXT: Triple Values: mips-unknown-linux x86_64-unknown-linux-gnu
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: mips-unknown-linux
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
a: { Type: Func }
|
||||
- { Name: a, Type: Func }
|
||||
...
|
||||
|
@ -5,12 +5,12 @@
|
||||
# RUN: FileCheck %s --check-prefixes=CHECK-IFS2
|
||||
|
||||
# CHECK-IFS: error: Interface Stub: IfsVersion Mismatch.
|
||||
# CHECK-IFS2: error: Interface Stub: Bad IfsVersion: 0.0, llvm-ifs supported version: 1.2.
|
||||
# CHECK-IFS2: error: Interface Stub: Bad IfsVersion: 0.0, llvm-ifs supported version: 2.0.
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 0.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
a: { Type: Func }
|
||||
- { Name: a, Type: Func }
|
||||
...
|
||||
|
@ -7,10 +7,10 @@
|
||||
# CHECK-IFS-NEXT: Filename:
|
||||
# CHECK-IFS-NEXT: Size Values: 1 4
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
b: { Type: Object, Size: 1 }
|
||||
- { Name: b, Type: Object, Size: 1 }
|
||||
...
|
||||
|
@ -7,10 +7,10 @@
|
||||
# CHECK-IFS-NEXT: Filename:
|
||||
# CHECK-IFS-NEXT: Type Values: Object Func
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
a: { Type: Object, Size: 1 }
|
||||
- { Name: a, Type: Object, Size: 1 }
|
||||
...
|
||||
|
@ -2,12 +2,12 @@
|
||||
# RUN: FileCheck %s --check-prefixes=CHECK-IFS
|
||||
|
||||
# CHECK-IFS: Symbols:
|
||||
# CHECK-IFS-NEXT: a: { Type: Func, Weak: true }
|
||||
# CHECK-IFS-NEXT: - { Name: a, Type: Func, Weak: true }
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
a: { Type: Func, Weak: true }
|
||||
- { Name: a, Type: Func, Weak: true }
|
||||
...
|
||||
|
@ -1,25 +1,25 @@
|
||||
# RUN: llvm-ifs -action write-ifs -o - %s | FileCheck --check-prefixes=CHECK-DEFAULT %s
|
||||
# RUN: llvm-ifs -action write-ifs -o - %s %S/weak.ifs | FileCheck --check-prefixes=CHECK-MERGE %s
|
||||
|
||||
# CHECK-DEFAULT: --- !experimental-ifs-v1
|
||||
# CHECK-DEFAULT-NEXT: IfsVersion: 1.2
|
||||
# CHECK-DEFAULT: --- !experimental-ifs-v2
|
||||
# CHECK-DEFAULT-NEXT: IfsVersion: 2.0
|
||||
# CHECK-DEFAULT-NEXT: Triple: ''
|
||||
# CHECK-DEFAULT-NEXT: ObjectFileFormat: ELF
|
||||
# CHECK-DEFAULT-NEXT: Symbols: {}
|
||||
# CHECK-DEFAULT-NEXT: Symbols: []
|
||||
# CHECK-DEFAULT-NEXT: ...
|
||||
|
||||
# CHECK-MERGE: --- !experimental-ifs-v1
|
||||
# CHECK-MERGE-NEXT: IfsVersion: 1.0
|
||||
# CHECK-MERGE: --- !experimental-ifs-v2
|
||||
# CHECK-MERGE-NEXT: IfsVersion: 2.0
|
||||
# CHECK-MERGE-NEXT: Triple: x86_64-unknown-linux-gnu
|
||||
# CHECK-MERGE-NEXT: ObjectFileFormat: ELF
|
||||
# CHECK-MERGE-NEXT: Symbols:
|
||||
# CHECK-MERGE-DAG: _Z8weakFuncv: { Type: Func, Weak: true }
|
||||
# CHECK-MERGE-DAG: _Z10strongFuncv: { Type: Func }
|
||||
# CHECK-MERGE-DAG: - { Name: _Z8weakFuncv, Type: Func, Weak: true }
|
||||
# CHECK-MERGE-DAG: - { Name: _Z10strongFuncv, Type: Func }
|
||||
# CHECK-MERGE: ...
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.2
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: ''
|
||||
ObjectFileFormat: ELF
|
||||
Symbols: {}
|
||||
Symbols: []
|
||||
...
|
||||
|
15
test/tools/llvm-ifs/empty1.ifs
Normal file
15
test/tools/llvm-ifs/empty1.ifs
Normal file
@ -0,0 +1,15 @@
|
||||
# RUN: llvm-ifs -action write-ifs -o - %s | FileCheck %s
|
||||
|
||||
# CHECK: --- !experimental-ifs-v2
|
||||
# CHECK-NEXT: IfsVersion: 2.0
|
||||
# CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
|
||||
# CHECK-NEXT: ObjectFileFormat: ELF
|
||||
# CHECK-NEXT: Symbols: []
|
||||
# CHECK: ...
|
||||
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols: []
|
||||
...
|
15
test/tools/llvm-ifs/empty2.ifs
Normal file
15
test/tools/llvm-ifs/empty2.ifs
Normal file
@ -0,0 +1,15 @@
|
||||
# RUN: llvm-ifs -action write-ifs -o - %s | FileCheck %s
|
||||
|
||||
# CHECK: --- !experimental-ifs-v2
|
||||
# CHECK-NEXT: IfsVersion: 2.0
|
||||
# CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
|
||||
# CHECK-NEXT: ObjectFileFormat: ELF
|
||||
# CHECK-NEXT: Symbols: []
|
||||
# CHECK: ...
|
||||
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
...
|
@ -10,13 +10,13 @@
|
||||
# RUN: llvm-ifs -action write-ifs -o - %s %s | \
|
||||
# RUN: FileCheck %s --check-prefixes=CHECK-MERGE-IFS
|
||||
|
||||
# CHECK-IFS: --- !experimental-ifs-v1
|
||||
# CHECK-IFS-NEXT: IfsVersion: 1.0
|
||||
# CHECK-IFS: --- !experimental-ifs-v2
|
||||
# CHECK-IFS-NEXT: IfsVersion: 2.0
|
||||
# CHECK-IFS-NEXT: Triple: x86_64-unknown-linux-gnu
|
||||
# CHECK-IFS-NEXT: ObjectFileFormat: ELF
|
||||
# CHECK-IFS-NEXT: Symbols:
|
||||
# CHECK-IFS-DAG: a: { Type: Func }
|
||||
# CHECK-IFS-DAG: b: { Type: Object, Size: 4 }
|
||||
# CHECK-IFS-DAG: - { Name: a, Type: Func }
|
||||
# CHECK-IFS-DAG: - { Name: b, Type: Object, Size: 4 }
|
||||
# CHECK-IFS: ...
|
||||
|
||||
# CHECK-ELF: ELF Header:
|
||||
@ -39,18 +39,18 @@
|
||||
# CHECK-DARWIN-TBD3-NEXT: ...
|
||||
|
||||
# Here we are testing to see if two identical symbols will merge.
|
||||
# CHECK-MERGE-IFS: --- !experimental-ifs-v1
|
||||
# CHECK-MERGE-IFS-NEXT: IfsVersion: 1.0
|
||||
# CHECK-MERGE-IFS: --- !experimental-ifs-v2
|
||||
# CHECK-MERGE-IFS-NEXT: IfsVersion: 2.0
|
||||
# CHECK-MERGE-IFS-NEXT: Triple: x86_64-unknown-linux-gnu
|
||||
# CHECK-MERGE-IFS-NEXT: ObjectFileFormat: ELF
|
||||
# CHECK-MERGE-IFS-NEXT: Symbols:
|
||||
# CHECK-MERGE-IFS-NEXT: a: { Type: Func }
|
||||
# CHECK-MERGE-IFS-NEXT: - { Name: a, Type: Func }
|
||||
# CHECK-MERGE-IFS-NEXT: ...
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
a: { Type: Func }
|
||||
- { Name: a, Type: Func }
|
||||
...
|
||||
|
@ -13,10 +13,10 @@
|
||||
# CHECK-NEXT: symbols: [ __Z3fooi ]
|
||||
# CHECK-NEXT: ...
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: arm64-apple-ios
|
||||
ObjectFileFormat: TBD
|
||||
Symbols:
|
||||
__Z3fooi: { Type: Func }
|
||||
- { Name: __Z3fooi, Type: Func }
|
||||
...
|
||||
|
@ -13,10 +13,10 @@
|
||||
# CHECK-NEXT: symbols: [ __Z3fooi ]
|
||||
# CHECK-NEXT: ...
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: arm64-apple-macosx
|
||||
ObjectFileFormat: TBD
|
||||
Symbols:
|
||||
__Z3fooi: { Type: Func }
|
||||
- { Name: __Z3fooi, Type: Func }
|
||||
...
|
||||
|
@ -4,17 +4,17 @@
|
||||
# RUN: llvm-ifs -action write-bin -o - %s %S/func.ifs %S/object.ifs %S/weak.ifs | \
|
||||
# RUN: llvm-readelf --all | FileCheck %s --check-prefixes=CHECK-ELF
|
||||
|
||||
# CHECK-IFS: --- !experimental-ifs-v1
|
||||
# CHECK-IFS-NEXT: IfsVersion: 1.0
|
||||
# CHECK-IFS: --- !experimental-ifs-v2
|
||||
# CHECK-IFS-NEXT: IfsVersion: 2.0
|
||||
# CHECK-IFS-NEXT: Triple: x86_64-unknown-linux-gnu
|
||||
# CHECK-IFS-NEXT: ObjectFileFormat: ELF
|
||||
# CHECK-IFS-NEXT: Symbols:
|
||||
# CHECK-IFS-DAG: e: { Type: Object, Size: 8 }
|
||||
# CHECK-IFS-DAG: a: { Type: Func }
|
||||
# CHECK-IFS-DAG: f: { Type: Object, Size: 2 }
|
||||
# CHECK-IFS-DAG: _Z10strongFuncv: { Type: Func }
|
||||
# CHECK-IFS-DAG: _Z8weakFuncv: { Type: Func, Weak: true }
|
||||
# CHECK-IFS-DAG: b: { Type: Object, Size: 4 }
|
||||
# CHECK-IFS-DAG: - { Name: e, Type: Object, Size: 8 }
|
||||
# CHECK-IFS-DAG: - { Name: a, Type: Func }
|
||||
# CHECK-IFS-DAG: - { Name: f, Type: Object, Size: 2 }
|
||||
# CHECK-IFS-DAG: - { Name: _Z10strongFuncv, Type: Func }
|
||||
# CHECK-IFS-DAG: - { Name: _Z8weakFuncv, Type: Func, Weak: true }
|
||||
# CHECK-IFS-DAG: - { Name: b, Type: Object, Size: 4 }
|
||||
# CHECK-IFS: ...
|
||||
|
||||
# CHECK-ELF: FUNC GLOBAL DEFAULT 1 _Z10strongFuncv
|
||||
@ -24,11 +24,11 @@
|
||||
# CHECK-ELF: OBJECT GLOBAL DEFAULT 1 e
|
||||
# CHECK-ELF: OBJECT GLOBAL DEFAULT 1 f
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
e: { Type: Object, Size: 8 }
|
||||
f: { Type: Object, Size: 2 }
|
||||
- { Name: e, Type: Object, Size: 8 }
|
||||
- { Name: f, Type: Object, Size: 2 }
|
||||
...
|
||||
|
@ -4,12 +4,12 @@
|
||||
# RUN: llvm-ifs -action write-bin -o - %s | \
|
||||
# RUN: llvm-readelf --all | FileCheck %s --check-prefixes=CHECK-ELF
|
||||
|
||||
# CHECK-IFS: --- !experimental-ifs-v1
|
||||
# CHECK-IFS-NEXT: IfsVersion: 1.0
|
||||
# CHECK-IFS: --- !experimental-ifs-v2
|
||||
# CHECK-IFS-NEXT: IfsVersion: 2.0
|
||||
# CHECK-IFS-NEXT: Triple: x86_64-unknown-linux-gnu
|
||||
# CHECK-IFS-NEXT: ObjectFileFormat: ELF
|
||||
# CHECK-IFS-NEXT: Symbols:
|
||||
# CHECK-IFS-NEXT: b: { Type: Object, Size: 4 }
|
||||
# CHECK-IFS-NEXT: - { Name: b, Type: Object, Size: 4 }
|
||||
# CHECK-IFS-NEXT: ...
|
||||
|
||||
# CHECK-ELF: ELF Header:
|
||||
@ -19,10 +19,10 @@
|
||||
# CHECK-ELF-NOT: FUNC GLOBAL DEFAULT 1 a
|
||||
# CHECK-ELF: OBJECT GLOBAL DEFAULT 1 b
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
b: { Type: Object, Size: 4 }
|
||||
- { Name: b, Type: Object, Size: 4 }
|
||||
...
|
||||
|
@ -1,17 +1,17 @@
|
||||
# RUN: llvm-ifs -action write-ifs -o - %s %S/strong.ifs | FileCheck %s --check-prefixes=CHECK-IFS
|
||||
|
||||
# CHECK-IFS: --- !experimental-ifs-v1
|
||||
# CHECK-IFS-NEXT: IfsVersion: 1.0
|
||||
# CHECK-IFS: --- !experimental-ifs-v2
|
||||
# CHECK-IFS-NEXT: IfsVersion: 2.0
|
||||
# CHECK-IFS-NEXT: Triple: x86_64-unknown-linux-gnu
|
||||
# CHECK-IFS-NEXT: ObjectFileFormat: ELF
|
||||
# CHECK-IFS-NEXT: Symbols:
|
||||
# CHECK-IFS-DAG: _Z8weakFuncv: { Type: Func }
|
||||
# CHECK-IFS-DAG: - { Name: _Z8weakFuncv, Type: Func }
|
||||
# CHECK-IFS: ...
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
_Z8weakFuncv: { Type: Func }
|
||||
- { Name: _Z8weakFuncv, Type: Func }
|
||||
...
|
||||
|
@ -13,10 +13,10 @@
|
||||
# CHECK-NEXT: symbols: [ __Z3fooi ]
|
||||
# CHECK-NEXT: ...
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: arm64-apple-tvos
|
||||
ObjectFileFormat: TBD
|
||||
Symbols:
|
||||
__Z3fooi: { Type: Func }
|
||||
- { Name: __Z3fooi, Type: Func }
|
||||
...
|
||||
|
@ -1,9 +1,9 @@
|
||||
# RUN: llvm-ifs -action write-ifs -o - %s %S/object.ifs
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.1
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
a: { Type: Func }
|
||||
- { Name: a, Type: Func }
|
||||
...
|
||||
|
@ -13,10 +13,10 @@
|
||||
# CHECK-NEXT: symbols: [ __Z3fooi ]
|
||||
# CHECK-NEXT: ...
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: arm64-apple-watchos
|
||||
ObjectFileFormat: TBD
|
||||
Symbols:
|
||||
__Z3fooi: { Type: Func }
|
||||
- { Name: __Z3fooi, Type: Func }
|
||||
...
|
||||
|
@ -10,10 +10,10 @@
|
||||
# CHECK-TYPE-NEXT: Filename:
|
||||
# CHECK-TYPE-NEXT: Type Values: Object Func
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
foobar: { Type: Object, Size: 1, Weak: true }
|
||||
- { Name: foobar, Type: Object, Size: 1, Weak: true }
|
||||
...
|
||||
|
@ -1,19 +1,19 @@
|
||||
# RUN: llvm-ifs -action write-ifs -o - %s | FileCheck %s --check-prefixes=CHECK-IFS
|
||||
|
||||
# CHECK-IFS: --- !experimental-ifs-v1
|
||||
# CHECK-IFS-NEXT: IfsVersion: 1.0
|
||||
# CHECK-IFS: --- !experimental-ifs-v2
|
||||
# CHECK-IFS-NEXT: IfsVersion: 2.0
|
||||
# CHECK-IFS-NEXT: Triple: x86_64-unknown-linux-gnu
|
||||
# CHECK-IFS-NEXT: ObjectFileFormat: ELF
|
||||
# CHECK-IFS-NEXT: Symbols:
|
||||
# CHECK-IFS-DAG: _Z8weakFuncv: { Type: Func, Weak: true }
|
||||
# CHECK-IFS-DAG: _Z10strongFuncv: { Type: Func }
|
||||
# CHECK-IFS-DAG: - { Name: _Z8weakFuncv, Type: Func, Weak: true }
|
||||
# CHECK-IFS-DAG: - { Name: _Z10strongFuncv, Type: Func }
|
||||
# CHECK-IFS: ...
|
||||
|
||||
--- !experimental-ifs-v1
|
||||
IfsVersion: 1.0
|
||||
--- !experimental-ifs-v2
|
||||
IfsVersion: 2.0
|
||||
Triple: x86_64-unknown-linux-gnu
|
||||
ObjectFileFormat: ELF
|
||||
Symbols:
|
||||
_Z8weakFuncv: { Type: Func, Weak: true }
|
||||
_Z10strongFuncv: { Type: Func }
|
||||
- { Name: _Z8weakFuncv, Type: Func, Weak: true }
|
||||
- { Name: _Z10strongFuncv, Type: Func }
|
||||
...
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "llvm/TextAPI/MachO/TextAPIWriter.h"
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::yaml;
|
||||
@ -34,8 +35,8 @@ using namespace llvm::MachO;
|
||||
#define DEBUG_TYPE "llvm-ifs"
|
||||
|
||||
namespace {
|
||||
const VersionTuple IFSVersionCurrent(1, 2);
|
||||
}
|
||||
const VersionTuple IFSVersionCurrent(2, 0);
|
||||
} // end anonymous namespace
|
||||
|
||||
static cl::opt<std::string> Action("action", cl::desc("<llvm-ifs action>"),
|
||||
cl::value_desc("write-ifs | write-bin"),
|
||||
@ -76,6 +77,7 @@ std::string getTypeName(IFSSymbolType Type) {
|
||||
}
|
||||
|
||||
struct IFSSymbol {
|
||||
IFSSymbol() = default;
|
||||
IFSSymbol(std::string SymbolName) : Name(SymbolName) {}
|
||||
std::string Name;
|
||||
uint64_t Size;
|
||||
@ -85,6 +87,8 @@ struct IFSSymbol {
|
||||
bool operator<(const IFSSymbol &RHS) const { return Name < RHS.Name; }
|
||||
};
|
||||
|
||||
LLVM_YAML_IS_SEQUENCE_VECTOR(IFSSymbol)
|
||||
|
||||
namespace llvm {
|
||||
namespace yaml {
|
||||
/// YAML traits for IFSSymbolType.
|
||||
@ -124,6 +128,7 @@ template <> struct ScalarTraits<VersionTuple> {
|
||||
/// YAML traits for IFSSymbol.
|
||||
template <> struct MappingTraits<IFSSymbol> {
|
||||
static void mapping(IO &IO, IFSSymbol &Symbol) {
|
||||
IO.mapRequired("Name", Symbol.Name);
|
||||
IO.mapRequired("Type", Symbol.Type);
|
||||
// The need for symbol size depends on the symbol type.
|
||||
if (Symbol.Type == IFSSymbolType::NoType)
|
||||
@ -140,20 +145,6 @@ template <> struct MappingTraits<IFSSymbol> {
|
||||
static const bool flow = true;
|
||||
};
|
||||
|
||||
/// YAML traits for set of IFSSymbols.
|
||||
template <> struct CustomMappingTraits<std::set<IFSSymbol>> {
|
||||
static void inputOne(IO &IO, StringRef Key, std::set<IFSSymbol> &Set) {
|
||||
std::string Name = Key.str();
|
||||
IFSSymbol Sym(Name);
|
||||
IO.mapRequired(Name.c_str(), Sym);
|
||||
Set.insert(Sym);
|
||||
}
|
||||
|
||||
static void output(IO &IO, std::set<IFSSymbol> &Set) {
|
||||
for (auto &Sym : Set)
|
||||
IO.mapRequired(Sym.Name.c_str(), const_cast<IFSSymbol &>(Sym));
|
||||
}
|
||||
};
|
||||
} // namespace yaml
|
||||
} // namespace llvm
|
||||
|
||||
@ -167,7 +158,7 @@ public:
|
||||
std::string ObjectFileFormat;
|
||||
Optional<std::string> SOName;
|
||||
std::vector<std::string> NeededLibs;
|
||||
std::set<IFSSymbol> Symbols;
|
||||
std::vector<IFSSymbol> Symbols;
|
||||
|
||||
IFSStub() = default;
|
||||
IFSStub(const IFSStub &Stub)
|
||||
@ -186,14 +177,18 @@ namespace yaml {
|
||||
/// YAML traits for IFSStub objects.
|
||||
template <> struct MappingTraits<IFSStub> {
|
||||
static void mapping(IO &IO, IFSStub &Stub) {
|
||||
if (!IO.mapTag("!experimental-ifs-v1", true))
|
||||
if (!IO.mapTag("!experimental-ifs-v2", true))
|
||||
IO.setError("Not a .ifs YAML file.");
|
||||
|
||||
auto OldContext = IO.getContext();
|
||||
IO.setContext(&Stub);
|
||||
IO.mapRequired("IfsVersion", Stub.IfsVersion);
|
||||
IO.mapOptional("Triple", Stub.Triple);
|
||||
IO.mapOptional("ObjectFileFormat", Stub.ObjectFileFormat);
|
||||
IO.mapOptional("SOName", Stub.SOName);
|
||||
IO.mapOptional("NeededLibs", Stub.NeededLibs);
|
||||
IO.mapRequired("Symbols", Stub.Symbols);
|
||||
IO.setContext(&OldContext);
|
||||
}
|
||||
};
|
||||
} // namespace yaml
|
||||
@ -218,7 +213,7 @@ static Expected<std::unique_ptr<IFSStub>> readInputFile(StringRef FilePath) {
|
||||
return std::move(Stub);
|
||||
}
|
||||
|
||||
int writeTbdStub(const llvm::Triple &T, const std::set<IFSSymbol> &Symbols,
|
||||
int writeTbdStub(const llvm::Triple &T, const std::vector<IFSSymbol> &Symbols,
|
||||
const StringRef Format, raw_ostream &Out) {
|
||||
|
||||
auto PlatformKindOrError =
|
||||
@ -280,7 +275,7 @@ int writeTbdStub(const llvm::Triple &T, const std::set<IFSSymbol> &Symbols,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int writeElfStub(const llvm::Triple &T, const std::set<IFSSymbol> &Symbols,
|
||||
int writeElfStub(const llvm::Triple &T, const std::vector<IFSSymbol> &Symbols,
|
||||
const StringRef Format, raw_ostream &Out) {
|
||||
SmallString<0> Storage;
|
||||
Storage.clear();
|
||||
@ -387,8 +382,8 @@ int writeIfso(const IFSStub &Stub, bool IsWriteIfs, raw_ostream &Out) {
|
||||
|
||||
// TODO: Drop ObjectFileFormat, it can be subsumed from the triple.
|
||||
// New Interface Stubs Yaml Format:
|
||||
// --- !experimental-ifs-v1
|
||||
// IfsVersion: 1.0
|
||||
// --- !experimental-ifs-v2
|
||||
// IfsVersion: 2.0
|
||||
// Triple: <llvm triple>
|
||||
// ObjectFileFormat: <ELF | others not yet supported>
|
||||
// Symbols:
|
||||
@ -517,7 +512,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
for (auto &Entry : SymbolMap)
|
||||
Stub.Symbols.insert(Entry.second);
|
||||
Stub.Symbols.push_back(Entry.second);
|
||||
|
||||
std::error_code SysErr;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user