[PATCH] D52784: [ARM][AArch64] Pass through endianness flags to the GNU assembler and linker

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 12 11:26:44 PDT 2018


nickdesaulniers added inline comments.


================
Comment at: lib/Driver/ToolChains/Gnu.cpp:357-364
+    const char* EndianFlag = "-EL";
+    if (isArmBigEndian(Triple, Args)) {
+      EndianFlag = "-EB";
+      arm::appendBE8LinkFlag(Args, CmdArgs, Triple);
+    }
+    else if (Arch == llvm::Triple::aarch64_be)
+      EndianFlag = "-EB";
----------------
nickdesaulniers wrote:
> ```
> bool IsBigEndian = isArmBigEndian(Triple, Args);
> if (IsBigEndian)
>   arm::appendBE8LinkFlag(Args, CmdArgs, Triple);
> IsBigEndian |= Arch == llvm::Triple::aarch64_be;
> CmdArgs.push_back(IsBigEndian ? "-EB" : "-EL");
> ```
`IsBigEndian |= Arch == llvm::Triple::aarch64_be;`

should be:

`IsBigEndian = IsBigEndian || Arch == llvm::Triple::aarch64_be;`

in order to not evaluate `Arch == llvm::Triple::aarch64_b` if `IsBigEndian` is already true.


https://reviews.llvm.org/D52784





More information about the cfe-commits mailing list