This is an archive of the discontinued LLVM Phabricator instance.

Fix `llvm-config` to emit the linker flag for the combined shared object built by autoconfig/make instead of the individual components.
ClosedPublic

Authored by DiamondLovesYou on Jun 24 2015, 3:53 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

DiamondLovesYou retitled this revision from to Fix `llvm-config` to emit the linker flag for the combined shared object built by autoconfig/make instead of the individual components..
DiamondLovesYou updated this object.
DiamondLovesYou edited the test plan for this revision. (Show Details)
DiamondLovesYou added a reviewer: jfb.
DiamondLovesYou set the repository for this revision to rL LLVM.
DiamondLovesYou added a subscriber: Unknown Object (MLST).
jfb added a subscriber: dschuff.Jun 24 2015, 3:56 PM
jfb edited edge metadata.Jun 24 2015, 4:34 PM
jfb added a subscriber: echristo.

IIUC this is a problem when a toolchain is built with autoconf with dynamic libraries, and only ships the dynamic libraries (not the intermediate .a files). A regular build of LLVM has these .a files and aggregates all of them into the .so, so a toolchain would be silly to distribute the .a files because they're redundant.

This change seems useful, but I'd defer to folks such as @echristo who know better than I what LLVM's build system expects.

DiamondLovesYou edited edge metadata.

Fix a comment.

jfb added a comment.Jul 7 2015, 2:25 PM

lgtm after this change.

tools/llvm-config/llvm-config.cpp
402 ↗(On Diff #28832)

Taking a second look at this, could you restructure to:

if (Lib.startswith("lib")) {
  size_t FromEnd = 0;
  if (Lib.endswith(".a")) {
    FromEnd = 2;
  } else if (Lib.endswith(".so")) {
    FromEnd = 3;
  } else if (Lib.endswith(".dylib")) {
    FromEnd = 6;
  } else {
    FromEnd = 0;
    break;
  }
  OS << "-l" << Lib.slice(3, Lib.size() - FromEnd);
  continue;

Restructure in response to JF's comments.

This revision was automatically updated to reflect the committed changes.
jfb added a comment.Jul 14 2015, 8:11 AM

Reverted in r242152.