I have a small patch that fixes an issue that prevents use of the Swift REPL on arm-linux. When working with targets that the OS presents as armv7l, for example, there is an inconsistency when the architecture sub-type is parsed. Detecting this condition and removing the ‘l’ fixes it. I’ve tried to make this logic as restrictive in scope and application as possible. It will only trigger on arm hosts in linux.
The theory of operation is that, within llvm, the v6l and v7l subtypes alias to v6 and v7 respectively. Also in llvm, when a triple is created, the original string is preserved until parts of it are mutated. When llvm executes its architecture synonym logic, armv7l (and armv6l once my patch there is merged) is resolved to armv7. By querying the parsed subtype from llvm, this centralized logic is used to sanitize the architecture. The end result is that if the architecture provided to the triple constructor is an alias for the v7 or v6 subtype, it is discarded and replaced with v6 or v7 itself.
My hope is that this code can make it into the Swift 2.2 release, and I’m working with Bob Wison on a related patch to LLVM. I appreciate any and all comments and suggestions.
lldb.diff (956 Bytes)