Skip to content

Commit

Permalink
Allow @ symbols in decorated C names
Browse files Browse the repository at this point in the history
@__security_check_cookie@4 is a perfectly fine symbol name. It is the
__fastcall calling convention.

Confer: https://learn.microsoft.com/en-us/cpp/build/reference/decorated-names?view=msvc-170#FormatC
  • Loading branch information
Jonah Beckford committed Oct 5, 2024
1 parent 19aadf0 commit 387e4b8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion reloc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,11 @@ let drop_underscore obj s =
assert (s <> "");
begin
match s.[0] with
(* https://learn.microsoft.com/en-us/cpp/build/reference/decorated-names?view=msvc-170#FormatC *)
| '_' -> String.sub s 1 (String.length s - 1)
| '?' -> s
| _ -> failwith (Printf.sprintf "In %s, symbol %s doesn't start with _ or ?" obj.obj_name s)
| '@' -> s
| _ -> failwith (Printf.sprintf "In %s, symbol %s doesn't start with _, ?, or @" obj.obj_name s)
end
| `x64 ->
s
Expand Down

0 comments on commit 387e4b8

Please sign in to comment.