mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-19 19:45:40 -04:00

Second Landing Attempt: This patch enables end to end support for generating ELF interface stubs directly from clang. Now the following: clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp will product an ELF binary with visible symbols populated. Visibility attributes and -fvisibility can be used to control what gets populated. * Adding ToolChain support for clang Driver IFS Merge Phase * Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain * Adds support for the clang Driver to involve llvm-ifs on ifs files. * Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file instead of the final object format (normally ELF) Differential Revision: https://reviews.llvm.org/D63978 llvm-svn: 374061
33 lines
1008 B
C++
33 lines
1008 B
C++
// REQUIRES: x86-registered-target
|
|
// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -emit-merged-ifs \
|
|
// RUN: -interface-stub-version=experimental-ifs-v1 %s | \
|
|
// RUN: FileCheck %s
|
|
|
|
// RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | llvm-nm - 2>&1 | \
|
|
// RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
|
|
|
|
// CHECK: Symbols:
|
|
// CHECK-DAG: _ZN3qux3barEii: { Type: Func }
|
|
// CHECK-DAG: _ZN3baz3addIiEET_S1_S1_: { Type: Func }
|
|
// CHECK-DAG: _Z4fbarff: { Type: Func }
|
|
// CHECK-DAG: _ZN3baz3addIfEET_S1_S1_: { Type: Func }
|
|
|
|
// Same symbols just different order.
|
|
// CHECK-SYMBOLS-DAG: _Z4fbarff
|
|
// CHECK-SYMBOLS-DAG: _ZN3baz3addIfEET_S1_S1_
|
|
// CHECK-SYMBOLS-DAG: _ZN3baz3addIiEET_S1_S1_
|
|
// CHECK-SYMBOLS-DAG: _ZN3qux3barEii
|
|
|
|
namespace baz {
|
|
template <typename T>
|
|
T add(T a, T b) {
|
|
return a + b;
|
|
}
|
|
} // namespace baz
|
|
|
|
namespace qux {
|
|
int bar(int a, int b) { return baz::add<int>(a, b); }
|
|
} // namespace qux
|
|
|
|
float fbar(float a, float b) { return baz::add<float>(a, b); }
|