Skip to content

Commit 9f3d4c6

Browse files
committed
properly push and pop on riscv and mips
1 parent 792bd9c commit 9f3d4c6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

compiler/rustc_codegen_ssa/src/mir/naked_asm.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -194,21 +194,23 @@ fn enable_disable_target_features<'tcx>(
194194
Architecture::Riscv32 | Architecture::Riscv64 => {
195195
// https://github.com/riscv-non-isa/riscv-asm-manual/blob/ad0de8c004e29c9a7ac33cfd054f4d4f9392f2fb/src/asm-manual.adoc#arch
196196

197+
writeln!(begin, ".option push").unwrap();
197198
for feature in features {
198199
writeln!(begin, ".option arch, +{}", feature.name).unwrap();
199-
200-
writeln!(end, ".option arch, -{}", feature.name).unwrap();
201200
}
201+
202+
writeln!(end, ".option pop").unwrap();
202203
}
203204
Architecture::Mips | Architecture::Mips64 | Architecture::Mips64_N32 => {
204205
// https://sourceware.org/binutils/docs/as/MIPS-ISA.html
205206
// https://sourceware.org/binutils/docs/as/MIPS-ASE-Instruction-Generation-Overrides.html
206207

208+
writeln!(begin, ".set push").unwrap();
207209
for feature in features {
208210
writeln!(begin, ".set {}", feature.name).unwrap();
209-
210-
writeln!(end, ".set no{}", feature.name).unwrap();
211211
}
212+
213+
writeln!(end, ".set pop").unwrap();
212214
}
213215

214216
Architecture::S390x => {

0 commit comments

Comments
 (0)