diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -268,7 +268,7 @@ A.render(Args, CmdArgs); } // Handle reserved library options. - if (A.getOption().matches(options::OPT_Z_reserved_lib_stdcxx)) + else if (A.getOption().matches(options::OPT_Z_reserved_lib_stdcxx)) TC.AddCXXStdlibLibArgs(Args, CmdArgs); else if (A.getOption().matches(options::OPT_Z_reserved_lib_cckext)) TC.AddCCKextLibArgs(Args, CmdArgs); diff --git a/clang/test/Driver/Xlinker-args.c b/clang/test/Driver/Xlinker-args.c --- a/clang/test/Driver/Xlinker-args.c +++ b/clang/test/Driver/Xlinker-args.c @@ -13,7 +13,7 @@ // RUN: FileCheck -check-prefix=LINUX < %t %s // RUN: %clang -target powerpc-unknown-aix -### \ -// RUN: -b one %s 2> %t +// RUN: -b one -b two %s 2> %t // RUN: FileCheck -check-prefix=AIX < %t %s // RUN: %clang -target powerpc-unknown-linux -### \ @@ -23,7 +23,7 @@ // DARWIN-NOT: --no-demangle // DARWIN: "one" "two" "three" "four" "-z" "five" "-r" // LINUX: "--no-demangle" "-e" "_start" "one" "two" "three" "four" "-z" "five" "-r" {{.*}} "-T" "a.lds" -// AIX: "-b" "one" +// AIX: "-b" "one" "-b" "two" // NOT-AIX: error: unsupported option '-b' for target 'powerpc-unknown-linux' // Check that we forward '-Xlinker' and '-Wl,' on Windows.