This is an archive of the discontinued LLVM Phabricator instance.

[clang][IFS] Allow 2 output files when using -o and -c with clang IFS stubs.
ClosedPublic

Authored by plotfi on Nov 26 2019, 9:06 PM.

Details

Summary

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.

Diff Detail

Event Timeline

plotfi created this revision.Nov 26 2019, 9:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 26 2019, 9:06 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
cishida marked an inline comment as done.Dec 5 2019, 7:30 AM
cishida added inline comments.
clang/test/InterfaceStubs/driver-test3.c
7

wouldn't hurt to validate that the object file was generated

plotfi updated this revision to Diff 232455.Dec 5 2019, 2:36 PM

Updating comments and altering test as per @cishida and @compnerd's feedback

plotfi marked an inline comment as done.Dec 5 2019, 2:37 PM
plotfi added inline comments.
clang/test/InterfaceStubs/driver-test3.c
7

ditto.

plotfi edited the summary of this revision. (Show Details)Dec 5 2019, 2:38 PM
plotfi edited the summary of this revision. (Show Details)
compnerd accepted this revision.Dec 6 2019, 3:14 PM
This revision is now accepted and ready to land.Dec 6 2019, 3:14 PM
This revision was automatically updated to reflect the committed changes.