simpal01 created this revision. Herald added a subscriber: kristof.beyls. Herald added a project: All. simpal01 requested review of this revision. Herald added subscribers: cfe-commits, MaskRay. Herald added a project: clang.
IsARMBIgEndian function returns true only if: 1. The triples are either arm or thumb and the commandline has the option -mbig-endian 2. The triples are either armeb or thumbeb. Missing the checking of arm or thumb triples in the first case pass through the --be8 endian flag to linker For AArch64 as well which is not expected. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D155808 Files: clang/lib/Driver/ToolChains/Arch/ARM.cpp Index: clang/lib/Driver/ToolChains/Arch/ARM.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/ARM.cpp +++ clang/lib/Driver/ToolChains/Arch/ARM.cpp @@ -37,9 +37,12 @@ // '-mbig-endian'/'-EB'. Unlike other targets the flag does not result in a // normalized triple so we must handle the flag here. bool arm::isARMBigEndian(const llvm::Triple &Triple, const ArgList &Args) { - if (Arg *A = Args.getLastArg(options::OPT_mlittle_endian, - options::OPT_mbig_endian)) { - return !A->getOption().matches(options::OPT_mlittle_endian); + if ((Triple.getArch() == llvm::Triple::arm || + Triple.getArch() == llvm::Triple::thumb)) { + if (Arg *A = Args.getLastArg(options::OPT_mlittle_endian, + options::OPT_mbig_endian)) { + return !A->getOption().matches(options::OPT_mlittle_endian); + } } return Triple.getArch() == llvm::Triple::armeb ||
Index: clang/lib/Driver/ToolChains/Arch/ARM.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/ARM.cpp +++ clang/lib/Driver/ToolChains/Arch/ARM.cpp @@ -37,9 +37,12 @@ // '-mbig-endian'/'-EB'. Unlike other targets the flag does not result in a // normalized triple so we must handle the flag here. bool arm::isARMBigEndian(const llvm::Triple &Triple, const ArgList &Args) { - if (Arg *A = Args.getLastArg(options::OPT_mlittle_endian, - options::OPT_mbig_endian)) { - return !A->getOption().matches(options::OPT_mlittle_endian); + if ((Triple.getArch() == llvm::Triple::arm || + Triple.getArch() == llvm::Triple::thumb)) { + if (Arg *A = Args.getLastArg(options::OPT_mlittle_endian, + options::OPT_mbig_endian)) { + return !A->getOption().matches(options::OPT_mlittle_endian); + } } return Triple.getArch() == llvm::Triple::armeb ||
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits