This is an archive of the discontinued LLVM Phabricator instance.

Tighten the check for Tool name ( ar,nm,dlltool, lib)
AbandonedPublic

Authored by MaskRay on Dec 4 2019, 12:06 PM.

Details

Reviewers
raj.khem
Summary

This helps in creating canonical names for cross tool versions which may contain lib in their name. In Yocto this is common when creating multilib versions that lib32/lib/lib64 is added to canonical name to indicate multilib variant. This fails if we do not check the toolname to be at the end of string.

In multilib(lib32) case, the arm-pokymllib32-linux-gnueabi-llvm-ar (${TARGET_PREFIX}llvm-ar) gives:
qc: no such file or directory

Which is because when the llvm-ar symbol link's name contains "lib", it would be considered as llvm-lib:

Diff Detail

Event Timeline

raj.khem created this revision.Dec 4 2019, 12:06 PM

On Debian, the package "llvm-8" installs llvm-ar at /usr/bin/llvm-ar-8. Maybe we should check either endswith("ar") or contains("ar-")? I think the existing _lower part is probably not necessary.

raj.khem updated this revision to Diff 232193.Dec 4 2019, 12:55 PM

Oh, I think this may break llvm-dlltool.exe and llvm-ar.exe on Windows. We probably need a more sophisticated heuristic.

Oh, I think this may break llvm-dlltool.exe and llvm-ar.exe on Windows. We probably need a more sophisticated heuristic.

Does sys::path::stem(ToolName) convert llvm-dlltool.exe to llvm-dlltool? I don't have a Windows machine to check with, but it looks like it *might*.

MaskRay added a comment.EditedDec 10 2019, 1:53 PM

Does sys::path::stem(ToolName) convert llvm-dlltool.exe

Oh, I think this may break llvm-dlltool.exe and llvm-ar.exe on Windows. We probably need a more sophisticated heuristic.

Does sys::path::stem(ToolName) convert llvm-dlltool.exe to llvm-dlltool? I don't have a Windows machine to check with, but it looks like it *might*.

It does, so it will break. Created D71302.

MaskRay commandeered this revision.Dec 10 2019, 5:47 PM
MaskRay edited reviewers, added: raj.khem; removed: MaskRay.

Superseded by D71302

MaskRay abandoned this revision.Dec 10 2019, 5:47 PM