[PATCH] D45092: [Driver] Don't forward -m[no-]unaligned-access options to GCC when assembling/linking
Chad Rosier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 11 07:23:48 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rC329810: [Driver] Don't forward -m[no-]unaligned-access options to GCC when… (authored by mcrosier, committed by ).
Herald added a subscriber: cfe-commits.
Repository:
rC Clang
https://reviews.llvm.org/D45092
Files:
lib/Driver/ToolChains/Gnu.cpp
test/Driver/gcc_forward.c
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
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<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);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45092.142004.patch
Type: text/x-patch
Size: 1225 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180411/042fcf1c/attachment.bin>
More information about the cfe-commits
mailing list