Skip to content

Commit 7efa498

Browse files
committed
[ELF] Warn about to-be-removed -d, -dc, -dp, and --[no-]define-common
See llvm#53660
1 parent 43f2179 commit 7efa498

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

lld/ELF/Driver.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,9 @@ static void readConfigs(opt::InputArgList &args) {
12401240
error(errPrefix + toString(pat.takeError()));
12411241
}
12421242

1243+
if (args.hasArg(OPT_define_common, OPT_no_define_common))
1244+
warn("-d, -dc, -dp, and --[no-]define-common will be removed. See https://github.com/llvm/llvm-project/issues/53660");
1245+
12431246
cl::ResetAllOptionOccurrences();
12441247

12451248
// Parse LTO options.

lld/test/ELF/relocatable-common.s

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
33
# RUN: ld.lld -r %t1.o -o %t
44
# RUN: llvm-readobj --symbols -r %t | FileCheck %s
5-
# RUN: ld.lld -r --no-define-common %t1.o -o %t
5+
# RUN: ld.lld -r --no-define-common %t1.o -o %t 2>&1 | FileCheck %s --check-prefix=WARN
66
# RUN: llvm-readobj --symbols -r %t | FileCheck %s
7-
# RUN: ld.lld -r --define-common %t1.o -o %t
7+
# RUN: ld.lld -r --define-common %t1.o -o %t 2>&1 | FileCheck %s --check-prefix=WARN
88
# RUN: llvm-readobj --symbols -r %t | FileCheck -check-prefix=DEFCOMM %s
9-
# RUN: ld.lld -r -d %t1.o -o %t
9+
# RUN: ld.lld -r -d %t1.o -o %t 2>&1 | FileCheck %s --check-prefix=WARN
1010
# RUN: llvm-readobj --symbols -r %t | FileCheck -check-prefix=DEFCOMM %s
11-
# RUN: ld.lld -r -dc %t1.o -o %t
11+
# RUN: ld.lld -r -dc %t1.o -o %t 2>&1 | FileCheck %s --check-prefix=WARN
1212
# RUN: llvm-readobj --symbols -r %t | FileCheck -check-prefix=DEFCOMM %s
13-
# RUN: ld.lld -r -dp %t1.o -o %t
13+
# RUN: ld.lld -r -dp %t1.o -o %t 2>&1 | FileCheck %s --check-prefix=WARN
1414
# RUN: llvm-readobj --symbols -r %t | FileCheck -check-prefix=DEFCOMM %s
1515

16+
# WARN: warning: -d, -dc, -dp, and --[no-]define-common will be removed. See https://github.com/llvm/llvm-project/issues/53660
17+
1618
# CHECK: Symbol {
1719
# CHECK: Name: common
1820
# CHECK-NEXT: Value: 0x4

0 commit comments

Comments
 (0)