summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Driver/ToolChains/Gnu.cpp7
-rw-r--r--clang/test/Driver/gcc_forward.c6
2 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index a50e5bd6632..f70e5a58c81 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -85,6 +85,13 @@ void tools::gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
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<AssembleJobAction>(JA) || isa<LinkJobAction>(JA)) &&
+ (A->getOption().matches(options::OPT_munaligned_access) ||
+ A->getOption().matches(options::OPT_mno_unaligned_access)))
+ continue;
+
A->render(Args, CmdArgs);
}
}
diff --git a/clang/test/Driver/gcc_forward.c b/clang/test/Driver/gcc_forward.c
index d28e432b1e1..f75b1c738b0 100644
--- a/clang/test/Driver/gcc_forward.c
+++ b/clang/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
OpenPOWER on IntegriCloud