forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm-ifs][IFS] llvm Interface Stubs merging + object file generation…
… tool. This tool merges interface stub files to produce a merged interface stub file or a stub library. Currently it for stub library generation it can produce an ELF .so stub file, or a TBD file (experimental). It will be used by the clang -emit-interface-stubs compilation pipeline to merge and assemble the per-CU stub files into a stub library. The new IFS format is as follows: --- !experimental-ifs-v1 IfsVersion: 1.0 Triple: <llvm triple> ObjectFileFormat: <ELF | TBD> Symbols: _ZSymbolName: { Type: <type>, etc... } ... Differential Revision: https://reviews.llvm.org/D66405 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370499 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
17 changed files
with
793 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# RUN: not llvm-ifs -action write-ifs -o - %s %S/object.ifs 2>&1 | \ | ||
# RUN: FileCheck %s --check-prefixes=CHECK-IFS | ||
|
||
# CHECK-IFS: error: Interface Stub: ObjectFileFormat Mismatch. | ||
# CHECK-IFS-NEXT: Filenames: | ||
# CHECK-IFS-NEXT: ObjectFileFormat Values: TBD ELF | ||
|
||
--- !experimental-ifs-v1 | ||
IfsVersion: 1.0 | ||
Triple: x86_64-apple-unknown | ||
ObjectFileFormat: TBD | ||
Symbols: | ||
a: { Type: Func } | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# RUN: not llvm-ifs -action write-ifs -o - %s %S/object.ifs 2>&1 | \ | ||
# RUN: FileCheck %s --check-prefixes=CHECK-IFS | ||
|
||
# CHECK-IFS: error: Interface Stub: Triple Mismatch. | ||
# CHECK-IFS-NEXT: Filenames: | ||
# CHECK-IFS-NEXT: Triple Values: mips-unknown-linux x86_64-unknown-linux-gnu | ||
|
||
--- !experimental-ifs-v1 | ||
IfsVersion: 1.0 | ||
Triple: mips-unknown-linux | ||
ObjectFileFormat: ELF | ||
Symbols: | ||
a: { Type: Func } | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# RUN: not llvm-ifs -action write-ifs -o - %s %S/object.ifs 2>&1 | \ | ||
# RUN: FileCheck %s --check-prefixes=CHECK-IFS | ||
|
||
# RUN: not llvm-ifs -action write-ifs -o - %s 2>&1 | \ | ||
# 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. | ||
|
||
--- !experimental-ifs-v1 | ||
IfsVersion: 0.0 | ||
Triple: x86_64-unknown-linux-gnu | ||
ObjectFileFormat: ELF | ||
Symbols: | ||
a: { Type: Func } | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# RUN: not llvm-ifs -action write-ifs -o - %s %S/object.ifs 2>&1 | \ | ||
# RUN: FileCheck %s --check-prefixes=CHECK-IFS | ||
|
||
# Here we are testing to see if two symbols with identical names will fail to | ||
# merge in conflict due to mismatching sizes. | ||
# CHECK-IFS: error: Interface Stub: Size Mismatch for b. | ||
# CHECK-IFS-NEXT: Filename: | ||
# CHECK-IFS-NEXT: Size Values: 1 4 | ||
|
||
--- !experimental-ifs-v1 | ||
IfsVersion: 1.0 | ||
Triple: x86_64-unknown-linux-gnu | ||
ObjectFileFormat: ELF | ||
Symbols: | ||
b: { Type: Object, Size: 1 } | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# RUN: not llvm-ifs -action write-ifs -o - %s %S/func.ifs 2>&1 | \ | ||
# RUN: FileCheck %s --check-prefixes=CHECK-IFS | ||
|
||
# Here we are testing to see if two symbols with identical names will fail to | ||
# merge in conflict due to mismatched types. | ||
# CHECK-IFS: error: Interface Stub: Type Mismatch for a. | ||
# CHECK-IFS-NEXT: Filename: | ||
# CHECK-IFS-NEXT: Type Values: Object Func | ||
|
||
--- !experimental-ifs-v1 | ||
IfsVersion: 1.0 | ||
Triple: x86_64-unknown-linux-gnu | ||
ObjectFileFormat: ELF | ||
Symbols: | ||
a: { Type: Object, Size: 1 } | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# RUN: not llvm-ifs -action write-ifs -o - %s %S/func.ifs 2>&1 | \ | ||
# RUN: FileCheck %s --check-prefixes=CHECK-IFS | ||
|
||
# Here we are testing to see if two symbols with identical names will fail to | ||
# merge in conflict due to one being weak and one not. Eventually this will work | ||
# when llvm-ifs has support for resolving these kinds of conflicts. | ||
# CHECK-IFS: error: Interface Stub: Weak Mismatch for a. | ||
# CHECK-IFS-NEXT: Filename: | ||
# CHECK-IFS-NEXT: Weak Values: 1 0 | ||
|
||
--- !experimental-ifs-v1 | ||
IfsVersion: 1.0 | ||
Triple: x86_64-unknown-linux-gnu | ||
ObjectFileFormat: ELF | ||
Symbols: | ||
a: { Type: Func, Weak: true } | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# RUN: llvm-ifs -action write-ifs -o - %s %S/object.ifs | \ | ||
# RUN: FileCheck %s --check-prefixes=CHECK-IFS | ||
|
||
# RUN: llvm-ifs -action write-bin -o - %s %S/object.ifs | \ | ||
# RUN: llvm-readelf --all | FileCheck %s --check-prefixes=CHECK-ELF | ||
|
||
# RUN: llvm-ifs -action write-bin -force-format TBD -o - %s %S/object.ifs | \ | ||
# RUN: FileCheck %s --check-prefixes=CHECK-DARWIN-TBD3 | ||
|
||
# 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-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: ... | ||
|
||
# CHECK-ELF: ELF Header: | ||
# CHECK-ELF: Class: ELF64 | ||
# CHECK-ELF: Type: DYN (Shared object file) | ||
# CHECK-ELF: FUNC GLOBAL DEFAULT 1 a | ||
# CHECK-ELF: OBJECT GLOBAL DEFAULT 1 b | ||
|
||
# CHECK-DARWIN-TBD3: --- !tapi-tbd-v3 | ||
# CHECK-DARWIN-TBD3-NEXT: archs: [ x86_64 ] | ||
# CHECK-DARWIN-TBD3-NEXT: platform: macosx | ||
# CHECK-DARWIN-TBD3-NEXT: flags: [ flat_namespace, not_app_extension_safe ] | ||
# CHECK-DARWIN-TBD3-NEXT: install-name: '' | ||
# CHECK-DARWIN-TBD3-NEXT: current-version: 0 | ||
# CHECK-DARWIN-TBD3-NEXT: compatibility-version: 0 | ||
# CHECK-DARWIN-TBD3-NEXT: objc-constraint: none | ||
# CHECK-DARWIN-TBD3-NEXT: exports: | ||
# CHECK-DARWIN-TBD3-NEXT: - archs: [ x86_64 ] | ||
# CHECK-DARWIN-TBD3-NEXT: symbols: [ a, b ] | ||
# 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-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: ... | ||
|
||
--- !experimental-ifs-v1 | ||
IfsVersion: 1.0 | ||
Triple: x86_64-unknown-linux-gnu | ||
ObjectFileFormat: ELF | ||
Symbols: | ||
a: { Type: Func } | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# RUN: llvm-ifs -action write-ifs -o - %s %S/func.ifs %S/object.ifs %S/weak.ifs | \ | ||
# RUN: FileCheck %s --check-prefixes=CHECK-IFS | ||
|
||
# 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-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: ... | ||
|
||
# CHECK-ELF: FUNC GLOBAL DEFAULT 1 _Z10strongFuncv | ||
# CHECK-ELF: FUNC WEAK DEFAULT 1 _Z8weakFuncv | ||
# CHECK-ELF: FUNC GLOBAL DEFAULT 1 a | ||
# CHECK-ELF: OBJECT GLOBAL DEFAULT 1 b | ||
# CHECK-ELF: OBJECT GLOBAL DEFAULT 1 e | ||
# CHECK-ELF: OBJECT GLOBAL DEFAULT 1 f | ||
|
||
--- !experimental-ifs-v1 | ||
IfsVersion: 1.0 | ||
Triple: x86_64-unknown-linux-gnu | ||
ObjectFileFormat: ELF | ||
Symbols: | ||
e: { Type: Object, Size: 8 } | ||
f: { Type: Object, Size: 2 } | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# RUN: llvm-ifs -action write-ifs -o - %s | \ | ||
# RUN: FileCheck %s --check-prefixes=CHECK-IFS | ||
|
||
# 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-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: ... | ||
|
||
# CHECK-ELF: ELF Header: | ||
# CHECK-ELF: Class: ELF64 | ||
# CHECK-ELF: Data: 2's complement, little endian | ||
# CHECK-ELF: Type: DYN (Shared object file) | ||
# CHECK-ELF-NOT: FUNC GLOBAL DEFAULT 1 a | ||
# CHECK-ELF: OBJECT GLOBAL DEFAULT 1 b | ||
|
||
--- !experimental-ifs-v1 | ||
IfsVersion: 1.0 | ||
Triple: x86_64-unknown-linux-gnu | ||
ObjectFileFormat: ELF | ||
Symbols: | ||
b: { Type: Object, Size: 4 } | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# RUN: llvm-ifs -action write-ifs -o - %s %S/object.ifs | ||
|
||
--- !experimental-ifs-v1 | ||
IfsVersion: 1.1 | ||
Triple: x86_64-unknown-linux-gnu | ||
ObjectFileFormat: ELF | ||
Symbols: | ||
a: { Type: Func } | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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-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: ... | ||
|
||
--- !experimental-ifs-v1 | ||
IfsVersion: 1.0 | ||
Triple: x86_64-unknown-linux-gnu | ||
ObjectFileFormat: ELF | ||
Symbols: | ||
_Z8weakFuncv: { Type: Func, Weak: true } | ||
_Z10strongFuncv: { Type: Func } | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
set(LLVM_LINK_COMPONENTS | ||
Object | ||
Support | ||
TextAPI | ||
ObjectYAML | ||
) | ||
|
||
add_llvm_tool(llvm-ifs | ||
llvm-ifs.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
;===- ./tools/llvm-ifs/LLVMBuild.txt ---------------------------*- Conf -*--===; | ||
; | ||
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
; See https://llvm.org/LICENSE.txt for license information. | ||
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
; | ||
;===------------------------------------------------------------------------===; | ||
; | ||
; This is an LLVMBuild description file for the components in this subdirectory. | ||
; | ||
; For more information on the LLVMBuild system, please see: | ||
; | ||
; http://llvm.org/docs/LLVMBuild.html | ||
; | ||
;===------------------------------------------------------------------------===; | ||
|
||
[component_0] | ||
type = Tool | ||
name = llvm-ifs | ||
parent = Tools | ||
required_libraries = Object Support TextAPI |
Oops, something went wrong.