----- Original Message ----- > Author: rengolin > Date: Wed Aug 28 18:56:07 2013 > New Revision: 189542 > > URL: http://llvm.org/viewvc/llvm-project?rev=189542&view=rev > Log: > use the last passed -munaligned-access / -mno-unaligned-access > > Passing inconsistent munaligned-access / mno-unaligned-access > flags, intentionally resulted in a warning and the flag > no-unaligned-access being used. > > Gcc does, at least in practice, use the last flag in such a > case. This patch updates clang behaviour accordingly; use the > last flag or base alignment behaviour on the target (which > llvm will do if no flag is explicitly passed) > > Patch by Jeroen Hofstee. > > Modified: > cfe/trunk/lib/Driver/Tools.cpp > cfe/trunk/test/Driver/arm-alignment.c > > Modified: cfe/trunk/lib/Driver/Tools.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=189542&r1=189541&r2=189542&view=diff > ============================================================================== > --- cfe/trunk/lib/Driver/Tools.cpp (original) > +++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug 28 18:56:07 2013 > @@ -2944,12 +2944,15 @@ void Clang::ConstructJob(Compilation &C, > } > // -mkernel implies -mstrict-align; don't add the redundant > option. > if (!KernelOrKext) { > - if (Args.hasArg(options::OPT_mno_unaligned_access)) { > - CmdArgs.push_back("-backend-option"); > - CmdArgs.push_back("-arm-strict-align"); > - } else if (Args.hasArg(options::OPT_munaligned_access)) { > - CmdArgs.push_back("-backend-option"); > - CmdArgs.push_back("-arm-no-strict-align"); > + if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access, > + options::OPT_munaligned_access)) { > + if (A->getOption().matches(options::OPT_mno_unaligned_access)) > { > + CmdArgs.push_back("-backend-option"); > + CmdArgs.push_back("-arm-strict-align"); > + } else { > + CmdArgs.push_back("-backend-option"); > + CmdArgs.push_back("-arm-no-strict-align");
>From what Chandler tells me, using -backend-option plays horribly when the >compiler is used via the tooling interface, and should really be avoided. This >seems like something that belongs in TargetOptions; can we move it there? -Hal > + } > } > } > > > Modified: cfe/trunk/test/Driver/arm-alignment.c > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-alignment.c?rev=189542&r1=189541&r2=189542&view=diff > ============================================================================== > --- cfe/trunk/test/Driver/arm-alignment.c (original) > +++ cfe/trunk/test/Driver/arm-alignment.c Wed Aug 28 18:56:07 2013 > @@ -1,9 +1,25 @@ > // RUN: %clang -target arm-none-gnueeabi -munaligned-access -### %s > 2> %t > // RUN: FileCheck --check-prefix=CHECK-UNALIGNED < %t %s > > +// RUN: %clang -target arm-none-gnueeabi -mstrict-align > -munaligned-access -### %s 2> %t > +// RUN: FileCheck --check-prefix=CHECK-UNALIGNED < %t %s > + > +// RUN: %clang -target arm-none-gnueeabi -mno-unaligned-access > -munaligned-access -### %s 2> %t > +// RUN: FileCheck --check-prefix=CHECK-UNALIGNED < %t %s > + > // CHECK-UNALIGNED: "-backend-option" "-arm-no-strict-align" > > + > // RUN: %clang -target arm-none-gnueeabi -mno-unaligned-access -### > %s 2> %t > // RUN: FileCheck --check-prefix=CHECK-ALIGNED < %t %s > > +// RUN: %clang -target arm-none-gnueeabi -mstrict-align -### %s 2> > %t > +// RUN: FileCheck --check-prefix=CHECK-ALIGNED < %t %s > + > +// RUN: %clang -target arm-none-gnueabi -munaligned-access > -mno-unaligned-access -### %s 2> %t > +// RUN: FileCheck --check-prefix=CHECK-ALIGNED < %t %s > + > +// RUN: %clang -target arm-none-gnueabi -munaligned-access > -mstrict-align -### %s 2> %t > +// RUN: FileCheck --check-prefix=CHECK-ALIGNED < %t %s > + > // CHECK-ALIGNED: "-backend-option" "-arm-strict-align" > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > -- Hal Finkel Assistant Computational Scientist Leadership Computing Facility Argonne National Laboratory _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
