Index: lib/Driver/ToolChains/Gnu.cpp =================================================================== --- lib/Driver/ToolChains/Gnu.cpp +++ lib/Driver/ToolChains/Gnu.cpp @@ -85,6 +85,13 @@ A->getOption().matches(options::OPT_W_Group)) continue; + // Don't forward -mno-unaligned-access since GCC doesn't understand + // it and because it doesn't affect the assembly or link steps. + if ((isa(JA) || isa(JA)) && + (O.getID() == options::OPT_munaligned_access || + O.getID() != options::OPT_mno_unaligned_access)) + continue; + A->render(Args, CmdArgs); } } Index: test/Driver/gcc_forward.c =================================================================== --- test/Driver/gcc_forward.c +++ test/Driver/gcc_forward.c @@ -34,3 +34,9 @@ // RUN: | FileCheck --check-prefix=CHECK-ASM %s // CHECK-ASM: as // CHECK-ASM-NOT: "-g" + +// Check that we're not forwarding -mno-unaligned-access. +// RUN: %clang -target aarch64-none-elf -mno-unaligned-access %s -### 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-ARM %s +// CHECK-ARM: gcc{{[^"]*}}" +// CHECK-ARM-NOT: -mno-unaligned-access