@@ -42,24 +42,21 @@ impl WriteMetadata for faerie::Artifact {
42
42
}
43
43
44
44
impl WriteMetadata for object:: write:: Object {
45
- fn add_rustc_section ( & mut self , symbol_name : String , data : Vec < u8 > , is_like_osx : bool ) {
45
+ fn add_rustc_section ( & mut self , symbol_name : String , data : Vec < u8 > , _is_like_osx : bool ) {
46
46
let segment = self . segment_name ( object:: write:: StandardSegment :: Data ) . to_vec ( ) ;
47
47
let section_id = self . add_section ( segment, b".rustc" . to_vec ( ) , object:: SectionKind :: Data ) ;
48
48
let offset = self . append_section_data ( section_id, & data, 1 ) ;
49
- // FIXME implement faerie elf backend section custom symbols
50
- // For MachO this is necessary to prevent the linker from throwing away the .rustc section,
51
- // but for ELF it isn't.
52
- if is_like_osx {
53
- self . add_symbol ( object:: write:: Symbol {
54
- name : symbol_name. into_bytes ( ) ,
55
- value : offset,
56
- size : data. len ( ) as u64 ,
57
- kind : object:: SymbolKind :: Data ,
58
- scope : object:: SymbolScope :: Compilation ,
59
- weak : false ,
60
- section : Some ( section_id) ,
61
- } ) ;
62
- }
49
+ // For MachO and probably PE this is necessary to prevent the linker from throwing away the
50
+ // .rustc section. For ELF this isn't necessary, but it also doesn't harm.
51
+ self . add_symbol ( object:: write:: Symbol {
52
+ name : symbol_name. into_bytes ( ) ,
53
+ value : offset,
54
+ size : data. len ( ) as u64 ,
55
+ kind : object:: SymbolKind :: Data ,
56
+ scope : object:: SymbolScope :: Compilation ,
57
+ weak : false ,
58
+ section : Some ( section_id) ,
59
+ } ) ;
63
60
}
64
61
}
65
62
@@ -70,7 +67,7 @@ pub trait WriteDebugInfo {
70
67
fn add_debug_reloc (
71
68
& mut self ,
72
69
section_map : & HashMap < SectionId , Self :: SectionId > ,
73
- symbol_map : & indexmap:: IndexSet < ( String , FuncId ) > ,
70
+ symbol_map : & indexmap:: IndexMap < FuncId , String > ,
74
71
from : & Self :: SectionId ,
75
72
reloc : & DebugReloc ,
76
73
) ;
@@ -87,7 +84,7 @@ impl WriteDebugInfo for FaerieProduct {
87
84
fn add_debug_reloc (
88
85
& mut self ,
89
86
_section_map : & HashMap < SectionId , Self :: SectionId > ,
90
- symbol_map : & indexmap:: IndexSet < ( String , FuncId ) > ,
87
+ symbol_map : & indexmap:: IndexMap < FuncId , String > ,
91
88
from : & Self :: SectionId ,
92
89
reloc : & DebugReloc ,
93
90
) {
@@ -98,7 +95,7 @@ impl WriteDebugInfo for FaerieProduct {
98
95
from : from. name ( ) ,
99
96
to : match reloc. name {
100
97
DebugRelocName :: Section ( id) => id. name ( ) ,
101
- DebugRelocName :: Symbol ( index) => & symbol_map. get_index ( index) . unwrap ( ) . 0 ,
98
+ DebugRelocName :: Symbol ( index) => & symbol_map. get_index ( index) . unwrap ( ) . 1 ,
102
99
} ,
103
100
at : u64:: from ( reloc. offset ) ,
104
101
} ,
@@ -130,15 +127,14 @@ impl WriteDebugInfo for ObjectProduct {
130
127
fn add_debug_reloc (
131
128
& mut self ,
132
129
section_map : & HashMap < SectionId , Self :: SectionId > ,
133
- symbol_map : & indexmap:: IndexSet < ( String , FuncId ) > ,
130
+ symbol_map : & indexmap:: IndexMap < FuncId , String > ,
134
131
from : & Self :: SectionId ,
135
132
reloc : & DebugReloc ,
136
133
) {
137
134
let symbol = match reloc. name {
138
135
DebugRelocName :: Section ( id) => section_map. get ( & id) . unwrap ( ) . 1 ,
139
136
DebugRelocName :: Symbol ( id) => {
140
- let ( _func_name, func_id) = symbol_map. get_index ( id) . unwrap ( ) ;
141
- self . function_symbol ( * func_id)
137
+ self . function_symbol ( * symbol_map. get_index ( id) . unwrap ( ) . 0 )
142
138
}
143
139
} ;
144
140
self . object . add_relocation ( from. 0 , Relocation {
0 commit comments