@@ -321,10 +321,11 @@ let res32 i n = emit_subreg reg_low_32_name DWORD i.res.(n)
321
321
322
322
let addressing addr typ i n =
323
323
match addr with
324
- | Ibased(s, glob, ofs) ->
325
- add_used_symbol s;
326
- let s : Cmm.symbol = { sym_name = s; sym_global = if glob then Global else Local } in
327
- mem64_rip typ (emit_cmm_symbol s) ~ofs
324
+ | Ibased(sym_name, sym_global, ofs) ->
325
+ add_used_symbol sym_name;
326
+ let sym_global : Cmm.is_global =
327
+ match sym_global with Global -> Global | Local -> Local in
328
+ mem64_rip typ (emit_cmm_symbol { sym_name ; sym_global }) ~ofs
328
329
| Iindexed d ->
329
330
mem64 typ d (arg64 i n)
330
331
| Iindexed2 d ->
@@ -1249,7 +1250,7 @@ let emit_instr fallthrough i =
1249
1250
to control ocaml probe handlers independently from stap probe handlers.
1250
1251
It is placed immediately after stap semaphore, and is the same
1251
1252
size - hence offset 2. *)
1252
- I.mov (addressing (Ibased(semaphore_sym, true , 2)) WORD i 0) (res16 i 0);
1253
+ I.mov (addressing (Ibased(semaphore_sym, Global , 2)) WORD i 0) (res16 i 0);
1253
1254
(* If the semaphore is 0, then the result is 0, otherwise 1. *)
1254
1255
I.cmp (int 0) (res16 i 0);
1255
1256
I.set (cond (Iunsigned Cne)) (res8 i 0);
@@ -1399,6 +1400,9 @@ let fundecl fundecl =
1399
1400
D.private_extern (emit_symbol fundecl.fun_name)
1400
1401
else
1401
1402
D.global (emit_symbol fundecl.fun_name);
1403
+ (* Even if the function name is Local, still emit an
1404
+ actual linker symbol for it. This provides symbols
1405
+ for perf, gdb, and similar tools *)
1402
1406
D.label (emit_symbol fundecl.fun_name);
1403
1407
D.label (label_name (emit_symbol fundecl.fun_name));
1404
1408
emit_debug_info fundecl.fun_dbg;
0 commit comments