[MacPorts] #53931: clang's ld doesn't recognise "-lto_library" flag on 10.6
MacPorts
noreply at macports.org
Fri Jun 30 16:55:37 UTC 2017
#53931: clang's ld doesn't recognise "-lto_library" flag on 10.6
-------------------------------------------------+-------------------------
Reporter: mojca | Owner: jeremyhu
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords: snowleopard
Port: clang-3.9 clang-4.0 llvm-3.9 |
llvm-4.0 |
-------------------------------------------------+-------------------------
Comment (by jeremyhu):
clang seems at first glance to be doing the right thing here:
{{{
unsigned Version[5] = {0, 0, 0, 0, 0};
if (Arg *A = Args.getLastArg(options::OPT_mlinker_version_EQ)) {
if (!Driver::GetReleaseVersion(A->getValue(), Version))
D.Diag(diag::err_drv_invalid_version_number) <<
A->getAsString(Args);
}
...
// Use -lto_library option to specify the libLTO.dylib path. Try to find
// it in clang installed libraries. ld64 will only look at this argument
// when it actually uses LTO, so libLTO.dylib only needs to exist at
link
// time if ld64 decides that it needs to use LTO.
// Since this is passed unconditionally, ld64 will never look for
libLTO.dylib
// next to it. That's ok since ld64 using a libLTO.dylib not matching
the
// clang version won't work anyways.
if (Version[0] >= 133) {
// Search for libLTO in <InstalledDir>/../lib/libLTO.dylib
StringRef P = llvm::sys::path::parent_path(D.Dir);
SmallString<128> LibLTOPath(P);
llvm::sys::path::append(LibLTOPath, "lib");
llvm::sys::path::append(LibLTOPath, "libLTO.dylib");
CmdArgs.push_back("-lto_library");
CmdArgs.push_back(C.getArgs().MakeArgString(LibLTOPath));
}
}}}
And in the `-v` output pasted above, I see `-target-linker-version 136`
being passed to clang, so the issue is that it thinks the linker is a
newer version than it really is.
--
Ticket URL: <https://trac.macports.org/ticket/53931#comment:20>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list