@@ -2914,16 +2914,30 @@ def update_bytecode_in_proof_script(filepath, bytecode):
29142914 update_file (filepath , updated_content )
29152915
29162916
2917- def update_hol_light_bytecode ():
2918- """Update HOL Light proof files with bytecode from make dump_bytecode."""
2917+ def update_hol_light_bytecode_for_arch (arch , force_cross = False ):
29192918 status_update (
2920- "HOL Light bytecode" ,
2921- "Running make dump_bytecode ... (this may take a few minutes)" ,
2919+ f "HOL Light bytecode ( { arch } ) " ,
2920+ f "Running make dump_bytecode ( { arch } ) ... (this may take a few minutes)" ,
29222921 )
29232922
2923+ source_arch = arch
2924+ if platform .machine ().lower () in ["arm64" , "aarch64" ]:
2925+ native_arch = "aarch64"
2926+ else :
2927+ native_arch = "x86_64"
2928+
2929+ if native_arch != source_arch :
2930+ cross_prefix = f"{ source_arch } -unknown-linux-gnu-"
2931+ cross_gcc = cross_prefix + "gcc"
2932+ # Check if cross-compiler is present
2933+ if shutil .which (cross_gcc ) is None :
2934+ if force_cross is False :
2935+ return
2936+ raise Exception (f"Could not find cross toolchain { cross_prefix } " )
2937+
29242938 # Run make to get bytecode output
29252939 result = subprocess .run (
2926- ["make" , "-C" , "proofs/hol_light/x86_64" , "dump_bytecode" ],
2940+ ["make" , "-C" , "proofs/hol_light/" + arch , "dump_bytecode" ],
29272941 capture_output = True ,
29282942 text = True ,
29292943 check = True ,
@@ -2935,10 +2949,17 @@ def update_hol_light_bytecode():
29352949
29362950 # Update each .ml file
29372951 for obj_name , bytecode in bytecode_dict .items ():
2938- ml_file = "proofs/hol_light/x86_64 /proofs/" + obj_name + ".ml"
2952+ ml_file = "proofs/hol_light/" + arch + " /proofs/" + obj_name + ".ml"
29392953 update_bytecode_in_proof_script (ml_file , bytecode )
29402954
29412955
2956+ def update_hol_light_bytecode (force_cross = False ):
2957+ """Update HOL Light proof files with bytecode from make dump_bytecode."""
2958+ # NOTE: The following line is commented out until there are hol_light aarch64 proofs.
2959+ # update_hol_light_bytecode_for_arch("aarch64", force_cross=force_cross)
2960+ update_hol_light_bytecode_for_arch ("x86_64" , force_cross = force_cross )
2961+
2962+
29422963def gen_test_config (config_path , config_spec , default_config_content ):
29432964 """Generate a config file by modifying the default config."""
29442965 status_update ("test configs" , config_path )
@@ -3164,7 +3185,7 @@ def _main():
31643185 high_level_status ("Completed final backend synchronization" )
31653186
31663187 if args .update_hol_light_bytecode :
3167- update_hol_light_bytecode ()
3188+ update_hol_light_bytecode (args . force_cross )
31683189 high_level_status ("Updated HOL Light bytecode" )
31693190
31703191 gen_monolithic_source_file ()
0 commit comments