@@ -34,8 +34,6 @@ flags! {
3434 Common ,
3535 Hidden ,
3636 ForceActive ,
37- // Same as ForceActive, but used internally
38- ExternallyReferenced ,
3937 }
4038}
4139
@@ -74,11 +72,6 @@ impl ObjSymbolFlagSet {
7472 #[ inline]
7573 pub fn is_force_active ( & self ) -> bool { self . 0 . contains ( ObjSymbolFlags :: ForceActive ) }
7674
77- #[ inline]
78- pub fn is_externally_referenced ( & self ) -> bool {
79- self . 0 . contains ( ObjSymbolFlags :: ExternallyReferenced )
80- }
81-
8275 #[ inline]
8376 pub fn set_scope ( & mut self , scope : ObjSymbolScope ) {
8477 match scope {
@@ -101,11 +94,11 @@ impl ObjSymbolFlagSet {
10194 }
10295
10396 #[ inline]
104- pub fn set_externally_referenced ( & mut self , value : bool ) {
97+ pub fn set_force_active ( & mut self , value : bool ) {
10598 if value {
106- self . 0 |= ObjSymbolFlags :: ExternallyReferenced ;
99+ self . 0 |= ObjSymbolFlags :: ForceActive ;
107100 } else {
108- self . 0 &= !ObjSymbolFlags :: ExternallyReferenced ;
101+ self . 0 &= !ObjSymbolFlags :: ForceActive ;
109102 }
110103 }
111104}
@@ -562,8 +555,9 @@ impl ObjSymbols {
562555 Ok ( result)
563556 }
564557
565- pub fn set_externally_referenced ( & mut self , idx : SymbolIndex , value : bool ) {
566- self . symbols [ idx] . flags . set_externally_referenced ( value) ;
558+ #[ inline]
559+ pub fn flags ( & mut self , idx : SymbolIndex ) -> & mut ObjSymbolFlagSet {
560+ & mut self . symbols [ idx] . flags
567561 }
568562}
569563
@@ -629,6 +623,18 @@ impl ObjInfo {
629623
630624 pub fn section_data ( & self , start : u32 , end : u32 ) -> Result < ( & ObjSection , & [ u8 ] ) > {
631625 let section = self . section_at ( start) ?;
626+ ensure ! (
627+ section. contains_range( start..end) ,
628+ "Range {:#010X}-{:#010X} outside of section {}: {:#010X}-{:#010X}" ,
629+ start,
630+ end,
631+ section. name,
632+ section. address,
633+ section. address + section. size
634+ ) ;
635+ if section. kind == ObjSectionKind :: Bss {
636+ return Ok ( ( section, & [ ] ) ) ;
637+ }
632638 let data = if end == 0 {
633639 & section. data [ ( start as u64 - section. address ) as usize ..]
634640 } else {
0 commit comments