public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marcus Shawcroft <marcus.shawcroft@arm.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH] [1/10] AArch64 Port
Date: Tue, 23 Oct 2012 09:43:00 -0000	[thread overview]
Message-ID: <50866671.4030201@arm.com> (raw)
In-Reply-To: <50865E58.4020507@arm.com>

[-- Attachment #1: Type: text/plain, Size: 266 bytes --]


This patch contains the adjustments to top level gcc configury required 
to enable the AArch64 port.

Proposed ChangeLog:

          * config.gcc: Add AArch64.
          * configure.ac: Add AArch64 TLS support detection.
          * configure: Regenerate.

[-- Attachment #2: xx-gcc-configury-patch.txt --]
[-- Type: text/plain, Size: 5697 bytes --]

diff --git a/gcc/config.gcc b/gcc/config.gcc
index ed7474ad68c4ae7234072d508b697a9a2218d18d..75ca21756ebca80479d69c38ff8d3c4142d822f3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -310,6 +310,13 @@ m32c*-*-*)
 	tmake_file=m32c/t-m32c
 	target_has_targetm_common=no
         ;;
+aarch64*-*-*)
+	cpu_type=aarch64
+	need_64bit_hwint=yes
+	extra_headers="arm_neon.h"
+	extra_objs="aarch64-builtins.o"
+	target_has_targetm_common=yes
+	;;
 alpha*-*-*)
 	cpu_type=alpha
 	need_64bit_hwint=yes
@@ -796,6 +803,27 @@ case ${target} in
 esac
 
 case ${target} in
+aarch64*-*-elf)
+	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h"
+	tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-elf-raw.h"
+	tmake_file="${tmake_file} aarch64/t-aarch64"
+	use_gcc_stdint=wrap
+	case $target in
+	aarch64_be-*)
+		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
+		;;
+	esac
+	;;
+aarch64*-*-linux*)
+	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h"
+	tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-linux.h"
+	tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-linux"
+	case $target in
+	aarch64_be-*)
+		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
+		;;
+	esac
+	;;
 alpha*-*-linux*)
 	tm_file="elfos.h ${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h glibc-stdint.h"
 	extra_options="${extra_options} alpha/elf.opt"
@@ -2995,6 +3023,92 @@ fi
 
 supported_defaults=
 case "${target}" in
+	aarch64*-*-*)
+		supported_defaults="cpu arch"
+		for which in cpu arch; do
+
+			eval "val=\$with_$which"
+			base_val=`echo $val | sed -e 's/\+.*//'`
+			ext_val=`echo $val | sed -e 's/[a-z0-9\-]\+//'`
+
+			if [ $which = arch ]; then
+			  def=aarch64-arches.def
+			  pattern=AARCH64_ARCH
+			else
+			  def=aarch64-cores.def
+			  pattern=AARCH64_CORE
+			fi
+
+			ext_mask=AARCH64_CPU_DEFAULT_FLAGS
+
+			# Find the base CPU or ARCH id in aarch64-cores.def or
+			# aarch64-arches.def
+			if [ x"$base_val" = x ] \
+			    || grep "^$pattern(\"$base_val\"," \
+				    ${srcdir}/config/aarch64/$def \
+				    > /dev/null; then
+
+			  if [ $which = arch ]; then
+				base_id=`grep "^$pattern(\"$base_val\"," \
+				  ${srcdir}/config/aarch64/$def | \
+				  sed -e 's/^[^,]*,[ 	]*//' | \
+				  sed -e 's/,.*$//'`
+			  else
+				base_id=`grep "^$pattern(\"$base_val\"," \
+				  ${srcdir}/config/aarch64/$def | \
+				  sed -e 's/^[^,]*,[ 	]*//' | \
+				  sed -e 's/,.*$//'`
+			  fi
+
+			  while [ x"$ext_val" != x ]
+			  do
+				ext_val=`echo $ext_val | sed -e 's/\+//'`
+				ext=`echo $ext_val | sed -e 's/\+.*//'`
+				base_ext=`echo $ext | sed -e 's/^no//'`
+
+				if [ x"$base_ext" = x ] \
+				    || grep "^AARCH64_OPT_EXTENSION(\"$base_ext\"," \
+				    ${srcdir}/config/aarch64/aarch64-option-extensions.def \
+				    > /dev/null; then
+
+				  ext_on=`grep "^AARCH64_OPT_EXTENSION(\"$base_ext\"," \
+					${srcdir}/config/aarch64/aarch64-option-extensions.def | \
+					sed -e 's/^[^,]*,[ 	]*//' | \
+					sed -e 's/,.*$//'`
+				  ext_off=`grep "^AARCH64_OPT_EXTENSION(\"$base_ext\"," \
+					${srcdir}/config/aarch64/aarch64-option-extensions.def | \
+					sed -e 's/^[^,]*,[ 	]*[^,]*,[ 	]*//' | \
+					sed -e 's/,.*$//' | \
+					sed -e 's/).*$//'`
+
+				  if [ $ext = $base_ext ]; then
+					# Adding extension
+					ext_mask="("$ext_mask") | ("$ext_on")"
+				  else
+					# Removing extension
+					ext_mask="("$ext_mask") & ~("$ext_off")"
+				  fi
+
+				  true
+				else
+				  echo "Unknown extension used in --with-$which=$val" 1>&2
+				  exit 1
+				fi
+				ext_val=`echo $ext_val | sed -e 's/[a-z0-9]\+//'`
+			  done
+
+			  ext_mask="(("$ext_mask") << 6)"
+			  if [ x"$base_id" != x ]; then
+				target_cpu_cname="TARGET_CPU_$base_id | $ext_mask"
+			  fi
+			  true
+			else
+			  echo "Unknown $which used in --with-$which=$val" 1>&2
+			  exit 1
+			fi
+		done
+		;;
+
 	alpha*-*-*)
 		supported_defaults="cpu tune"
 		for which in cpu tune; do
@@ -3476,6 +3590,15 @@ esac
 # Set some miscellaneous flags for particular targets.
 target_cpu_default2=
 case ${target} in
+	aarch64*-*-*)
+		if test x$target_cpu_cname = x
+		then
+			target_cpu_default2=TARGET_CPU_generic
+		else
+			target_cpu_default2=$target_cpu_cname
+		fi
+		;;
+
 	arm*-*-*)
 		if test x$target_cpu_cname = x
 		then
diff --git a/gcc/configure b/gcc/configure
index 387de5b743cb2b44afb1206ef6a8689ab1fcbbfa..bef4ea36af785578d111ff702acf615aa556b49c 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -23189,6 +23189,19 @@ foo:
 	tls_first_minor=19
 	tls_as_opt='--fatal-warnings'
 	;;
+  aarch64*-*-*)
+    conftest_s='
+	.section ".tdata","awT",%progbits
+foo:	.long	25
+	.text
+	adrp  x0, :tlsgd:x
+	add   x0, x0, #:tlsgd_lo12:x
+        bl    __tls_get_addr
+	nop'
+	tls_first_major=2
+	tls_first_minor=20
+	tls_as_opt='--fatal-warnings'
+	;;
   powerpc-*-*)
     conftest_s='
 	.section ".tdata","awT",@progbits
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b6c049b022bd85ddf2e42a55f98d57a50ce2775c..dee70dc2061a56a02b5d62954ac75bbfa52a72d8 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2965,6 +2965,19 @@ foo:
 	tls_first_minor=19
 	tls_as_opt='--fatal-warnings'
 	;;
+  aarch64*-*-*)
+    conftest_s='
+	.section ".tdata","awT",%progbits
+foo:	.long	25
+	.text
+	adrp  x0, :tlsgd:x
+	add   x0, x0, #:tlsgd_lo12:x
+        bl    __tls_get_addr
+	nop'
+	tls_first_major=2
+	tls_first_minor=20
+	tls_as_opt='--fatal-warnings'
+	;;
   powerpc-*-*)
     conftest_s='
 	.section ".tdata","awT",@progbits

       reply	other threads:[~2012-10-23  9:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <50865E58.4020507@arm.com>
2012-10-23  9:43 ` Marcus Shawcroft [this message]
2012-10-23 15:48   ` Jeff Law
     [not found] ` <50865F45.2030707@arm.com>
2012-10-23  9:43   ` [PATCH] [2/10] " Marcus Shawcroft
2012-10-23 14:58     ` Joseph S. Myers
2012-10-23 18:02       ` Marcus Shawcroft
2012-10-23 15:38     ` Jeff Law
     [not found]   ` <50865F98.8020403@arm.com>
     [not found]     ` <50865FF6.4040301@arm.com>
     [not found]       ` <5086603D.8080003@arm.com>
2012-10-23  9:43         ` [PATCH] [5/10] " Marcus Shawcroft
2012-10-23 15:32           ` Jeff Law
     [not found]         ` <5086604F.8060700@arm.com>
     [not found]           ` <5086605C.3020502@arm.com>
     [not found]             ` <50866077.5040300@arm.com>
2012-10-23  9:43               ` [PATCH] [7/10] " Marcus Shawcroft
2012-10-23 15:18                 ` Jeff Law
2012-10-23 19:41                 ` Tom Tromey
2012-10-23  9:43               ` [PATCH] [9/10] " Marcus Shawcroft
2012-10-23  9:52                 ` Jakub Jelinek
     [not found]               ` <50866080.7040807@arm.com>
2012-10-23  9:44                 ` [PATCH] [8/10] " Marcus Shawcroft
2012-10-23 15:33                   ` Jeff Law
2012-10-23  9:44                 ` [PATCH] [10/10] " Marcus Shawcroft
2012-10-23 15:48                   ` Jeff Law
2012-10-23  9:46           ` [PATCH] [6/10] " Marcus Shawcroft
2012-10-23 15:19             ` Jeff Law
2012-10-23 17:52               ` Marcus Shawcroft
2012-10-23  9:44       ` [PATCH] [4/10] " Marcus Shawcroft
2012-10-23 15:14         ` Jeff Law
2012-10-23  9:47     ` [PATCH] [3/10] " Marcus Shawcroft
2012-10-23 15:40       ` Jeff Law
2012-10-23 16:03         ` Ramana Radhakrishnan
2012-10-23 16:57         ` Marcus Shawcroft

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=50866671.4030201@arm.com \
    --to=marcus.shawcroft@arm.com \
    --cc=gcc-patches@gcc.gnu.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).