Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006049OCamlOCaml internal build/install (Makefiles, configure)public2013-06-23 18:512013-12-16 16:54
Reporteravsm 
Assigned Tomeurer 
PrioritynormalSeverityfeatureReproducibilityalways
StatusconfirmedResolutionreopened 
PlatformOSopenbsd/macppcOS Version4.3
Product Version 
Target Version4.01.1+devFixed in Version4.01.0+dev 
Summary0006049: fix support for OpenBSD/macppc (32-bit powerpc)
DescriptionThis patch adds support in 4.1 for OpenBSD/macppc (running on a Powerbook G4). With the patch, OPAM compiles to native code and is churning out package builds. The system is ELF and BSD, so I had to add a bsd_elf SYSTEM variant to select the right combination of native code features. Let me know if you'd prefer a different scheme here.

It would be great to get this into 4.1 so that we can package it on OpenBSD without local patches, but it's not a big deal if it's too late in the release cycle.

Raw patch available at: https://github.com/avsm/ocaml/commit/c2a8e549f6376c42ddccfff4f7262c0725402ca0.patch [^]

From c2a8e549f6376c42ddccfff4f7262c0725402ca0 Mon Sep 17 00:00:00 2001
From: Anil Madhavapeddy <anil@recoil.org>
Date: Sat, 22 Jun 2013 18:53:51 +0100
Subject: [PATCH] Fix support for OpenBSD/macppc by adding a powerpc/bsd_elf
 variant

---
 asmcomp/power/emit.mlp | 21 ++++++++++++---------
 asmcomp/power/proc.ml | 2 +-
 asmrun/Makefile | 3 +++
 asmrun/signals_osdep.h | 2 +-
 configure | 3 ++-
 5 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/asmcomp/power/emit.mlp b/asmcomp/power/emit.mlp
index 794478f..283312e 100644
--- a/asmcomp/power/emit.mlp
+++ b/asmcomp/power/emit.mlp
@@ -56,7 +56,7 @@ let supports_backtraces =
 
 let emit_symbol =
   match Config.system with
- | "elf" | "bsd" -> (fun s -> Emitaux.emit_symbol '.' s)
+ | "elf" | "bsd" | "bsd_elf" -> (fun s -> Emitaux.emit_symbol '.' s)
   | "rhapsody" -> (fun s -> emit_char '_'; Emitaux.emit_symbol '$' s)
   | _ -> assert false
 
@@ -64,7 +64,7 @@ let emit_symbol =
 
 let label_prefix =
   match Config.system with
- | "elf" | "bsd" -> ".L"
+ | "elf" | "bsd" | "bsd_elf" -> ".L"
   | "rhapsody" -> "L"
   | _ -> assert false
 
@@ -78,19 +78,19 @@ let emit_data_label lbl =
 
 let data_space =
   match Config.system with
- | "elf" | "bsd" -> " .section \".data\"\n"
+ | "elf" | "bsd" | "bsd_elf" -> " .section \".data\"\n"
   | "rhapsody" -> " .data\n"
   | _ -> assert false
 
 let code_space =
   match Config.system with
- | "elf" | "bsd" -> " .section \".text\"\n"
+ | "elf" | "bsd" | "bsd_elf" -> " .section \".text\"\n"
   | "rhapsody" -> " .text\n"
   | _ -> assert false
 
 let rodata_space =
   match Config.system with
- | "elf" | "bsd" -> " .section \".rodata\"\n"
+ | "elf" | "bsd" | "bsd_elf" -> " .section \".rodata\"\n"
   | "rhapsody" -> " .const\n"
   | _ -> assert false
 
@@ -158,7 +158,7 @@ let is_native_immediate n =
 
 let emit_upper emit_fun arg =
   match Config.system with
- | "elf" | "bsd" ->
+ | "elf" | "bsd" | "bsd_elf" ->
       emit_fun arg; emit_string "@ha"
   | "rhapsody" ->
       emit_string "ha16("; emit_fun arg; emit_string ")"
@@ -166,7 +166,7 @@ let emit_upper emit_fun arg =
 
 let emit_lower emit_fun arg =
   match Config.system with
- | "elf" | "bsd" ->
+ | "elf" | "bsd" | "bsd_elf" ->
       emit_fun arg; emit_string "@l"
   | "rhapsody" ->
       emit_string "lo16("; emit_fun arg; emit_string ")"
@@ -844,7 +844,7 @@ let fundecl fundecl =
   else
   ` .globl {emit_symbol fundecl.fun_name}\n`;
   begin match Config.system with
- | "elf" | "bsd" ->
+ | "elf" | "bsd" | "bsd_elf" ->
       ` .type {emit_symbol fundecl.fun_name}, @function\n`
   | _ -> ()
   end;
@@ -889,8 +889,11 @@ let fundecl fundecl =
 
 let declare_global_data s =
   ` .globl {emit_symbol s}\n`;
- if Config.system = "elf" || Config.system = "bsd" then
+ match Config.system with
+ | "elf" | "bsd" | "bsd_elf" ->
     ` .type {emit_symbol s}, @object\n`
+ | "rhapsody" -> ()
+ | _ -> assert false
 
 let emit_item = function
     Cglobal_symbol s ->
diff --git a/asmcomp/power/proc.ml b/asmcomp/power/proc.ml
index 07eb8b6..203e8a9 100644
--- a/asmcomp/power/proc.ml
+++ b/asmcomp/power/proc.ml
@@ -186,7 +186,7 @@ let poweropen_external_conventions first_int last_int
 let loc_external_arguments =
   match Config.system with
   | "rhapsody" -> poweropen_external_conventions 0 7 100 112
- | "elf" | "bsd" -> calling_conventions 0 7 100 107 outgoing 8
+ | "elf" | "bsd" | "bsd_elf" -> calling_conventions 0 7 100 107 outgoing 8
   | _ -> assert false
 
 let extcall_use_push = false
diff --git a/asmrun/Makefile b/asmrun/Makefile
index 89adaa2..5ebf7aa 100644
--- a/asmrun/Makefile
+++ b/asmrun/Makefile
@@ -81,6 +81,9 @@ install-prof:
     cp libasmrunp.a $(LIBDIR)/libasmrunp.a
     cd $(LIBDIR); $(RANLIB) libasmrunp.a
 
+power-bsd_elf.S: power-elf.S
+ cp power-elf.S power-bsd_elf.S
+
 power.o: power-$(SYSTEM).o
     cp power-$(SYSTEM).o power.o
 
diff --git a/asmrun/signals_osdep.h b/asmrun/signals_osdep.h
index 5e07b2c..ff19847 100644
--- a/asmrun/signals_osdep.h
+++ b/asmrun/signals_osdep.h
@@ -237,7 +237,7 @@
 
 /****************** PowerPC, BSD */
 
-#elif defined(TARGET_power) && defined(SYS_bsd)
+#elif defined(TARGET_power) && (defined(SYS_bsd) || defined(SYS_bsd_elf))
 
   #define DECLARE_SIGNAL_HANDLER(name) \
     static void name(int sig, int code, struct sigcontext * context)
diff --git a/configure b/configure
index d721aa4..f9ebbd0 100755
--- a/configure
+++ b/configure
@@ -690,6 +690,7 @@ case "$host" in
   i[3456]86-*-gnu*) arch=i386; system=gnu;;
   powerpc*-*-linux*) arch=power; model=ppc; system=elf;;
   powerpc-*-netbsd*) arch=power; model=ppc; system=elf;;
+ powerpc-*-openbsd*) arch=power; model=ppc; system=bsd_elf;;
   powerpc-*-rhapsody*) arch=power; model=ppc; system=rhapsody;;
   powerpc-*-darwin*) arch=power; system=rhapsody
                                 if $arch64; then model=ppc64; else model=ppc; fi;;
@@ -767,7 +768,7 @@ case "$arch,$model,$system" in
                     aspp='gcc -c';;
   power,*,elf) as='as -u -m ppc'
                     aspp='gcc -c';;
- power,*,bsd) as='as'
+ power,*,bsd*) as='as'
                     aspp='gcc -c';;
   power,*,rhapsody) as="as -arch $model"
                     aspp="$bytecc -c";;
--
1.8.1.6
Tagspatch
Attached Files

- Relationships

-  Notes
(0009607)
xleroy (administrator)
2013-06-24 10:18

Patch applied in 4.01 branch (commit 13834) and on SVN trunk (commit 13835). Will be part of release 4.01.0.
(0009614)
meurer (developer)
2013-06-25 11:46

Hm, I don't see the need for bsd_elf here. The other BSDs also use ELF. Why not use "bsd" for OpenBSD as well?
(0009647)
avsm (reporter)
2013-06-29 19:58

You're right. That was actually only necessary in order to avoid a special rule for power-bsd_elf, but it turns out rule was needed anyway.

I'm just compiling the simpler patch and will update this issue with a patch when it's tested (I can't see any way to re-open this issue, however).

- Issue History
Date Modified Username Field Change
2013-06-23 18:51 avsm New Issue
2013-06-24 10:18 xleroy Note Added: 0009607
2013-06-24 10:18 xleroy Status new => resolved
2013-06-24 10:18 xleroy Resolution open => fixed
2013-06-24 10:18 xleroy Fixed in Version => 4.01.0+dev
2013-06-25 11:46 meurer Note Added: 0009614
2013-06-29 19:58 avsm Note Added: 0009647
2013-07-01 18:17 meurer Assigned To => meurer
2013-07-01 18:17 meurer Status resolved => feedback
2013-07-01 18:17 meurer Resolution fixed => reopened
2013-12-16 16:54 doligez Status feedback => confirmed
2013-12-16 16:54 doligez Target Version => 4.01.1+dev
2013-12-16 16:54 doligez Tag Attached: patch


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker