From 3fd37fe3f0e4867ac9ab86d641c1264834fdfe6e Mon Sep 17 00:00:00 2001 From: Daniel Cumming <124537596+dkcumming@users.noreply.github.com> Date: Mon, 28 Oct 2024 21:03:30 +0000 Subject: [PATCH 1/2] HOTFIX: use `SEP` variable for `LD_LIBRARY_PATH` modification in run script (#11) Removes erroneous ":" from `:D_LIBRARY_PATH` Co-authored-by: Jost Berthold --- run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 2287466..f83fd3d 100755 --- a/run.sh +++ b/run.sh @@ -8,7 +8,7 @@ STAGE=$(cat "${RUST_DIR}/stage") RUST_BUILD_DIR=${RUST_DIR}/src/build/${ARCH} SEP="" [ -n "${LD_LIBRARY_PATH:-}" ] && SEP=":" -export LD_LIBRARY_PATH="${RUST_BUILD_DIR}/stage${STAGE}/lib/rustlib/x86_64-unknown-linux-gnu/lib:$SEP${LD_LIBRARY_PATH:-}" +export LD_LIBRARY_PATH="${RUST_BUILD_DIR}/stage${STAGE}/lib/rustlib/x86_64-unknown-linux-gnu/lib$SEP${LD_LIBRARY_PATH:-}" if [ -x "$SCRIPT_DIR/target/debug/$BIN" ]; then "$SCRIPT_DIR/target/debug/$BIN" "$@" elif [ -x "$SCRIPT_DIR/target/release/$BIN" ]; then From 1e4c40c3e07d0eb0f9dcf52d2ee5b8159a32b641 Mon Sep 17 00:00:00 2001 From: Daniel Cumming <124537596+dkcumming@users.noreply.github.com> Date: Tue, 29 Oct 2024 21:07:13 +0000 Subject: [PATCH 2/2] Weakened guard for logging in `update_link_map` (#15) Now we always check for collisions in `update_link_map` so long as debug logging is enabled --- src/printer.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/printer.rs b/src/printer.rs index 4352d02..45a72c8 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -362,21 +362,21 @@ struct LinkNameCollector<'tcx, 'local> { locals: &'local [LocalDecl], } -fn update_link_map<'tcx>(link_map: &mut LinkMap<'tcx>, fn_sym: Option>, source: ItemSource, check_collision: bool) { +fn update_link_map<'tcx>(link_map: &mut LinkMap<'tcx>, fn_sym: Option>, source: ItemSource) { if fn_sym.is_none() { return } let (ty, kind, name) = fn_sym.unwrap(); let new_val = (source, name); let key = if link_instance_enabled() { LinkMapKey(ty, Some(kind)) } else { LinkMapKey(ty, None) }; if let Some(curr_val) = link_map.get_mut(&key.clone()) { if curr_val.1 != new_val.1 { - panic!("Checking collisions: {}, Added inconsistent entries into link map! {:?} -> {:?}, {:?}", check_collision, (ty, ty.kind().fn_def(), &kind), curr_val.1, new_val.1); + panic!("Added inconsistent entries into link map! {:?} -> {:?}, {:?}", (ty, ty.kind().fn_def(), &kind), curr_val.1, new_val.1); } curr_val.0.0 |= new_val.0.0; - if check_collision && debug_enabled() { + if debug_enabled() { println!("Regenerated link map entry: {:?}:{:?} -> {:?}", &key, key.0.kind().fn_def(), new_val); } } else { - if check_collision && debug_enabled() { + if debug_enabled() { println!("Generated link map entry from call: {:?}:{:?} -> {:?}", &key, key.0.kind().fn_def(), new_val); } link_map.insert(key.clone(), new_val); @@ -400,7 +400,7 @@ impl MirVisitor for LinkNameCollector<'_, '_> { } _ => None }; - update_link_map(self.link_map, fn_sym, ItemSource(TERM), true); + update_link_map(self.link_map, fn_sym, ItemSource(TERM)); self.super_terminator(term, loc); } @@ -410,7 +410,7 @@ impl MirVisitor for LinkNameCollector<'_, '_> { Rvalue::Cast(CastKind::PointerCoercion(PointerCoercion::ReifyFnPointer), ref op, _) => { let inst = fn_inst_for_ty(op.ty(self.locals).unwrap(), false).expect("ReifyFnPointer Cast operand type does not resolve to an instance"); let fn_sym = fn_inst_sym(self.tcx, None, Some(&inst)); - update_link_map(self.link_map, fn_sym, ItemSource(FPTR), true); + update_link_map(self.link_map, fn_sym, ItemSource(FPTR)); } _ => {} }; @@ -423,7 +423,7 @@ fn collect_fn_calls<'tcx,'local>(tcx: TyCtxt<'tcx>, items: Vec<&'local MonoItem> if link_items_enabled() { for item in items.iter() { if let MonoItem::Fn ( inst ) = item { - update_link_map(&mut hash_map, fn_inst_sym(tcx, None, Some(inst)), ItemSource(ITEM), false) + update_link_map(&mut hash_map, fn_inst_sym(tcx, None, Some(inst)), ItemSource(ITEM)) } } }