[PATCH] D133705: [HIP] Fix unbundling archive

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 12 20:12:00 PDT 2022


yaxunl added a comment.

In D133705#3784605 <https://reviews.llvm.org/D133705#3784605>, @tra wrote:

>> Archives passed by -l: should not be prefixed with
>>  prefix lib and appended with '.a', but still need to be prefixed with
>>  paths in -L options.
>>  Archives passed as input files should not be prefixed
>> or appended with anything.
>
> I'm not sure I understand the requirements. WDYM by "archives passed as input files should not be prefixed or appended by anything" ? E.g. if i do `clang -o foo foo.o mylib.a`, is `mylib.a` prefixed with something or has something appended?
>
> It may help if you could rephrase it in terms of what *does* the code expect. E.g. 'archives with names `lib*.a` passed as direct inputs are not unbundled. All others are treated as potentially containing device code and are unbundled during [linking?]'.

It means "the file name is not prefixed with 'lib' and appended with '.a', and the file path is not prefixed with values from '-L' options. This is in contrast to archive names passed through '-l' options. The directly passed archives are still unbundled. I can update the description.

> Also, using `lib*.a` as pattern to tell device libraries from the host-ony one will be insufficient. There will be libraries with other extensions (e.g. `.lo` is fairly common) and there will be libraries that do not have `lib` prefix. I.e. nothing stops me from building `mylib.a` and linking with it as in the example above.

For archives passed as input files, we use the extension ('.a' on Linux and '.lib' on MSVC) to identify them. We do not restrict the file names to 'lib*.a', but they need to be '*.a' or '*.lib' to be identified as archives.

For arbitrary file names to be identified as archives, users can pass them by '-l:', e.g. '-l:file.bin', then clang will treat 'file.bin' as an archive.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133705/new/

https://reviews.llvm.org/D133705



More information about the cfe-commits mailing list