Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -4918,7 +4918,7 @@ if (Triple.isX86() && Triple.isOSBinFormatELF()) { StringRef Val = A->getValue(); if (Val != "all" && Val != "labels" && Val != "none" && - !(Val.startswith("list=") && llvm::sys::fs::exists(Val.substr(5)))) + !Val.startswith("list=")) D.Diag(diag::err_drv_invalid_value) << A->getAsString(Args) << A->getValue(); else Index: clang/test/Driver/fbasic-block-sections.c =================================================================== --- clang/test/Driver/fbasic-block-sections.c +++ clang/test/Driver/fbasic-block-sections.c @@ -4,9 +4,14 @@ // RUN: %clang -### -target x86_64 -fbasic-block-sections=labels %s -S 2>&1 | FileCheck -check-prefix=CHECK-OPT-LABELS %s // RUN: not %clang -c -target arm-unknown-linux -fbasic-block-sections=all %s -S 2>&1 | FileCheck -check-prefix=CHECK-TRIPLE %s // RUN: not %clang -c -target x86_64-apple-darwin10 -fbasic-block-sections=all %s -S 2>&1 | FileCheck -check-prefix=CHECK-TRIPLE %s +// RUN: %clang -### -target x86_64 -fbasic-block-sections=alll %s -S 2>&1 | FileCheck -check-prefix=CHECK-INVALID-VALUE %s +// RUN: %clang -### -target x86_64 -fbasic-block-sections=list %s -S 2>&1 | FileCheck -check-prefix=CHECK-INVALID-VALUE %s +// RUN: %clang -### -target x86_64 -fbasic-block-sections=list= %s -S 2>&1 | FileCheck -check-prefix=CHECK-OPT-NULL-LIST %s // // CHECK-OPT-NONE: "-fbasic-block-sections=none" // CHECK-OPT-ALL: "-fbasic-block-sections=all" // CHECK-OPT-LIST: "-fbasic-block-sections={{[^ ]*}}fbasic-block-sections.c" // CHECK-OPT-LABELS: "-fbasic-block-sections=labels" // CHECK-TRIPLE: error: unsupported option '-fbasic-block-sections=all' for target +// CHECK-INVALID-VALUE: error: invalid value {{[^ ]*}} in '-fbasic-block-sections={{.*}}' +// CHECK-OPT-NULL-LIST: "-fbasic-block-sections=list=" Index: clang/test/Frontend/fbasic-block-sections.c =================================================================== --- /dev/null +++ clang/test/Frontend/fbasic-block-sections.c @@ -0,0 +1,3 @@ +// RUN: not %clang_cc1 -fbasic-block-sections=list= -emit-obj %s 2>&1 | FileCheck %s +// +// CHECK: error: unable to load basic block sections function list: 'No such file or directory'