Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6141,9 +6141,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-fno-direct-access-external-data");
}

if (Args.hasFlag(options::OPT_fno_plt, options::OPT_fplt, false)) {
CmdArgs.push_back("-fno-plt");
}
if (Triple.isOSBinFormatELF() && (Triple.isAArch64() || Triple.isX86()))
Args.addOptOutFlag(CmdArgs, options::OPT_fplt, options::OPT_fno_plt);

// -fhosted is default.
// TODO: Audit uses of KernelOrKext and see where it'd be more appropriate to
Expand Down
9 changes: 9 additions & 0 deletions clang/test/Driver/fno-plt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// RUN: %clang -### -c --target=aarch64 -fno-plt -Werror %s 2>&1 | FileCheck %s
// RUN: %clang -### -c --target=x86_64 -fno-plt -Werror %s 2>&1 | FileCheck %s
// RUN: %clang -### -c --target=aarch64 -fno-plt -fplt -Werror %s 2>&1 | FileCheck %s --check-prefix=NO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's quite many negations involved in this check line, can you rename the NO prefix to e.g. PLT or something like that, to signify the case when -fplt is in effect? Then again, using --check-prefix=PLT for the aarch64-windows target feels a bit misleading as well. Perhaps if we'd rename CHECK into NOPLT and NO into DEFAULT?

// RUN: %clang -### -c --target=powerpc64 -fno-plt %s 2>&1 | FileCheck %s --check-prefixes=WARN,NO
// RUN: %clang -### -c --target=aarch64-windows -fno-plt %s 2>&1 | FileCheck %s --check-prefixes=WARN,NO

// WARN: warning: argument unused during compilation: '-fno-plt' [-Wunused-command-line-argument]
// CHECK: "-fno-plt"
// NO-NOT: "-fno-plt"
Loading