Remove IA32 macOS (Darwin) support (#2278)

This patch removes support for 32-bit Darwin (macOS, iOS, etc) targets on Intel hardware. This enables various special cases to be removed in the i386 backend.  

The current version of macOS (Mojave) is the last one that will support 32-bit x86 binaries.  The current version of iOS does not support execution of 32-bit binaries any more.
master
Mark Shinwell 2019-03-07 10:12:00 +00:00 committed by Xavier Leroy
parent 00c18be73c
commit 784c9da23c
7 changed files with 18 additions and 82 deletions

View File

@ -3,6 +3,12 @@ Working version
(Changes that can break existing programs are marked with a "*") (Changes that can break existing programs are marked with a "*")
### Code generation and optimizations:
- GPR#2278: Remove native code generation support for 32-bit Intel macOS,
iOS and other Darwin targets.
(Mark Shinwell, review by Nicolas Ojeda Bar and Xavier Leroy)
### Internal/compiler-libs changes: ### Internal/compiler-libs changes:
- GPR#1579: Add a separate types for clambda primitives - GPR#1579: Add a separate types for clambda primitives

View File

@ -49,7 +49,7 @@ compiler currently runs on the following platforms:
Tier 1 (actively used and maintained by the core OCaml team): Tier 1 (actively used and maintained by the core OCaml team):
AMD64 (Opteron):: Linux, OS X, MS Windows AMD64 (Opteron):: Linux, OS X, MS Windows
IA32 (Pentium):: Linux, FreeBSD, OS X, MS Windows IA32 (Pentium):: Linux, FreeBSD, MS Windows
PowerPC:: Linux, OS X PowerPC:: Linux, OS X
ARM:: Linux ARM:: Linux

View File

@ -4,10 +4,13 @@ Intel and AMD x86 processors in 32-bit mode.
The baseline is the 80486, also known as `i486`. The baseline is the 80486, also known as `i486`.
(Debian's baseline is now the Pentium 1.) (Debian's baseline is now the Pentium 1.)
In OCaml versions 3.09.2 to 4.08, MacOS was supported by this port. Support
was removed in OCaml 4.09.
Floating-point architecture: x87. Floating-point architecture: x87.
(SSE2 not available in Debian's baseline.) (SSE2 not available in Debian's baseline.)
Operating systems: Linux, BSD, MacOS X, MS Windows. Operating systems: Linux, BSD, MS Windows.
Debian architecture name: `i386` Debian architecture name: `i386`
@ -18,5 +21,3 @@ Debian architecture name: `i386`
* ELF application binary interface: * ELF application binary interface:
_System V Application Binary Interface, _System V Application Binary Interface,
Intel386 Architecture Processor Supplement_ Intel386 Architecture Processor Supplement_
* MacOS X application binary interface:
_OS X ABI Function Call Guide: IA-32 Function Calling Conventions_

View File

@ -163,5 +163,4 @@ let stack_alignment =
match Config.system with match Config.system with
| "win32" -> 4 (* MSVC *) | "win32" -> 4 (* MSVC *)
| _ -> 16 | _ -> 16
(* PR#6038: GCC and Clang seem to require 16-byte alignment nowadays, (* PR#6038: GCC and Clang seem to require 16-byte alignment nowadays *)
even if only MacOS X's ABI formally requires it *)

View File

@ -467,9 +467,6 @@ let emit_global_label s =
let function_name = ref "" let function_name = ref ""
(* Entry point for tail recursive calls *) (* Entry point for tail recursive calls *)
let tailrec_entry_point = ref 0 let tailrec_entry_point = ref 0
(* Record references to external C functions (for MacOSX) *)
let external_symbols_direct = ref String.Set.empty
let external_symbols_indirect = ref String.Set.empty
(* Emission of the profiling prelude *) (* Emission of the profiling prelude *)
@ -487,7 +484,6 @@ let emit_profile () =
match system with match system with
| S_linux_elf | S_gnu -> call_mcount "mcount" | S_linux_elf | S_gnu -> call_mcount "mcount"
| S_bsd_elf -> call_mcount ".mcount" | S_bsd_elf -> call_mcount ".mcount"
| S_macosx -> call_mcount "Lmcount$stub"
| _ -> () (*unsupported yet*) | _ -> () (*unsupported yet*)
let emit_instr fallthrough i = let emit_instr fallthrough i =
@ -564,24 +560,11 @@ let emit_instr fallthrough i =
| Lop(Iextcall { func; alloc; label_after; }) -> | Lop(Iextcall { func; alloc; label_after; }) ->
add_used_symbol func; add_used_symbol func;
if alloc then begin if alloc then begin
if system <> S_macosx then I.mov (immsym func) eax;
I.mov (immsym func) eax
else begin
external_symbols_indirect :=
String.Set.add func !external_symbols_indirect;
I.mov (mem_sym DWORD (Printf.sprintf "L%s$non_lazy_ptr"
(emit_symbol func))) eax
end;
emit_call "caml_c_call"; emit_call "caml_c_call";
record_frame i.live false i.dbg ~label:label_after record_frame i.live false i.dbg ~label:label_after
end else begin end else begin
if system <> S_macosx then emit_call func
emit_call func
else begin
external_symbols_direct :=
String.Set.add func !external_symbols_direct;
I.call (sym (Printf.sprintf "L%s$stub" (emit_symbol func)))
end
end end
| Lop(Istackoffset n) -> | Lop(Istackoffset n) ->
if n < 0 if n < 0
@ -916,32 +899,6 @@ let rec emit_all fallthrough i =
(system = S_win32 || Linearize.has_fallthrough i.desc) (system = S_win32 || Linearize.has_fallthrough i.desc)
i.next i.next
(* Emission of external symbol references (for MacOSX) *)
let emit_external_symbol_direct s =
_label (Printf.sprintf "L%s$stub" (emit_symbol s));
D.indirect_symbol (emit_symbol s);
I.hlt (); I.hlt (); I.hlt (); I.hlt () ; I.hlt ()
let emit_external_symbol_indirect s =
_label (Printf.sprintf "L%s$non_lazy_ptr" (emit_symbol s));
D.indirect_symbol (emit_symbol s);
D.long (const 0)
let emit_external_symbols () =
D.section [ "__IMPORT"; "__pointers"] None ["non_lazy_symbol_pointers" ];
String.Set.iter emit_external_symbol_indirect !external_symbols_indirect;
external_symbols_indirect := String.Set.empty;
D.section [ "__IMPORT"; "__jump_table"] None
[ "symbol_stubs"; "self_modifying_code+pure_instructions"; "5" ];
String.Set.iter emit_external_symbol_direct !external_symbols_direct;
external_symbols_direct := String.Set.empty;
if !Clflags.gprofile then begin
_label "Lmcount$stub";
D.indirect_symbol "mcount";
I.hlt (); I.hlt (); I.hlt () ; I.hlt () ; I.hlt ()
end
(* Emission of a function declaration *) (* Emission of a function declaration *)
let fundecl fundecl = let fundecl fundecl =
@ -955,13 +912,7 @@ let fundecl fundecl =
D.text (); D.text ();
add_def_symbol fundecl.fun_name; add_def_symbol fundecl.fun_name;
D.align (if system = S_win32 then 4 else 16); D.align (if system = S_win32 then 4 else 16);
if system = S_macosx D.global (emit_symbol fundecl.fun_name);
&& not !Clflags.output_c_object
&& is_generic_function fundecl.fun_name
then (* PR#4690 *)
D.private_extern (emit_symbol fundecl.fun_name)
else
D.global (emit_symbol fundecl.fun_name);
D.label (emit_symbol fundecl.fun_name); D.label (emit_symbol fundecl.fun_name);
emit_debug_info fundecl.fun_dbg; emit_debug_info fundecl.fun_dbg;
cfi_startproc (); cfi_startproc ();
@ -1027,9 +978,7 @@ let begin_assembly() =
emit_global_label "data_begin"; emit_global_label "data_begin";
D.text (); D.text ();
emit_global_label "code_begin"; emit_global_label "code_begin"
if system = S_macosx then I.nop (); (* PR#4690 *)
()
let end_assembly() = let end_assembly() =
if !float_constants <> [] then begin if !float_constants <> [] then begin
@ -1038,8 +987,6 @@ let end_assembly() =
end; end;
D.text (); D.text ();
if system = S_macosx then I.nop ();
(* suppress "ld warning: atom sorting error" *)
emit_global_label "code_end"; emit_global_label "code_end";
@ -1066,7 +1013,6 @@ let end_assembly() =
efa_string = (fun s -> D.bytes (s ^ "\000")) efa_string = (fun s -> D.bytes (s ^ "\000"))
}; };
if system = S_macosx then emit_external_symbols ();
if system = S_linux_elf then if system = S_linux_elf then
(* Mark stack as non-executable, PR#4564 *) (* Mark stack as non-executable, PR#4564 *)
D.section [".note.GNU-stack"] (Some "") ["%progbits"]; D.section [".note.GNU-stack"] (Some "") ["%progbits"];

14
configure vendored
View File

@ -13435,10 +13435,6 @@ if test x"$enable_shared" != "xno"; then :
natdynlink=true ;; #( natdynlink=true ;; #(
x86_64-*-linux*) : x86_64-*-linux*) :
natdynlink=true ;; #( natdynlink=true ;; #(
i[3456]86-*-darwin*) :
if $arch64; then :
natdynlink=true
fi ;; #(
x86_64-*-darwin*) : x86_64-*-darwin*) :
natdynlink=true ;; #( natdynlink=true ;; #(
s390x*-*-linux*) : s390x*-*-linux*) :
@ -13526,12 +13522,6 @@ case $host in #(
arch=i386; system=beos ;; #( arch=i386; system=beos ;; #(
i[3456]86-*-cygwin) : i[3456]86-*-cygwin) :
arch=i386; system=cygwin ;; #( arch=i386; system=cygwin ;; #(
i[3456]86-*-darwin*) :
if $arch64; then :
arch=amd64
else
arch=i386
fi; system=macosx ;; #(
i[3456]86-*-gnu*) : i[3456]86-*-gnu*) :
arch=i386; system=gnu ;; #( arch=i386; system=gnu ;; #(
i[3456]86-*-mingw32) : i[3456]86-*-mingw32) :
@ -13766,8 +13756,6 @@ case "$arch,$system" in #(
profiling=true ;; #( profiling=true ;; #(
amd64,macosx) : amd64,macosx) :
profiling=true ;; #( profiling=true ;; #(
i386,macosx) :
profiling=true ;; #(
amd64,linux) : amd64,linux) :
profiling=true ;; #( profiling=true ;; #(
amd64,openbsd) : amd64,openbsd) :
@ -15371,7 +15359,7 @@ esac
$as_echo_n "checking whether stack overflows can be detected... " >&6; } $as_echo_n "checking whether stack overflows can be detected... " >&6; }
case $arch,$system in #( case $arch,$system in #(
i386,linux_elf|amd64,linux|amd64,macosx|i386,macosx \ i386,linux_elf|amd64,linux|amd64,macosx \
|amd64,openbsd|i386,bsd_elf) : |amd64,openbsd|i386,bsd_elf) :
$as_echo "#define HAS_STACK_OVERFLOW_DETECTION 1" >>confdefs.h $as_echo "#define HAS_STACK_OVERFLOW_DETECTION 1" >>confdefs.h

View File

@ -751,7 +751,6 @@ AS_IF([test x"$enable_shared" != "xno"],
[[i[3456]86-*-linux*]], [natdynlink=true], [[i[3456]86-*-linux*]], [natdynlink=true],
[[i[3456]86-*-gnu*]], [natdynlink=true], [[i[3456]86-*-gnu*]], [natdynlink=true],
[[x86_64-*-linux*]], [natdynlink=true], [[x86_64-*-linux*]], [natdynlink=true],
[[i[3456]86-*-darwin*]], [AS_IF([$arch64], [natdynlink=true])],
[x86_64-*-darwin*], [natdynlink=true], [x86_64-*-darwin*], [natdynlink=true],
[s390x*-*-linux*], [natdynlink=true], [s390x*-*-linux*], [natdynlink=true],
[powerpc*-*-linux*], [natdynlink=true], [powerpc*-*-linux*], [natdynlink=true],
@ -793,8 +792,6 @@ AS_CASE([$host],
[arch=i386; system=beos], [arch=i386; system=beos],
[[i[3456]86-*-cygwin]], [[i[3456]86-*-cygwin]],
[arch=i386; system=cygwin], [arch=i386; system=cygwin],
[[i[3456]86-*-darwin*]],
[AS_IF([$arch64], [arch=amd64], [arch=i386]); system=macosx],
[[i[3456]86-*-gnu*]], [[i[3456]86-*-gnu*]],
[arch=i386; system=gnu], [arch=i386; system=gnu],
[[i[3456]86-*-mingw32]], [[i[3456]86-*-mingw32]],
@ -904,7 +901,6 @@ AS_CASE(["$arch,$system"],
[i386,gnu], [profiling=true], [i386,gnu], [profiling=true],
[i386,bsd_elf], [profiling=true], [i386,bsd_elf], [profiling=true],
[amd64,macosx], [profiling=true], [amd64,macosx], [profiling=true],
[i386,macosx], [profiling=true],
[amd64,linux], [profiling=true], [amd64,linux], [profiling=true],
[amd64,openbsd], [profiling=true], [amd64,openbsd], [profiling=true],
[amd64,freebsd], [profiling=true], [amd64,freebsd], [profiling=true],
@ -1453,7 +1449,7 @@ AS_CASE([$enable_debug_runtime],
AC_MSG_CHECKING([whether stack overflows can be detected]) AC_MSG_CHECKING([whether stack overflows can be detected])
AS_CASE([$arch,$system], AS_CASE([$arch,$system],
[i386,linux_elf|amd64,linux|amd64,macosx|i386,macosx \ [i386,linux_elf|amd64,linux|amd64,macosx \
|amd64,openbsd|i386,bsd_elf], |amd64,openbsd|i386,bsd_elf],
[AC_DEFINE([HAS_STACK_OVERFLOW_DETECTION]) [AC_DEFINE([HAS_STACK_OVERFLOW_DETECTION])
AC_MSG_RESULT([yes])], AC_MSG_RESULT([yes])],