Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix support for OpenBSD/macppc (32-bit powerpc) #6049

Closed
vicuna opened this issue Jun 23, 2013 · 10 comments
Closed

fix support for OpenBSD/macppc (32-bit powerpc) #6049

vicuna opened this issue Jun 23, 2013 · 10 comments

Comments

@vicuna
Copy link

@vicuna vicuna commented Jun 23, 2013

Original bug ID: 6049
Reporter: @avsm
Assigned to: meurer
Status: confirmed (set by @damiendoligez on 2013-12-16T15:54:29Z)
Resolution: reopened
Priority: normal
Severity: feature
OS: openbsd/macppc
OS Version: 4.3
Target version: undecided
Fixed in version: 4.01.0+dev
Category: configure and build/install
Tags: patch
Monitored by: meurer

Bug description

This 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 c2a8e54 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
@vicuna
Copy link
Author

@vicuna vicuna commented Jun 24, 2013

Comment author: @xavierleroy

Patch applied in 4.01 branch (commit 13834) and on SVN trunk (commit 13835). Will be part of release 4.01.0.

@vicuna
Copy link
Author

@vicuna vicuna commented Jun 25, 2013

Comment author: meurer

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?

@vicuna
Copy link
Author

@vicuna vicuna commented Jun 29, 2013

Comment author: @avsm

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).

@vicuna
Copy link
Author

@vicuna vicuna commented May 30, 2014

Comment author: @mshinwell

Anil, can we close this issue?

@vicuna
Copy link
Author

@vicuna vicuna commented May 30, 2014

Comment author: @avsm

Can we retarget this for 4.03 please? I still have to remove the unnecessary bsd_elf indirection that Benedikt pointed out, but haven't had a chance to run all the tests on the ppc yet (due to hardware failure).

@vicuna
Copy link
Author

@vicuna vicuna commented May 30, 2014

Comment author: @mshinwell

re-targetted for 4.03

@vicuna
Copy link
Author

@vicuna vicuna commented Apr 18, 2016

Comment author: @gasche

I'm retargeting for 4.04.

@vicuna
Copy link
Author

@vicuna vicuna commented Oct 8, 2017

Comment author: @xavierleroy

See also #1409 for a hypothetical NetBSD/OpenBSD convergence.

@xavierleroy
Copy link
Contributor

@xavierleroy xavierleroy commented Mar 17, 2019

I'm afraid support for PowerPC under non-Linux platforms was removed in 2015 as part of commit 8815d7e, even though traces remain in configure.ac (to be discussed with @shindere).

Moreover, PowerPC 32 bits is dying, just like the old Macs that were able to run it. POWER8 64-bits seems to be the last healthy variant of this architecture.

So, with all due respect to dead architectures, I will close this issue.

@shindere
Copy link
Contributor

@shindere shindere commented Mar 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants