aboutsummaryrefslogtreecommitdiffstats
path: root/powerpc/TargetPrinter.ml
diff options
context:
space:
mode:
Diffstat (limited to 'powerpc/TargetPrinter.ml')
-rw-r--r--powerpc/TargetPrinter.ml71
1 files changed, 65 insertions, 6 deletions
diff --git a/powerpc/TargetPrinter.ml b/powerpc/TargetPrinter.ml
index 7e460f46..b3d228b3 100644
--- a/powerpc/TargetPrinter.ml
+++ b/powerpc/TargetPrinter.ml
@@ -38,6 +38,8 @@ module type SYSTEM =
val cfi_adjust: out_channel -> int32 -> unit
val cfi_rel_offset: out_channel -> string -> int32 -> unit
val print_prologue: out_channel -> unit
+ val print_epilogue: out_channel -> unit
+ val print_file_loc: out_channel -> DwarfTypes.file_loc -> unit
end
let symbol = elf_symbol
@@ -68,6 +70,14 @@ let float_reg_name = function
| FPR24 -> "24" | FPR25 -> "25" | FPR26 -> "26" | FPR27 -> "27"
| FPR28 -> "28" | FPR29 -> "29" | FPR30 -> "30" | FPR31 -> "31"
+let start_addr = ref (-1)
+
+let end_addr = ref (-1)
+
+let stmt_list_addr = ref (-1)
+
+let label = elf_label
+
module Linux_System : SYSTEM =
struct
@@ -117,6 +127,9 @@ module Linux_System : SYSTEM =
| Section_user(s, wr, ex) ->
sprintf ".section \"%s\",\"a%s%s\",@progbits"
s (if wr then "w" else "") (if ex then "x" else "")
+ | Section_debug_info -> ".debug_info,\"\",@progbits"
+ | Section_debug_abbrev -> ".debug_abbrev,\"\",@progbits"
+
let print_file_line oc file line =
PrintAnnot.print_file_line oc comment file line
@@ -131,6 +144,10 @@ module Linux_System : SYSTEM =
let cfi_rel_offset = cfi_rel_offset
let print_prologue oc = ()
+
+ let print_epilogue oc = ()
+
+ let print_file_loc _ _ = ()
end
@@ -182,9 +199,11 @@ module Diab_System : SYSTEM =
| true, false -> 'd' (* data *)
| false, true -> 'c' (* text *)
| false, false -> 'r') (* const *)
+ | Section_debug_info -> ".debug_info,,n"
+ | Section_debug_abbrev -> ".debug_abbrev,,n"
let print_file_line oc file line =
- PrintAnnot.print_file_line_d1 oc comment file line
+ PrintAnnot.print_file_line_d2 oc comment file line
(* Emit .cfi directives *)
let cfi_startproc oc = ()
@@ -198,8 +217,39 @@ module Diab_System : SYSTEM =
let print_prologue oc =
fprintf oc " .xopt align-fill-text=0x60000000\n";
if !Clflags.option_g then
- fprintf oc " .xopt asm-debug-on\n"
-
+ begin
+ fprintf oc " .text\n";
+ fprintf oc " .section .debug_line,,n\n";
+ let label_line_start = new_label () in
+ stmt_list_addr := label_line_start;
+ fprintf oc "%a:\n" label label_line_start;
+ fprintf oc " .text\n";
+ let label_start = new_label () in
+ start_addr := label_start;
+ fprintf oc "%a:\n" label label_start;
+ fprintf oc " .d2_line_start .debug_line\n";
+ end
+
+ let filenum : (string,int) Hashtbl.t = Hashtbl.create 7
+
+ let print_epilogue oc =
+ if !Clflags.option_g then
+ begin
+ fprintf oc "\n";
+ let label_end = new_label () in
+ end_addr := label_end;
+ fprintf oc "%a:\n" label label_end;
+ fprintf oc " .text\n";
+ PrintAnnot.StringSet.iter (fun file ->
+ let label = new_label () in
+ Hashtbl.add filenum file label;
+ fprintf oc ".L%d: .d2filenum \"%s\"\n" label file) !PrintAnnot.all_files;
+ fprintf oc " .d2_line_end\n"
+ end
+
+ let print_file_loc oc (file,col) =
+ fprintf oc " .4byte %a\n" label (Hashtbl.find filenum file);
+ fprintf oc " .uleb128 %d\n" col
end
module Target (System : SYSTEM):TARGET =
@@ -212,7 +262,7 @@ module Target (System : SYSTEM):TARGET =
let raw_symbol oc s =
fprintf oc "%s" s
- let label = elf_label
+ let label = label
let label_low oc lbl =
fprintf oc ".L%d@l" lbl
@@ -729,8 +779,6 @@ module Target (System : SYSTEM):TARGET =
let print_align oc align =
fprintf oc " .balign %d\n" align
- let print_epilogue _ = ()
-
let print_jumptable oc jmptbl =
let print_jumptable oc (lbl, tbl) =
fprintf oc "%a:" label lbl;
@@ -745,6 +793,17 @@ module Target (System : SYSTEM):TARGET =
end
let default_falignment = 4
+
+ let get_start_addr () = !start_addr
+
+ let get_end_addr () = !end_addr
+
+ let get_stmt_list_addr () = !stmt_list_addr
+
+ module DwarfAbbrevs = DwarfUtil.DefaultAbbrevs
+
+ let new_label = new_label
+
end
let sel_target () =