public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Piotr Kubaj <pkubaj@anongoth.pl>
To: gcc-patches@gcc.gnu.org, David Edelsohn <dje.gcc@gmail.com>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Andreas Tobler <andreast@freebsd.org>
Subject: rs6000: add support for powerpc64le-unknown-freebsd
Date: Mon, 14 Dec 2020 16:35:38 +0100	[thread overview]
Message-ID: <X9eGSvNaJ0ViqRUN@KGPE-D16> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 480 bytes --]

Hello,

this patch implements support for powerpc64le architecture on FreeBSD. Since we don't have powerpcle (32-bit), I did not add support for powerpcle here. This remains to be changed if there is powerpcle support in the future.

Patch implements similar endian detection to what linux64.h uses.

Would it be ok to backport it to at least GCC 10?

gcc/Changelog:
2020-12-14  Piotr Kubaj  <pkubaj@FreeBSD.org>

        * config.gcc: add support for powerpc64le-unknown-freebsd

[-- Attachment #1.2: gcc-powerpc64le-freebsd.patch --]
[-- Type: text/x-diff, Size: 1935 bytes --]

--- gcc/config.gcc.orig	2020-12-07 03:00:29 UTC
+++ gcc/config.gcc
@@ -2868,6 +2868,10 @@ powerpc*-*-freebsd*)
 	extra_options="${extra_options} rs6000/sysv4.opt"
 	tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
 	case ${target} in
+	    powerpc*le-*-*)
+		tm_file="${tm_file} rs6000/sysv4le.h" ;;
+	esac
+	case ${target} in
 	     powerpc64*)
 	    	tm_file="${tm_file} rs6000/default64.h rs6000/freebsd64.h"
 		tmake_file="${tmake_file} rs6000/t-freebsd64"
--- gcc/config/rs6000/freebsd64.h.orig	2020-07-23 06:35:17 UTC
+++ gcc/config/rs6000/freebsd64.h
@@ -158,8 +157,8 @@ extern int dot_symbols;
 #define ASM_SPEC64 "-a64"
 
 #define ASM_SPEC_COMMON "%(asm_cpu) \
-%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
-%{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian}"
+%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
+  ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
 
 #undef	SUBSUBTARGET_EXTRA_SPECS
 #define SUBSUBTARGET_EXTRA_SPECS					\
@@ -181,9 +180,15 @@ extern int dot_symbols;
     %{static:-Bstatic}} \
   %{symbolic:-Bsymbolic}"
 
+#undef  DEFAULT_ASM_ENDIAN
 #define LINK_OS_FREEBSD_SPEC32 "-melf32ppc_fbsd " LINK_OS_FREEBSD_SPEC_DEF
-  
+#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
+#define DEFAULT_ASM_ENDIAN " -mlittle"
+#define LINK_OS_FREEBSD_SPEC64 "-melf64lppc_fbsd " LINK_OS_FREEBSD_SPEC_DEF
+#else
+#define DEFAULT_ASM_ENDIAN " -mbig"
 #define LINK_OS_FREEBSD_SPEC64 "-melf64ppc_fbsd " LINK_OS_FREEBSD_SPEC_DEF
+#endif
 
 #undef	MULTILIB_DEFAULTS
 #define MULTILIB_DEFAULTS { "m64" }
--- gcc/configure.ac.orig	2020-12-14 15:22:23 UTC
+++ gcc/configure.ac
@@ -5874,6 +5874,8 @@ case "$target:$tm_file" in
      *-*-linux*)
      emul_name="-melf64ppc"
       ;;
+     *le-*-freebsd*)
+     emul_name="-melf64lppc_fbsd"
      *-*-freebsd*)
      emul_name="-melf64ppc_fbsd"
       ;;

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2020-12-14 15:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 15:35 Piotr Kubaj [this message]
2020-12-14 16:46 ` Segher Boessenkool
2020-12-14 23:29   ` Gerald Pfeifer
2020-12-15  0:30     ` Segher Boessenkool
2020-12-16 22:58     ` Segher Boessenkool
2020-12-28 11:44       ` Gerald Pfeifer
2020-12-28 12:37         ` Segher Boessenkool
2021-09-10 23:26           ` Piotr Kubaj
2020-12-14 23:37 ` Gerald Pfeifer
2020-12-14 23:52   ` Piotr Kubaj
2020-12-16 22:23     ` Segher Boessenkool
2021-04-29 11:37       ` Piotr Kubaj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X9eGSvNaJ0ViqRUN@KGPE-D16 \
    --to=pkubaj@anongoth.pl \
    --cc=andreast@freebsd.org \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).