aboutsummaryrefslogtreecommitdiffstats
path: root/debug/Dwarfgen.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-10-06 11:08:58 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2015-10-06 11:08:58 +0200
commit55eb2d92376f592258855cfa5c0cfbbf39e8e833 (patch)
tree33ef79b3c21e3737202469cc6fb0bda064dd1146 /debug/Dwarfgen.ml
parent7c8693320818d00b26b4c36c2a01a5fe67c0c71b (diff)
downloadcompcert-kvx-55eb2d92376f592258855cfa5c0cfbbf39e8e833.tar.gz
compcert-kvx-55eb2d92376f592258855cfa5c0cfbbf39e8e833.zip
Fast fix for functions in different sections in one compilation unit for gcc.
Diffstat (limited to 'debug/Dwarfgen.ml')
-rw-r--r--debug/Dwarfgen.ml12
1 files changed, 8 insertions, 4 deletions
diff --git a/debug/Dwarfgen.ml b/debug/Dwarfgen.ml
index 2258f948..eff80110 100644
--- a/debug/Dwarfgen.ml
+++ b/debug/Dwarfgen.ml
@@ -463,7 +463,7 @@ let gen_diab_debug_info sec_name var_section : debug_entries =
} in
let cp = new_entry (next_id ()) (DW_TAG_compile_unit cp) in
let cp = add_children cp ((gen_types (diab_file_loc s) ty) @ defs) in
- (s,debug_start,line_start,cp,(low_pc,locs))::acc) defs [] in
+ (s,debug_start,line_start,cp,(Some low_pc,locs))::acc) defs [] in
Diab entries
let gnu_file_loc (f,l) =
@@ -472,9 +472,12 @@ let gnu_file_loc (f,l) =
let gen_gnu_debug_info sec_name var_section : debug_entries =
let low_pc = Hashtbl.find compilation_section_start ".text"
and high_pc = Hashtbl.find compilation_section_end ".text" in
- let defs,(ty,locs) = Hashtbl.fold (fun id t (acc,bcc) ->
+ let defs,(ty,locs),sec = Hashtbl.fold (fun id t (acc,bcc,sec) ->
+ let s = match t with
+ | GlobalVariable _ -> var_section
+ | Function f -> sec_name (get_opt_val f.fun_atom) in
let t,bcc = definition_to_entry gnu_file_loc bcc id t in
- t::acc,bcc) definitions ([],(IntSet.empty,[])) in
+ t::acc,bcc,StringSet.add s sec) definitions ([],(IntSet.empty,[]),StringSet.empty) in
let types = gen_types gnu_file_loc ty in
let cp = {
compile_unit_name = !file_name;
@@ -483,4 +486,5 @@ let gen_gnu_debug_info sec_name var_section : debug_entries =
} in
let cp = new_entry (next_id ()) (DW_TAG_compile_unit cp) in
let cp = add_children cp (types@defs) in
- Gnu (cp,(low_pc,locs))
+ let loc_pc = if StringSet.cardinal sec > 1 then None else Some low_pc in
+ Gnu (cp,(loc_pc,locs))