[llvm] [Mips][nanoMIPS] Add initial nanoMIPS target support (PR #223032)
Jiaxun Yang via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 17 03:07:14 PDT 2026
================
@@ -996,21 +1003,27 @@ void MipsTargetELFStreamer::finish() {
} else if (Features[Mips::FeatureMips64r2] || Features[Mips::FeatureMips64])
EFlags |= ELF::EF_MIPS_32BITMODE;
- // -mplt is not implemented but we should act as if it was
- // given.
- if (!Features[Mips::FeatureNoABICalls])
- EFlags |= ELF::EF_MIPS_CPIC;
-
- if (Pic)
- EFlags |= ELF::EF_MIPS_PIC | ELF::EF_MIPS_CPIC;
+ if (!isNanoMipsEnabled()) {
+ // -mplt is not implemented but we should act as if it was
+ // given.
+ if (!Features[Mips::FeatureNoABICalls])
+ EFlags |= ELF::EF_MIPS_CPIC;
+ if (Pic)
+ EFlags |= ELF::EF_MIPS_PIC | ELF::EF_MIPS_CPIC;
+ } else {
+ if (Pic)
+ EFlags |= ELF::EF_NANOMIPS_PIC;
+ }
W.setELFHeaderEFlags(EFlags);
- // Emit all the option records.
- // At the moment we are only emitting .Mips.options (ODK_REGINFO) and
- // .reginfo.
- MipsELFStreamer &MEF = static_cast<MipsELFStreamer &>(Streamer);
- MEF.EmitMipsOptionRecords();
+ if (!isNanoMipsEnabled()) {
+ // Emit all the option records.
+ // At the moment we are only emitting .Mips.options (ODK_REGINFO) and
+ // .reginfo.
+ MipsELFStreamer &MEF = static_cast<MipsELFStreamer &>(Streamer);
+ MEF.EmitMipsOptionRecords();
----------------
FlyGoat wrote:
nanoMIPS has `.option` section as well, are you planning to use the same emitter?
https://github.com/llvm/llvm-project/pull/223032
More information about the llvm-commits
mailing list