diff --git a/CodeHawk/CH/chutil/cHUtil.ml b/CodeHawk/CH/chutil/cHUtil.ml index ee96df4b..4668eefc 100644 --- a/CodeHawk/CH/chutil/cHUtil.ml +++ b/CodeHawk/CH/chutil/cHUtil.ml @@ -6,7 +6,7 @@ Copyright (c) 2005-2020 Kestrel Technology LLC Copyright (c) 2020 Henny B. Sipma - Copyright (c) 2021-2024 Aarno Labs LLC + Copyright (c) 2021-2025 Aarno Labs LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -91,6 +91,15 @@ let has_control_characters (s: string): bool = !found +let startswith (s: string) (substr: string): bool = + let lens = String.length s in + let lensub = String.length substr in + if lens < lensub then + false + else + (String.sub s 0 lensub) = substr + + let hex_string (s: string): string = let ch = IO.input_string s in let h = ref "" in diff --git a/CodeHawk/CH/chutil/cHUtil.mli b/CodeHawk/CH/chutil/cHUtil.mli index 06092a2d..cd7f02c2 100644 --- a/CodeHawk/CH/chutil/cHUtil.mli +++ b/CodeHawk/CH/chutil/cHUtil.mli @@ -6,7 +6,7 @@ Copyright (c) 2005-2020 Kestrel Technology LLC Copyright (c) 2020 Henny B. Sipma - Copyright (c) 2021-2024 Aarno Labs LLC + Copyright (c) 2021-2025 Aarno Labs LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -38,6 +38,8 @@ val string_nsplit: char -> string -> string list val has_control_characters: string -> bool +val startswith: string -> string -> bool + val byte_to_string: int -> string val value_from_byte: int -> int diff --git a/CodeHawk/CHB/bchlib/bCHBCFiles.ml b/CodeHawk/CHB/bchlib/bCHBCFiles.ml index f2e60711..feeb1203 100644 --- a/CodeHawk/CHB/bchlib/bCHBCFiles.ml +++ b/CodeHawk/CHB/bchlib/bCHBCFiles.ml @@ -93,8 +93,14 @@ object (self) | GEnumTagDecl (einfo, loc) -> H.replace genumtagdecls einfo.bename (bcd#index_enuminfo einfo, i loc) | GVarDecl (vinfo, loc) -> - let _ = chlog#add "bcfiles:add gvardecl" (STR vinfo.bvname) in - H.replace gvardecls vinfo.bvname (bcd#index_varinfo vinfo, i loc) + if (CHUtil.startswith vinfo.bvname "__builtin_" + || CHUtil.startswith vinfo.bvname "__atomic_" + || CHUtil.startswith vinfo.bvname "__sync_") + then + () + else + let _ = chlog#add "bcfiles:add gvardecl" (STR vinfo.bvname) in + H.replace gvardecls vinfo.bvname (bcd#index_varinfo vinfo, i loc) | GVar (vinfo, iinfo, loc) -> let _ = chlog#add "bcfiles:add gvar" (STR vinfo.bvname) in H.replace gvars diff --git a/CodeHawk/CHB/bchlibarm32/bCHFnARMDictionary.ml b/CodeHawk/CHB/bchlibarm32/bCHFnARMDictionary.ml index 115b3a1d..5eb48a80 100644 --- a/CodeHawk/CHB/bchlibarm32/bCHFnARMDictionary.ml +++ b/CodeHawk/CHB/bchlibarm32/bCHFnARMDictionary.ml @@ -2756,6 +2756,8 @@ object (self) let vmem2_r = mem2#to_variable floc in let xaddr1_r = mem#to_address floc in let xaddr2_r = mem2#to_address floc in + let xaddr1_r = TR.tmap rewrite_expr xaddr1_r in + let xaddr2_r = TR.tmap rewrite_expr xaddr2_r in let xrt_r = rt#to_expr floc in let xxrt_r = TR.tmap rewrite_expr xrt_r in let xrt2_r = rt2#to_expr floc in