Skip to content

Commit 2c408c8

Browse files
committed
Look for HIFFY_FUNCTIONS in both variables and definitions
1 parent 5cb6122 commit 2c408c8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

humility-hiffy/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,16 @@ impl<'a> HiffyContext<'a> {
184184
}
185185

186186
fn definition(hubris: &'a HubrisArchive, name: &str) -> Result<HubrisGoff> {
187+
// Depending on compiler version, definitions may be in either
188+
// `self.definitions` or `self.variables`, so we'll check in both
189+
// places. Behavior depends on whether the linker included a symbol for
190+
// an otherwise-unused variable marked as `#[used]`; this changed in
191+
// rust-lang/rust#140872
192+
//
193+
// See hubris#2169 for more details
187194
let goff = hubris
188195
.lookup_definition(name)
196+
.or_else(|_| hubris.lookup_variable(name).map(|v| &v.goff))
189197
.context("expected hiffy definition not found")?;
190198

191199
Ok(*goff)

0 commit comments

Comments
 (0)