ppc: initial powerpc-apple-macos target

This commit is contained in:
Wolfgang Thaller 2015-08-30 10:46:39 +02:00
parent 836a8acb7b
commit fa0afdce72
11 changed files with 292 additions and 10 deletions

View File

@ -1280,6 +1280,7 @@ case "${targ}" in
targ_archs="$targ_archs bfd_i386_arch"
;;
powerpc-*-macos*)
targ_selvecs=powerpc_xcoff_vec
targ_defvec=powerpc_xcoff_vec
;;
powerpc-*-lynxos*)

View File

@ -1273,7 +1273,7 @@ static const bfd_target * const _bfd_target_vector[] =
&powerpc_pe_le_vec,
&powerpc_pei_vec,
&powerpc_pei_le_vec,
#if 0
#if 1
/* This has the same magic number as RS/6000. */
&powerpc_xcoff_vec,
#endif

View File

@ -375,7 +375,7 @@ case ${generic_target} in
ppc-*-aix5.[01]) fmt=coff em=aix5 ;;
ppc-*-aix[5-9].*) fmt=coff em=aix5 ;;
ppc-*-aix*) fmt=coff em=aix ;;
ppc-*-beos*) fmt=coff ;;
ppc-*-beos*) fmt=coff ;;
ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;;
ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;;
ppc-*-linux-*) fmt=elf em=linux ;;

View File

@ -603,6 +603,7 @@ powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin*)
powerpc-*-aix[5-9]*) targ_emul=aix5ppc ;;
powerpc-*-aix*) targ_emul=aixppc ;;
powerpc-*-beos*) targ_emul=aixppc ;;
powerpc-*-macos*) targ_emul=aixppc ;;
powerpc-*-windiss*) targ_emul=elf32ppcwindiss ;;
powerpc-*-lynxos*) targ_emul=ppclynx ;;
rs6000-*-aix[5-9]*) targ_emul=aix5rs6 ;;

View File

@ -2466,6 +2466,15 @@ powerpcle-*-eabi*)
extra_options="${extra_options} rs6000/sysv4.opt"
use_gcc_stdint=wrap
;;
powerpc-apple-macos*)
tm_file="${tm_file} rs6000/xcoff.h rs6000/aix-stdint.h rs6000/macos.h"
tmake_file="rs6000/t-macos"
extra_options="${extra_options} rs6000/aix64.opt"
use_collect2=yes
thread_file='aix'
use_gcc_stdint=provide
extra_headers=
;;
rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*)
tm_file="rs6000/biarch64.h ${tm_file} rs6000/aix.h rs6000/aix43.h rs6000/xcoff.h rs6000/aix-stdint.h"
tmake_file="rs6000/t-aix43 t-slibgcc"

View File

@ -0,0 +1,220 @@
/* Definitions of target machine for GNU compiler,
for IBM RS/6000 POWER running AIX.
Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3, or (at your
option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
/* Yes! We are AIX! */
#define DEFAULT_ABI ABI_AIX
#undef TARGET_AIX
#define TARGET_AIX 1
/* Linux64.h wants to redefine TARGET_AIX based on -m64, but it can't be used
in the #if conditional in options-default.h, so provide another macro. */
#undef TARGET_AIX_OS
#define TARGET_AIX_OS 1
/* AIX always has a TOC. */
#define TARGET_NO_TOC 0
#define TARGET_TOC 1
#define FIXED_R2 1
/* AIX allows r13 to be used in 32-bit mode. */
#define FIXED_R13 0
/* 32-bit and 64-bit AIX stack boundary is 128. */
#undef STACK_BOUNDARY
#define STACK_BOUNDARY 128
#undef TARGET_IEEEQUAD
#define TARGET_IEEEQUAD 0
#if HAVE_AS_REF
/* Issue assembly directives that create a reference to the given DWARF table
identifier label from the current function section. This is defined to
ensure we drag frame frame tables associated with needed function bodies in
a link with garbage collection activated. */
#define ASM_OUTPUT_DWARF_TABLE_REF rs6000_aix_asm_output_dwarf_table_ref
#endif
/* This is the only version of nm that collect2 can work with. */
//#define REAL_NM_FILE_NAME "/usr/ucb/nm"
#define USER_LABEL_PREFIX ""
/* Don't turn -B into -L if the argument specifies a relative file name. */
#define RELATIVE_PREFIX_NOT_LINKDIR
/* Because of the above, we must have gcc search itself to find libgcc.a. */
#define LINK_LIBGCC_SPECIAL_1
#undef ASM_DEFAULT_SPEC
#define ASM_DEFAULT_SPEC ""
/* Profiled library versions are used by linking with special directories. */
#define LIB_SPEC "-lc"
/* Static linking with shared libstdc++ requires libsupc++ as well. */
#define LIBSTDCXX_STATIC "supc++"
/* This now supports a natural alignment mode. */
/* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
((TARGET_ALIGN_NATURAL == 0 \
&& TYPE_MODE (strip_array_types (TREE_TYPE (FIELD))) == DFmode) \
? MIN ((COMPUTED), 32) \
: (COMPUTED))
/* AIX increases natural record alignment to doubleword if the first
field is an FP double while the FP fields remain word aligned. */
#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
((TREE_CODE (STRUCT) == RECORD_TYPE \
|| TREE_CODE (STRUCT) == UNION_TYPE \
|| TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
&& TARGET_ALIGN_NATURAL == 0 \
? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \
: MAX ((COMPUTED), (SPECIFIED)))
/* The AIX ABI isn't explicit on whether aggregates smaller than a
word/doubleword should be padded upward or downward. One could
reasonably assume that they follow the normal rules for structure
layout treating the parameter area as any other block of memory,
then map the reg param area to registers, i.e., pad upward, which
is the way IBM Compilers for AIX behave.
Setting both of the following defines results in this behavior. */
#define AGGREGATE_PADDING_FIXED 1
#define AGGREGATES_PAD_UPWARD_ALWAYS 1
/* Specify padding for the last element of a block move between
registers and memory. FIRST is nonzero if this is the only
element. */
#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
(!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
/* Indicate that jump tables go in the text section. */
#define JUMP_TABLES_IN_TEXT_SECTION 1
#define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
/* No version of AIX fully supports AltiVec or 64-bit instructions in
32-bit mode. */
#define OS_MISSING_POWERPC64 1
#define OS_MISSING_ALTIVEC 1
/* WINT_TYPE */
#define WINT_TYPE "int"
/* Static stack checking is supported by means of probes. */
#define STACK_CHECK_STATIC_BUILTIN 1
/* Use standard DWARF numbering for DWARF debugging information. */
#define RS6000_USE_DWARF_NUMBERING
/* MacOS does support Altivec. */
#/*undef TARGET_ALTIVEC
#define TARGET_ALTIVEC 1
#undef TARGET_ALTIVEC_ABI
#define TARGET_ALTIVEC_ABI 1
#undef TARGET_ALTIVEC_VRSAVE
#define TARGET_ALTIVEC_VRSAVE 1*/
#undef TARGET_OS_CPP_BUILTINS
/* __POWERPC__ must be defined for some header files */
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
builtin_define ("__ppc__"); \
builtin_define ("__POWERPC__"); \
builtin_define ("__NATURAL_ALIGNMENT__"); \
builtin_define ("__APPLE__"); \
builtin_assert ("system=macos"); \
builtin_assert ("cpu=powerpc"); \
builtin_assert ("machine=powerpc"); \
builtin_define("__IEEE_BIG_ENDIAN"); \
} \
while (0)
/* --no-check-sections : sections overlap on purpose!
--bnogc : something's going wrong when csects are gc'ed
*/
#define LINK_SPEC "%{!r:-btextro} -bhalt:4 -bnodelcsect \
--no-check-sections -bnogc \
%{shared:-bM:SRE}"
#undef STARTFILE_SPEC
#define STARTFILE_SPEC ""
#undef TARGET_DEFAULT
#define TARGET_DEFAULT 0
// (MASK_POWERPC | MASK_MULTIPLE | MASK_NEW_MNEMONICS)
#undef PROCESSOR_DEFAULT
#define PROCESSOR_DEFAULT PROCESSOR_PPC603
#undef OS_MISSING_ALTIVEC
#define OS_MISSING_ALTIVEC 0
#undef VECTOR_SAVE_INLINE
#define VECTOR_SAVE_INLINE(FIRST_REG) 1
#define TARGET_USES_AIX64_OPT
#undef TARGET_POINTERS_TO_NESTED_FUNCTIONS
#define TARGET_POINTERS_TO_NESTED_FUNCTIONS 0
#if 0
/* The AIX linker will discard static constructors in object files before
collect has a chance to see them, so scan the object files directly. */
#define COLLECT_EXPORT_LIST
/* On AIX, initialisers specified with -binitfini are called in breadth-first
order.
e.g. if a.out depends on lib1.so, the init function for a.out is called before
the init function for lib1.so.
To ensure global C++ constructors in linked libraries are run before global
C++ constructors from the current module, there is additional symbol scanning
logic in collect2.
The global initialiser/finaliser functions are named __GLOBAL_AIXI_{libname}
and __GLOBAL_AIXD_{libname} and are exported from each shared library.
collect2 will detect these symbols when they exist in shared libraries that
the current program is being linked against. All such initiliser functions
will be called prior to the constructors of the current program, and
finaliser functions called after destructors.
Reference counting generated by collect2 will ensure that constructors are
only invoked once in the case of multiple dependencies on a library.
-binitfini is still used in parallel to this solution.
This handles the case where a library is loaded through dlopen(), and also
handles the option -blazy.
*/
#define COLLECT_SHARED_INIT_FUNC(STREAM, FUNC) \
fprintf ((STREAM), "void %s() {\n\t%s();\n}\n", aix_shared_initname, (FUNC))
#define COLLECT_SHARED_FINI_FUNC(STREAM, FUNC) \
fprintf ((STREAM), "void %s() {\n\t%s();\n}\n", aix_shared_fininame, (FUNC))
#endif

View File

@ -0,0 +1,35 @@
# Copyright (C) 1998-2015 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
# GCC is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GCC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# Build the libraries for pthread and all of the
# different processor models
#MULTILIB_OPTIONS =
# mcpu=powerpc
#MULTILIB_DIRNAMES =
#powerpc
#MULTILIB_MATCHES =
# mcpu?powerpc=mcpu?powerpc \
# mcpu?powerpc=mcpu?601 \
# mcpu?powerpc=mcpu?602 \
# mcpu?powerpc=mcpu?603 \
# mcpu?powerpc=mcpu?603e \
# mcpu?powerpc=mcpu?604 \
# mcpu?powerpc=mcpu?604e

View File

@ -3949,12 +3949,14 @@ find_args_size_adjust (rtx_insn *insn)
addr = XEXP (mem, 0);
switch (GET_CODE (addr))
{
#ifdef PUSH_ROUNDING
case PRE_INC:
case POST_INC:
return PUSH_ROUNDING( GET_MODE_SIZE (GET_MODE (mem)) );
case PRE_DEC:
case POST_DEC:
return -PUSH_ROUNDING( GET_MODE_SIZE (GET_MODE (mem)) );
#endif
case PRE_MODIFY:
case POST_MODIFY:
addr = XEXP (addr, 1);

View File

@ -1076,6 +1076,9 @@ rs6000-ibm-aix[56789].* | powerpc-ibm-aix[56789].*)
tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-slibgcc-aix rs6000/t-ibm-ldouble rs6000/t-aix-cxa"
extra_parts="crtcxa.o crtcxa_s.o"
;;
powerpc-*-macos)
tmake_file="t-fdpbit rs6000/t-ibm-ldouble rs6000/t-aix-cxa"
;;
rl78-*-elf)
tmake_file="$tm_file t-fdpbit rl78/t-rl78"
;;

View File

@ -29,7 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "exit.h"
static boolean_t
static int
catomic_compare_and_exchange_bool_acq (long *mem, long newval, long oldval)
{
return __atomic_compare_exchange (mem, &oldval, &newval, 0,

View File

@ -2,9 +2,15 @@
Ian Lance Taylor, Cygnus Support, 9 Feb 1994.
Modified by Jeff Johnston, Red Hat Inc. 2 Oct 2001. */
#include "ppc-asm.h"
FUNC_START(setjmp)
.csect .text[PR]
.align 2
.globl setjmp
.globl .setjmp
.csect setjmp[DS]
setjmp:
.long .setjmp, TOC[tc0], 0
.csect .text[PR]
.setjmp:
#ifdef __ALTIVEC__
addi 3,3,15 # align Altivec to 16 byte boundary
rlwinm 3,3,0,0,27
@ -134,10 +140,16 @@ FUNC_START(setjmp)
#endif
li 3,0
blr
FUNC_END(setjmp)
FUNC_START(longjmp)
.csect .text[PR]
.align 2
.globl longjmp
.globl .longjmp
.csect longjmp[DS]
longjmp:
.long .longjmp, TOC[tc0], 0
.csect .text[PR]
.longjmp:
#ifdef __ALTIVEC__
addi 3,3,15 # align Altivec to 16 byte boundary
rlwinm 3,3,0,0,27
@ -265,4 +277,3 @@ FUNC_START(longjmp)
bclr+ 4,2
li 3,1
blr
FUNC_END(longjmp)