--- asmcomp/i386/emit.mlp.orig	Thu Feb  4 11:30:31 1999
+++ asmcomp/i386/emit.mlp	Fri May  7 00:58:25 1999
@@ -42,12 +42,13 @@
       else !stack_offset + num_stack_slots.(0) * 4 + n * 8
   | Outgoing n -> n
 
-(* Symbols are prefixed with _, except under Linux with ELF binaries *)
+(* Symbols are prefixed with _, except for ELF binaries *)
 
 let symbol_prefix =
   match Config.system with
     "linux_elf" -> ""
   | "solaris" -> ""
+  | "freebsd" -> ""
   | _ -> "_"
 
 let emit_symbol s =
@@ -59,6 +60,7 @@
   match Config.system with
     "linux_elf" -> ".L"
   | "solaris" -> ".L"
+  | "freebsd" -> ".L"
   | _ -> "L"
 
 let emit_label lbl =
@@ -85,7 +87,7 @@
 
 let emit_align =
   match Config.system with
-    "linux_elf" | "solaris" ->
+    "linux_elf" | "solaris" | "freebsd" ->
       (fun n -> `	.align	{emit_int n}\n`)
   | _ ->
       (fun n -> `	.align	{emit_int(Misc.log2 n)}\n`)
@@ -703,6 +705,15 @@
       `	pushl	%ecx\n`;
       `	pushl	%edx\n`;
       `	call	{emit_symbol "mcount"}\n`;
+      `	popl	%edx\n`;
+      `	popl	%ecx\n`;
+      `	popl	%eax\n`
+  | "freebsd" ->
+      `	pushl	%eax\n`;
+      `	movl	%esp, %ebp\n`;
+      `	pushl	%ecx\n`;
+      `	pushl	%edx\n`;
+      ` call	.mcount\n`;
       `	popl	%edx\n`;
       `	popl	%ecx\n`;
       `	popl	%eax\n`
