Преглед изворни кода

use BTreeMap for dynamic symbol

bidhan-a пре 1 месец
родитељ
комит
a8d3163fcc
2 измењених фајлова са 7 додато и 7 уклоњено
  1. 6 6
      crates/assembler/src/dynsym.rs
  2. 1 1
      crates/assembler/tests/fixtures/index.toml

+ 6 - 6
crates/assembler/src/dynsym.rs

@@ -1,4 +1,4 @@
-use std::collections::HashMap;
+use std::collections::BTreeMap;
 
 #[derive(Debug)]
 pub struct DynamicSymbol {
@@ -41,13 +41,13 @@ pub enum SymbolKind {
 
 #[derive(Debug)]
 pub struct DynamicSymbolMap {
-    symbols: HashMap<String, Vec<(SymbolKind, u64)>>,
+    symbols: BTreeMap<String, Vec<(SymbolKind, u64)>>,
 }
 
 impl DynamicSymbolMap {
     pub fn new() -> Self {
         Self {
-            symbols: HashMap::new(),
+            symbols: BTreeMap::new(),
         }
     }
 
@@ -91,7 +91,7 @@ impl DynamicSymbolMap {
         self.symbols.get(name)
     }
 
-    pub fn get_symbols(&self) -> &HashMap<String, Vec<(SymbolKind, u64)>> {
+    pub fn get_symbols(&self) -> &BTreeMap<String, Vec<(SymbolKind, u64)>> {
         &self.symbols
     }
 }
@@ -135,12 +135,12 @@ impl RelDyn {
 
 #[derive(Debug)]
 pub struct RelDynMap {
-    rel_dyns: HashMap<u64, Vec<(RelocationType, String)>>,
+    rel_dyns: BTreeMap<u64, Vec<(RelocationType, String)>>,
 }
 
 impl RelDynMap {
     pub fn new() -> Self {
-        Self { rel_dyns: HashMap::new() }
+        Self { rel_dyns: BTreeMap::new() }
     }
 
     pub fn add_rel_dyn(&mut self, offset: u64, rel_type: RelocationType, name: String) {

+ 1 - 1
crates/assembler/tests/fixtures/index.toml

@@ -15,5 +15,5 @@ runs = 10
 
 [cases.rodata]
 file = "rodata.s"
-hash = "518f8ea95a4b2a2c0e18c27b90540355996e53844dcc3c6321348fadd94fc7c1"
+hash = "b5bf26be95f734324c4aeb29ec94ac6456e051ad931f6167a391f64fde9a0647"
 runs = 10