]> granicus.if.org Git - clang/commit
Revert D60974 "[clang-ifs] Clang Interface Stubs, first version."
authorFangrui Song <maskray@google.com>
Tue, 18 Jun 2019 05:52:39 +0000 (05:52 +0000)
committerFangrui Song <maskray@google.com>
Tue, 18 Jun 2019 05:52:39 +0000 (05:52 +0000)
commit3a552dd809e0327c89b977c76d4f5372d955501b
tree0bc62b440ccf53059cb8a783900e401884d6e08f
parent722377e37f66f2720842923ce7f4287d5d87bee3
Revert D60974 "[clang-ifs] Clang Interface Stubs, first version."

This reverts commit rC363626.

clangIndex depends on clangFrontend. r363626 adds a dependency from
clangFrontend to clangIndex, which creates a circular dependency.

This is disallowed by -DBUILD_SHARED_LIBS=on builds:

    CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
      "clangFrontend" of type SHARED_LIBRARY
        depends on "clangIndex" (weak)
      "clangIndex" of type SHARED_LIBRARY
        depends on "clangFrontend" (weak)
    At least one of these targets is not a STATIC_LIBRARY.  Cyclic dependencies are allowed only among static libraries.

Note, the dependency on clangIndex cannot be removed because
libclangFrontend.so is linked with -Wl,-z,defs: a shared object must
have its full direct dependencies specified on the linker command line.

In -DBUILD_SHARED_LIBS=off builds, this appears to work when linking
`bin/clang-9`. However, it can cause trouble to downstream clang library
users. The llvm build system links libraries this way:

    clang main_program_object_file ... lib/libclangIndex.a ...  lib/libclangFrontend.a -o exe

libclangIndex.a etc are not wrapped in --start-group.

If the downstream application depends on libclangFrontend.a but not any
other clang libraries that depend on libclangIndex.a, this can cause undefined
reference errors when the linker is ld.bfd or gold.

The proper fix is to not include clangIndex files in clangFrontend.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363649 91177308-0d34-0410-b5e6-96231b3b80d8
23 files changed:
include/clang/Basic/DiagnosticFrontendKinds.td
include/clang/Driver/Options.td
include/clang/Driver/Types.def
include/clang/Frontend/FrontendActions.h
include/clang/Frontend/FrontendOptions.h
lib/Driver/Driver.cpp
lib/Driver/ToolChains/Clang.cpp
lib/Frontend/CMakeLists.txt
lib/Frontend/CompilerInvocation.cpp
lib/Frontend/InterfaceStubFunctionsConsumer.cpp [deleted file]
lib/FrontendTool/ExecuteCompilerInvocation.cpp
test/InterfaceStubs/bad-format.cpp [deleted file]
test/InterfaceStubs/class-template-specialization.cpp [deleted file]
test/InterfaceStubs/externstatic.c [deleted file]
test/InterfaceStubs/function-template-specialization.cpp [deleted file]
test/InterfaceStubs/hidden-class-inheritance.cpp [deleted file]
test/InterfaceStubs/inline.c [deleted file]
test/InterfaceStubs/inline.h [deleted file]
test/InterfaceStubs/object.cpp [deleted file]
test/InterfaceStubs/template-namespace-function.cpp [deleted file]
test/InterfaceStubs/virtual.cpp [deleted file]
test/InterfaceStubs/visibility.cpp [deleted file]
test/InterfaceStubs/weak.cpp [deleted file]