Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -7954,6 +7954,8 @@ def dwarf_debug_producer : Separate<["-"], "dwarf-debug-producer">,
def defsym : Separate<["-"], "defsym">,
HelpText<"Define a value for a symbol">;

def fdpic : Flag<["--"], "fdpic">, HelpText<"Enable FDPIC ABI (ARM only)">;

} // let Visibility = [CC1AsOption]

//===----------------------------------------------------------------------===//
Expand Down
4 changes: 4 additions & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,10 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
case llvm::Triple::thumbeb:
case llvm::Triple::arm:
case llvm::Triple::armeb:
if (Value == "--fdpic") {
CmdArgs.push_back("--fdpic");
continue;
}
if (Value.starts_with("-mimplicit-it=")) {
// Only store the value; the last value set takes effect.
ImplicitIt = Value.split("=").second;
Expand Down
2 changes: 2 additions & 0 deletions clang/test/Driver/arm-ias-Wa.s
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,5 @@
// RUN: | FileCheck -check-prefix=CHECK-M-PROFILE %s
// CHECK-M-PROFILE: "-triple" "thumbv7m-{{.*}}"

// RUN: %clang --target=arm-unknown-linuxfdpiceabi -Wa,--fdpic -c %s -### 2>&1 | FileCheck --check-prefix=FDPIC %s
// FDPIC: "--fdpic"
10 changes: 10 additions & 0 deletions clang/test/Misc/cc1as-arm-fdpic.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// REQUIRES: arm-registered-target

// RUN: %clang -cc1as -triple armv7-unknown-linuxfdpiceabi -filetype obj --fdpic %s -o %t
// RUN: llvm-readelf -h -r %t | FileCheck %s

// CHECK: OS/ABI: ARM FDPIC
// CHECK: R_ARM_FUNCDESC

.data
.word f(FUNCDESC)
4 changes: 4 additions & 0 deletions clang/tools/driver/cc1as_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ struct AssemblerInvocation {
LLVM_PREFERRED_TYPE(bool)
unsigned IncrementalLinkerCompatible : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned FDPIC : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned EmbedBitcode : 1;

/// Whether to emit DWARF unwind info.
Expand Down Expand Up @@ -346,6 +348,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
Opts.FatalWarnings = Args.hasArg(OPT_massembler_fatal_warnings);
Opts.NoWarn = Args.hasArg(OPT_massembler_no_warn);
Opts.NoTypeCheck = Args.hasArg(OPT_mno_type_check);
Opts.FDPIC = Args.hasArg(OPT_fdpic);
Opts.RelocationModel =
std::string(Args.getLastArgValue(OPT_mrelocation_model, "pic"));
Opts.TargetABI = std::string(Args.getLastArgValue(OPT_target_abi));
Expand Down Expand Up @@ -520,6 +523,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
MCOptions.MCNoWarn = Opts.NoWarn;
MCOptions.MCFatalWarnings = Opts.FatalWarnings;
MCOptions.MCNoTypeCheck = Opts.NoTypeCheck;
MCOptions.FDPIC = Opts.FDPIC;
MCOptions.ABIName = Opts.TargetABI;

// FIXME: There is a bit of code duplication with addPassesToEmitFile.
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.