Skip to content

Commit c947709

Browse files
committed
[Driver] Support -Wa,--defsym similar to -Wa,-defsym
When the integrated assembler is enabled, clangDriver implements a small set of popular -Wa, options. "-defsym" is implemented (https://reviews.llvm.org/D26213), but the more common "--defsym" is not. Support "--defsym". Close #95386
1 parent db08b09 commit c947709

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2647,7 +2647,7 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
26472647
} else if (Value.starts_with("-mcpu") || Value.starts_with("-mfpu") ||
26482648
Value.starts_with("-mhwdiv") || Value.starts_with("-march")) {
26492649
// Do nothing, we'll validate it later.
2650-
} else if (Value == "-defsym") {
2650+
} else if (Value == "-defsym" || Value == "--defsym") {
26512651
if (A->getNumValues() != 2) {
26522652
D.Diag(diag::err_drv_defsym_invalid_format) << Value;
26532653
break;

clang/test/Driver/defsym.s

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
// XFAIL: target={{.*}}-aix{{.*}}
22

33
// RUN: %clang -### -c -integrated-as %s \
4-
// RUN: -Wa,-defsym,abc=5 -Wa,-defsym,xyz=0xa \
4+
// RUN: -Wa,-defsym,abc=5 -Wa,--defsym,xyz=0xa \
55
// RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-DEFSYM1
66

77
// RUN: %clang -### -c -no-integrated-as -target x86_64-unknown-unknown %s \
8-
// RUN: -Wa,-defsym,abc=5 -Wa,-defsym,xyz=0xa \
8+
// RUN: -Wa,-defsym,abc=5 -Wa,--defsym,xyz=0xa \
99
// RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-DEFSYM1
1010

11-
// CHECK-DEFSYM1: "-defsym"
12-
// CHECK-DEFSYM1: "abc=5"
13-
// CHECK-DEFSYM1: "-defsym"
14-
// CHECK-DEFSYM1: "xyz=0xa"
11+
// CHECK-DEFSYM1: "-defsym" "abc=5" "--defsym" "xyz=0xa"
1512

1613
// RUN: not %clang -c -integrated-as -o /dev/null %s \
1714
// RUN: -Wa,-defsym,abc= \

0 commit comments

Comments
 (0)