diff options
author | Fangrui Song <maskray@google.com> | 2018-07-18 22:02:48 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2018-07-18 22:02:48 +0000 |
commit | 4a2948253fd59444ba2e0ce7384d1ca2f8a4f8f3 (patch) | |
tree | abc1a6dbb09428673cb234c802c7b4f6eaefa371 | |
parent | 2df314d17f83c6b7d47c8933d2954afc9e19439d (diff) | |
download | bcm5719-llvm-4a2948253fd59444ba2e0ce7384d1ca2f8a4f8f3.tar.gz bcm5719-llvm-4a2948253fd59444ba2e0ce7384d1ca2f8a4f8f3.zip |
[ELF] Error if -r --gdb-index are used together
Reviewers: ruiu, espindola
Subscribers: emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D49513
llvm-svn: 337427
-rw-r--r-- | lld/ELF/Driver.cpp | 2 | ||||
-rw-r--r-- | lld/test/ELF/driver.test | 32 |
2 files changed, 20 insertions, 14 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 4c0e1f9dba5..342e70953fb 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -294,6 +294,8 @@ static void checkOptions(opt::InputArgList &Args) { error("-r and -shared may not be used together"); if (Config->GcSections) error("-r and --gc-sections may not be used together"); + if (Config->GdbIndex) + error("-r and --gdb-index may not be used together"); if (Config->ICF) error("-r and --icf may not be used together"); if (Config->Pie) diff --git a/lld/test/ELF/driver.test b/lld/test/ELF/driver.test index b2ee2bb220f..20bc7950972 100644 --- a/lld/test/ELF/driver.test +++ b/lld/test/ELF/driver.test @@ -35,31 +35,35 @@ # RUN: not ld.lld -r --gc-sections %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR3 %s # ERR3: -r and --gc-sections may not be used together +## Attempt to use -r and --gdb-index together +# RUN: not ld.lld -r --gdb-index %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR4 %s +# ERR4: -r and --gdb-index may not be used together + ## Attempt to use -r and --icf together -# RUN: not ld.lld -r --icf=all %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR4 %s -# ERR4: -r and --icf may not be used together +# RUN: not ld.lld -r --icf=all %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR5 %s +# ERR5: -r and --icf may not be used together ## Attempt to use -r and -pie together -# RUN: not ld.lld -r -pie %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR5 %s -# ERR5: -r and -pie may not be used together +# RUN: not ld.lld -r -pie %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR6 %s +# ERR6: -r and -pie may not be used together ## Attempt to use -shared and -pie together -# RUN: not ld.lld -shared -pie %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR6 %s -# ERR6: -shared and -pie may not be used together +# RUN: not ld.lld -shared -pie %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR7 %s +# ERR7: -shared and -pie may not be used together ## "--output=foo" is equivalent to "-o foo". -# RUN: not ld.lld %t --output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR7 %s -# ERR7: cannot open output file /no/such/file +# RUN: not ld.lld %t --output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR8 %s +# ERR8: cannot open output file /no/such/file ## "-output=foo" is equivalent to "-o utput=foo". -# RUN: not ld.lld %t -output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR8 %s -# ERR8: cannot open output file utput=/no/such/file +# RUN: not ld.lld %t -output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR9 %s +# ERR9: cannot open output file utput=/no/such/file -# RUN: not ld.lld %t -z foo 2>&1 | FileCheck -check-prefix=ERR9 %s -# ERR9: unknown -z value: foo +# RUN: not ld.lld %t -z foo 2>&1 | FileCheck -check-prefix=ERR10 %s +# ERR10: unknown -z value: foo -# RUN: not ld.lld %t -z max-page-size 2>&1 | FileCheck -check-prefix=ERR10 %s -# ERR10: unknown -z value: max-page-size +# RUN: not ld.lld %t -z max-page-size 2>&1 | FileCheck -check-prefix=ERR11 %s +# ERR11: unknown -z value: max-page-size .globl _start _start: |