summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorPuyan Lotfi <puyan@puyan.org>2019-11-26 23:23:49 -0500
committerPuyan Lotfi <puyan@puyan.org>2019-12-09 14:47:17 -0500
commitd694594d7650571dec40cc0ef9db6087963d62a0 (patch)
treebb70f47cef8cb632707f754d8a6fc2658be45e90 /clang/test
parentec71238916dec90c2ef9435af5979a345a447575 (diff)
downloadbcm5719-llvm-d694594d7650571dec40cc0ef9db6087963d62a0.tar.gz
bcm5719-llvm-d694594d7650571dec40cc0ef9db6087963d62a0.zip
[clang][IFS] Allow 2 output files when using -o and -c with clang IFS stubs.
This patch allows for -o to be used with -c when compiling with clang interface stubs enabled. This is because the second file will be an intermediate ifs stubs file that is the text stub analog of the .o file. Both get produces in this case, so two files. Why are we doing this? Because we want to support the case where interface stubs are used bu first invoking clang like so: clang -c <other flags> -emit-interface-stubs foo.c -o foo.o ... clang -emit-interface-stubs <.o files> -o libfoo.so This should generate N .ifs files, and one .ifso file. Prior to this patch, using -o with the -c invocation was not possible. Currently the clang driver supports generating a a.out/.so file at the same time as a merged ifs file / ifso file, but this is done by checking that the final job is the IfsMerge job. When -c is used, the final job is a Compile job so what this patch does is check to figure out of the job type is TY_IFS_CPP. Differential Revision: https://reviews.llvm.org/D70763
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/InterfaceStubs/driver-test3.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/InterfaceStubs/driver-test3.c b/clang/test/InterfaceStubs/driver-test3.c
new file mode 100644
index 00000000000..bccd1c9bccd
--- /dev/null
+++ b/clang/test/InterfaceStubs/driver-test3.c
@@ -0,0 +1,19 @@
+// REQUIRES: x86-registered-target
+// REQUIRES: shell
+
+// RUN: mkdir -p %t; cd %t
+// RUN: %clang -target x86_64-unknown-linux-gnu -c -emit-interface-stubs %s -o %t/driver-test3.o
+// RUN: llvm-nm %t/driver-test3.o | FileCheck --check-prefix=CHECK-OBJ %s
+// RUN: cat %t/driver-test3.ifs | FileCheck --check-prefix=CHECK-IFS %s
+
+// CHECK-OBJ: bar
+
+// CHECK-IFS: --- !experimental-ifs-v1
+// CHECK-IFS-NEXT: IfsVersion:
+// CHECK-IFS-NEXT: Triple:
+// CHECK-IFS-NEXT: ObjectFileFormat:
+// CHECK-IFS-NEXT: Symbols:
+// CHECK-IFS-NEXT: "bar" : { Type: Func }
+// CHECK-IFS-NEXT: ...
+
+int bar(int a) { return a; }
OpenPOWER on IntegriCloud