Skip to content

Commit e62c26e

Browse files
committed
On ARM, use relocation_model to detect whether r9 should be reserved
The previous approach of checking for the reserve-r9 target feature didn't actually work because LLVM only sets this feature very late when initializing the per-function subtarget.
1 parent 7e80bc3 commit e62c26e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/inline_asm.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,12 @@ struct InlineAssemblyGenerator<'a, 'tcx> {
182182
impl<'tcx> InlineAssemblyGenerator<'_, 'tcx> {
183183
fn allocate_registers(&mut self) {
184184
let sess = self.tcx.sess;
185-
let map = allocatable_registers(self.arch, &sess.target_features, &sess.target);
185+
let map = allocatable_registers(
186+
self.arch,
187+
sess.relocation_model(),
188+
&sess.target_features,
189+
&sess.target,
190+
);
186191
let mut allocated = FxHashMap::<_, (bool, bool)>::default();
187192
let mut regs = vec![None; self.operands.len()];
188193

@@ -315,6 +320,7 @@ impl<'tcx> InlineAssemblyGenerator<'_, 'tcx> {
315320
// Allocate stack slots for saving clobbered registers
316321
let abi_clobber = InlineAsmClobberAbi::parse(
317322
self.arch,
323+
self.tcx.sess.relocation_model(),
318324
&self.tcx.sess.target_features,
319325
&self.tcx.sess.target,
320326
sym::C,

0 commit comments

Comments
 (0)