@@ -10,7 +10,7 @@ use crate::prelude::*;
1010use rustc_index:: vec:: IndexVec ;
1111
1212use cranelift_codegen:: entity:: EntityRef ;
13- use cranelift_codegen:: ir:: { LabelValueLoc , ValueLabel } ;
13+ use cranelift_codegen:: ir:: { Endianness , LabelValueLoc , ValueLabel } ;
1414use cranelift_codegen:: isa:: TargetIsa ;
1515use cranelift_codegen:: ValueLocRange ;
1616
@@ -23,15 +23,6 @@ use gimli::{Encoding, Format, LineEncoding, RunTimeEndian, X86_64};
2323pub ( crate ) use emit:: { DebugReloc , DebugRelocName } ;
2424pub ( crate ) use unwind:: UnwindContext ;
2525
26- fn target_endian ( tcx : TyCtxt < ' _ > ) -> RunTimeEndian {
27- use rustc_target:: abi:: Endian ;
28-
29- match tcx. data_layout . endian {
30- Endian :: Big => RunTimeEndian :: Big ,
31- Endian :: Little => RunTimeEndian :: Little ,
32- }
33- }
34-
3526pub ( crate ) struct DebugContext < ' tcx > {
3627 tcx : TyCtxt < ' tcx > ,
3728
@@ -60,6 +51,11 @@ impl<'tcx> DebugContext<'tcx> {
6051 address_size : isa. frontend_config ( ) . pointer_bytes ( ) ,
6152 } ;
6253
54+ let endian = match isa. endianness ( ) {
55+ Endianness :: Little => RunTimeEndian :: Little ,
56+ Endianness :: Big => RunTimeEndian :: Big ,
57+ } ;
58+
6359 let mut dwarf = DwarfUnit :: new ( encoding) ;
6460
6561 let producer = format ! (
@@ -108,7 +104,7 @@ impl<'tcx> DebugContext<'tcx> {
108104 DebugContext {
109105 tcx,
110106
111- endian : target_endian ( tcx ) ,
107+ endian,
112108
113109 dwarf,
114110 unit_range_list : RangeList ( Vec :: new ( ) ) ,
0 commit comments