[PATCH] D52666: [LLD][COFF] Fix pdb loading when the path points to a removable device

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 28 11:55:01 PDT 2018


Lgtm
On Fri, Sep 28, 2018 at 11:34 AM Alexandre Ganea via Phabricator <
reviews at reviews.llvm.org> wrote:

> aganea created this revision.
> aganea added reviewers: thakis, zturner.
> Herald added a subscriber: llvm-commits.
>
> As described here <
> https://bugs.chromium.org/p/chromium/issues/detail?id=889990>, this patch
> fixes the case where an OBJ has a reference to a PDB path which happens to
> map locally to a removable device, drive which has no media inserted at the
> time of the link. In that case, the first attempt to load the PDB returns
> "resource unavailable try again". This prevents retrying the PDB load with
> the OBJ's path.
>
>
> Repository:
>   rLLD LLVM Linker
>
> https://reviews.llvm.org/D52666
>
> Files:
>   COFF/PDB.cpp
>
>
> Index: COFF/PDB.cpp
> ===================================================================
> --- COFF/PDB.cpp
> +++ COFF/PDB.cpp
> @@ -351,6 +351,12 @@
>
>  static Expected<std::unique_ptr<pdb::NativeSession>>
>  tryToLoadPDB(const GUID &GuidFromObj, StringRef TSPath) {
> +  // Ensure the file exists before anything else. We want to return
> ENOENT,
> +  // "file not found", even if the path points to a removable device (in
> which
> +  // case the return message would be EAGAIN, "resource unavailable try
> again")
> +  if (!llvm::sys::fs::exists(TSPath))
> +    return errorCodeToError(std::error_code(ENOENT,
> std::generic_category()));
> +
>    ErrorOr<std::unique_ptr<MemoryBuffer>> MBOrErr = MemoryBuffer::getFile(
>        TSPath, /*FileSize=*/-1, /*RequiresNullTerminator=*/false);
>    if (!MBOrErr)
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180928/ee5ebfe2/attachment.html>


More information about the llvm-commits mailing list