From 5aab3194248335f9f642fcec7303e3a5e3d46518 Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Fri, 24 Apr 2026 10:45:55 +0200 Subject: [PATCH] import native symbols in lib.h lib.h gets included into the host module and the wasm module. For the host module the attributes will be ignored. --- scripts/Util.pm | 8 +++++--- scripts/menu.pl | 7 ++----- scripts/wasm.just | 1 - targets/lib.h | 17 +++++++++++------ 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/scripts/Util.pm b/scripts/Util.pm index e84f395..ec70100 100644 --- a/scripts/Util.pm +++ b/scripts/Util.pm @@ -198,10 +198,10 @@ sub read_experiment_info { open( my $fhandle, '<', "$local_archive_dir/$exp/0.info" ) or die "Failed to open 0.info: $!"; my $info = <$fhandle>; - chomp $info; + chomp $info if defined $info; close($fhandle); - return $info; + return defined $info ? $info : ""; } sub read_marker_info { @@ -251,7 +251,9 @@ sub select_experiment { my $info = read_experiment_info($exp); push @exp_with_notes, - defined $info ? sprintf( "%-50s (Note: %s)", $exp, $info ) : $exp; + ( defined $info && length($info) > 0 ) + ? sprintf( "%-50s (Note: %s)", $exp, $info ) + : $exp; } my @selected_experiments = diff --git a/scripts/menu.pl b/scripts/menu.pl index ca7ef42..e5ae11c 100644 --- a/scripts/menu.pl +++ b/scripts/menu.pl @@ -433,11 +433,8 @@ my %handlers = ( '98. Delete Archived Experiments' => sub { # Delete archived experiments - my @experiments = Util::find_subdirs($local_archive_dir); - my @selected_experiments = - TUI::select_from_list( "Select Archived Experiments to Delete", - 1, @experiments ); - die "No experiment selected" unless @selected_experiments; + my @selected_experiments = Util::select_experiment(1); + system( 'rm', '-rf', "$local_archive_dir/$_" ) for @selected_experiments; }, diff --git a/scripts/wasm.just b/scripts/wasm.just index b7983ce..6be71f1 100644 --- a/scripts/wasm.just +++ b/scripts/wasm.just @@ -15,7 +15,6 @@ WASI_CFLAGS := "\ -Wl,--initial-memory=65536 \ -Wl,--export=__heap_base \ -Wl,--export=__data_end \ --Wl,--allow-undefined \ " CROSS_CFLAGS_NOWASM := "\ -O0 \ diff --git a/targets/lib.h b/targets/lib.h index 2df7421..28a1ca8 100644 --- a/targets/lib.h +++ b/targets/lib.h @@ -60,12 +60,17 @@ extern "C" { #endif // Those functions are defined in the host program -void NOINLINE fail_start_trace(void); // Mark start of injection -void NOINLINE fail_stop_trace(void); // Mark end of injection -void NOINLINE fail_marker_positive(void); // Everything ok -void NOINLINE fail_marker_detected(void); // Everything ok -void NOINLINE fail_marker_negative(void); // Invalid code -void NOINLINE print(const char *msg); +void NOINLINE IMPORT("fail_start_trace") + fail_start_trace(void); // Mark start of injection +void NOINLINE IMPORT("fail_stop_trace") + fail_stop_trace(void); // Mark end of injection +void NOINLINE IMPORT("fail_marker_positive") + fail_marker_positive(void); // Everything ok +void NOINLINE IMPORT("fail_marker_detected") + fail_marker_detected(void); // Everything ok +void NOINLINE IMPORT("fail_marker_negative") + fail_marker_negative(void); // Invalid code +void NOINLINE IMPORT("print") print(const char *msg); #ifdef __cplusplus }