diff options
author | Fangrui Song <i@maskray.me> | 2024-07-03 13:45:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-03 13:45:48 -0700 |
commit | 04a1a3482ce3ee00b5bbec1ce852e58410e4b6ad (patch) | |
tree | 343a0400ddfa195a4c301821e0d8f3c8f19ca66d /clang/tools | |
parent | b5864988b3230324f5426036f45aab43d20a5b94 (diff) | |
download | llvm-04a1a3482ce3ee00b5bbec1ce852e58410e4b6ad.zip llvm-04a1a3482ce3ee00b5bbec1ce852e58410e4b6ad.tar.gz llvm-04a1a3482ce3ee00b5bbec1ce852e58410e4b6ad.tar.bz2 |
[Driver] Add -Wa, options --crel and --allow-experimental-crel
The two options are discussed in a few comments around
https://github.com/llvm/llvm-project/pull/91280#issuecomment-2099344079
* -Wa,--crel: error "-Wa,--allow-experimental-crel must be specified to use -Wa,--crel..."
* -Wa,--allow-experimental-crel: no-op
* -Wa,--crel,--allow-experimental-crel: enable CREL in the integrated assembler (#91280)
MIPS's little-endian n64 ABI messed up the `r_info` field in
relocations. While this could be fixed with CREL, my intention is to
avoid complication in assembler/linker. The implementation simply
doesn't allow CREL for MIPS.
Link: https://discourse.llvm.org/t/rfc-crel-a-compact-relocation-format-for-elf/77600
Pull Request: https://github.com/llvm/llvm-project/pull/97378
Diffstat (limited to 'clang/tools')
-rw-r--r-- | clang/tools/driver/cc1as_main.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp index ce1e181..4e0aa14 100644 --- a/clang/tools/driver/cc1as_main.cpp +++ b/clang/tools/driver/cc1as_main.cpp @@ -164,6 +164,9 @@ struct AssemblerInvocation { LLVM_PREFERRED_TYPE(bool) unsigned EmitCompactUnwindNonCanonical : 1; + LLVM_PREFERRED_TYPE(bool) + unsigned Crel : 1; + /// The name of the relocation model to use. std::string RelocationModel; @@ -204,6 +207,7 @@ public: EmbedBitcode = 0; EmitDwarfUnwind = EmitDwarfUnwindType::Default; EmitCompactUnwindNonCanonical = false; + Crel = false; } static bool CreateFromArgs(AssemblerInvocation &Res, @@ -373,6 +377,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, Opts.EmitCompactUnwindNonCanonical = Args.hasArg(OPT_femit_compact_unwind_non_canonical); + Opts.Crel = Args.hasArg(OPT_crel); Opts.AsSecureLogFile = Args.getLastArgValue(OPT_as_secure_log_file); @@ -430,6 +435,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts, MCOptions.EmitDwarfUnwind = Opts.EmitDwarfUnwind; MCOptions.EmitCompactUnwindNonCanonical = Opts.EmitCompactUnwindNonCanonical; MCOptions.MCSaveTempLabels = Opts.SaveTemporaryLabels; + MCOptions.Crel = Opts.Crel; MCOptions.X86RelaxRelocations = Opts.RelaxELFRelocations; MCOptions.CompressDebugSections = Opts.CompressDebugSections; MCOptions.AsSecureLogFile = Opts.AsSecureLogFile; |