mstorsjo added a comment.

In D128268#3598967 <https://reviews.llvm.org/D128268#3598967>, @DavidSpickett 
wrote:

>> However, after this commit, if the object file is advertised with the 
>> different environment (either when built in a mingw environment, or if that 
>> setting is set), the fat binary validation won't accept the file any longer.
>
> Is "this commit" referring to 
> https://reviews.llvm.org/rG25c8a061c5739677d2fc0af29a8cc9520207b923 or to the 
> change we're reviewing here?

Sorry, I meant 25c8a061c5739677d2fc0af29a8cc9520207b923 
<https://reviews.llvm.org/rG25c8a061c5739677d2fc0af29a8cc9520207b923>.

> I'm struggling to think through what this is actually fixing. Is the issue 
> that one half of a fat binary can have a different ABI? Wouldn't both sides 
> of the fat binary be loaded as the ABI chosen in the setting, or is that 
> exactly what you're fixing.

The issue is that in the case of a fat binary, we run a loop to check and pick 
an architecture out of it: 
https://github.com/llvm/llvm-project/blob/main/lldb/source/Target/TargetList.cpp#L173-L184
 This is checked against the architectures added here: 
https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp#L127-L131

(In the case of a non-fat binary, i.e. all other architectures than i386/i686 
on PECOFF, we hit this case here, where we don't validate the arch spec at all: 
https://github.com/llvm/llvm-project/blob/main/lldb/source/Target/TargetList.cpp#L160-L164)

Now since the addition of the new setting in 
25c8a061c5739677d2fc0af29a8cc9520207b923 
<https://reviews.llvm.org/rG25c8a061c5739677d2fc0af29a8cc9520207b923>, 
`ObjectFile::GetModuleSpecifications` can return `i386-pc-windows-gnu` and 
`i686-pc-windows-gnu`, while `PlatformWindows` provides a list containing 
`i386-pc-windows` (which is normalized to `i386-pc-windows-msvc`) and 
`i686-pc-windows` (`...-msvc`). Due to the differing environments, these are 
deemed incompatible, and LLDB flat out refuses to load the file, with the error 
message `error: no matching platforms found for this file`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128268

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to